fix: handle None query_time in xlsx and invalid timeout CLI args#2908
Open
mitre88 wants to merge 1 commit into
Open
fix: handle None query_time in xlsx and invalid timeout CLI args#2908mitre88 wants to merge 1 commit into
mitre88 wants to merge 1 commit into
Conversation
- Fix xlsx output to use empty string when query_time is None instead of appending None (fixes sherlock-project#2891) - Add try/except in timeout_check() to raise ArgumentTypeError for non-numeric timeout values (fixes sherlock-project#2866) - Add regression tests for invalid timeout values
Author
|
Hi maintainers! I've addressed the issues mentioned in the issues:
Would love to get feedback on this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
query_timeisNoneinstead of appending rawNonevalue (fixes Bug: xlsx output always appends None for response_time_s when query_time is missing #2891)timeout_check()to raiseArgumentTypeErrorfor non-numeric timeout values like "abc" (fixes cli: invalid --timeout values raise a raw parser exception #2866)Changes
sherlock.py
XLSX output fix (lines 921-925): Changed condition from
if response_time_s is None(always false since it's a list) toif query_time is Nonewherequery_time = results[site]["status"].query_timeTimeout validation (lines 533-538): Wrapped
float(value)in try/except to catchValueErrorand re-raise asArgumentTypeErrorfor consistent error handlingtest_ux.py
Added
test_invalid_timeout_valuesparametrized test covering:--timeout 0→ "Invalid timeout value: 0"--timeout -5→ "Invalid timeout value: -5"--timeout abc→ "Invalid timeout value: abc"Testing
The new test can be run with:
pytest tests/test_ux.py::test_invalid_timeout_values -vFixes #2891
Fixes #2866