Repository navigation
fix(detection): scan the Cookie header one name=value pair at a time - #162
Merged
Merged
Conversation
The whole Cookie header was scanned as one value, so the ';' between cookies counted as command separators in the semantic score and an ordinary logged-in header with a JWT reached 0.71. Each pair now goes through the same header scan on its own, like query parameters.
Contributor
Author
|
The only CI failure is |
This was referenced Oct 15, 2026
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.
Delivers issue: #161
Description
_scan_headersnow scans theCookieheader onename=valuepair at a time, the same way query parameters are scanned one by one. Before, the whole header was one value, so the;between cookies counted as command separators in the semantic score, and an ordinary logged-in header reached 0.71 and was rejected (repro in #161).Each pair goes through the same sensitive, excluded or normal header path as before, so every regex and semantic check still runs on each cookie, and the log redaction for
cookieis unchanged. Only spaces around a pair are trimmed, so a CR or LF stays in the scanned value; empty pairs are skipped. Each pair counts againstdetection_max_scan_values, as each query parameter does.The sync tree is regenerated with
scripts/unasync.py, anddocs/configuration/detection-tuning.mdnow says how theCookieheader is scanned.Motivation and Context
Repro in #161.
Type of change
How Has This Been Tested
tests/test_detection/test_cookie_header_pairs.py(5 tests plus the generated sync copy): the logged-in cookie test fails on master and passes here; XSS, SQLi and CRLF inside one cookie are still detected.tests/test_handlers_integration.pyandtests/test_redis/(and their sync copies), because they connect to a fixedlocalhost:6379that is used by something else on my machine.-W error --cov-branch: 8,116 passed, and the new lines are fully covered.scripts/unasync.py --check: clean.True ... (score: 0.71)on master andFalsehere.Screenshots (if appropriate)
Checklist