Closed ewodrich closed 4 months ago
Question: Does running with the -d
/ --debug
flag reveal more info? (Or do we want to reveal more info without this flag?)
Response to above re: using debug, still no note that explicitly states the scan stopped prior to completion, maybe more technical users will be able to infer that.
/Users/Esthe/Sites/wordpress/eicar-test-file.php,5972,Safe:DOS/EICAR-Test-File.5972,Safe test file used to confirm anti-virus detection,b'X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 222, in search_directory
contents = os.scandir(path)
^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/Users/Esthe/Sites/wordpress/wp-test-permissions'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 352, in run
locator.locate()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 264, in locate
for path in self.search_directory(real_path):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 238, in search_directory
yield from self.search_directory(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 224, in search_directory
self._handle_io_error(os_error, path)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wordfence/scanning/scanner.py", line 213, in _handle_io_error
raise ScanningIoException(
wordfence.scanning.exceptions.ScanningIoException: Directory search of /Users/Esthe/Sites/wordpress/wp-test-permissions failed ([Errno 13] Permission denied: '/Users/Esthe/Sites/wordpress/wp-test-permissions')
@ewodrich Just to clarify, the option is --no-allow-io-errors
(with two leading hyphens). It looks like you may be testing with -no-allow-io-errors
(one hypen), which isn't supported.
Corrected scan options and updated comments as per above from akenion.
Discussed and typically users will be technical and probably check exit codes, etc closing
If a vuln-scan or malware-scan fail due to IO error, update the error message to make clear the scan has failed. This is especially pertinent if a scan begins to populate output and then fails, which may be unclear to a user that the scan did not complete.
Ideas for wording:
Scan failed. Error: Unable to scan directory at <directory>
Scan could not complete. Error: Unable to scan directory at <directory>
Scan stopped before completing. Error: Unable to scan directory at <directory>
Example end results with
--no-allow-io-errors
and a file that fails due to permissions: