leakix: guard parse_results against non-list JSON#3125
Open
liquidsec wants to merge 1 commit into
Open
Conversation
Contributor
🚀 Performance Benchmark Report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3125 +/- ##
=====================================
- Coverage 90% 90% -0%
=====================================
Files 445 441 -4
Lines 38792 38743 -49
=====================================
- Hits 34715 34663 -52
- Misses 4077 4080 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
When
leakix.netreturns an error body that decodes to a JSON string instead of a list — e.g.\"Incorrect API Key\"on an unauthenticated request —parse_resultsiterates over the string character-by-character and triesentry.get(\"subdomain\", \"\"), raisingAttributeError: 'str' object has no attribute 'get'. The exception is caught by the outer try/except insubdomain_enum.query(), so the scan continues, but it adds traceback noise.Sample from a real scan log:
Tightens the type check from a truthy test (
if json:) toisinstance(json, list)so non-list payloads are quietly ignored.(The same scenario triggers
_api_response_is_success=Falseandapi_requestretries, so the error path is well-handled at the request layer; this is just the parse layer being defensive against malformed payloads.)