Skip to content

Commit

Permalink
Updated vuln-scan command to return error when no path(s) are supplied.
Browse files Browse the repository at this point in the history
  • Loading branch information
barmat committed Oct 27, 2023
1 parent 5c54042 commit 367e781
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wordfence/cli/vulnscan/vulnscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ...logging import log
from ..subcommands import Subcommand
from .reporting import VulnScanReportManager
from ...vulnscanning.exceptions import VulnScanningConfigurationException


class VulnScanSubcommand(Subcommand):
Expand Down Expand Up @@ -157,6 +158,14 @@ def _scan_site(
)

def invoke(self) -> int:
if (len(self.config.trailing_arguments) + \
len(self.config.wordpress_path) + \
len(self.config.plugin_directory) + \
len(self.config.theme_directory)) \
< 1:
raise VulnScanningConfigurationException(
'At least one WordPress path must be specified'
)
if self.config.output_format == 'human' \
and not self.context.allows_color:
log.warning(
Expand Down
6 changes: 6 additions & 0 deletions wordfence/vulnscanning/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class VulnScanningException(Exception):
pass

class VulnScanningConfigurationException(VulnScanningException):
pass

0 comments on commit 367e781

Please sign in to comment.