fix: validate header names/values and prevent CRLF injection (#1817) - #2442
Open
SaumyaT-21 wants to merge 6 commits into
Open
fix: validate header names/values and prevent CRLF injection (#1817)#2442SaumyaT-21 wants to merge 6 commits into
SaumyaT-21 wants to merge 6 commits into
Conversation
Collaborator
Author
|
Hey @utksh1 ! Added the fix for CRLF injection and HTTP token validation. All green on CI checks. Please go ahead and review the changes! |
utksh1
requested changes
Aug 4, 2026
utksh1
left a comment
Owner
There was a problem hiding this comment.
Request changes: _HEADER_NAME_re.match() is not anchored, so a value such as X-Test@invalid can pass by matching only the valid prefix. Use a full match/anchors and add tests for trailing invalid characters. Also remove the unrelated frontend/package-lock.json update and add coverage for invalid field values through the actual header-building path.
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.
Description
Validates HTTP header names and values in
crawler.pyto ensure they conform to HTTP specs.Specifically:
\r(Carriage Return) and\n(Line Feed) characters to prevent header injection (CRLF) vulnerabilities.ValueErrorwith clear messaging when an invalid header format or illegal character is detected.Related Issues
Closes #1817
Type of Change
How Has This Been Tested?
Tested manually via a local test block in
crawler.pyusing Python in the project's virtual environment:\ror\ncharacters in either the header name or the header value correctly raises aValueError.Checklist