Skip to content

fix(traffic): reject CR/LF in ingested methods and headers - #344

Merged
BaaRai merged 1 commit into
BaaRai:mainfrom
Coff0xc:fix/ingest-header-inject
Nov 18, 2026
Merged

BaaRai merged 1 commit into
BaaRai:mainfrom
Coff0xc:fix/ingest-header-inject

Conversation

@Coff0xc

@Coff0xc Coff0xc commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

RecordExternal built req_head/resp_head from the ingest JSON method and header maps. It only trimmed and uppercased the method. Replay already rejects a non-token method and header names or values that contain CR, LF, or NUL.

Ingest now uses those same checks and returns an error without storing the exchange, so a \r\n in a captured header cannot become extra lines in Traffic, evidence .http files, or verification parsing.

Tested: go test ./traffic -run TestRecordExternal pass.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: the method token check and the header CR/LF/NUL checks run before storage, and the test asserts nothing is stored. CI green.

RecordExternal wrote method and header maps into req_head/resp_head
with no token or line-break check. Replay already refused those
values. An ingest JSON string with \r\n became extra evidence lines.

Apply the same validHeaderName and CR/LF/NUL checks before storage.
@BaaRai
BaaRai force-pushed the fix/ingest-header-inject branch from 43b3248 to 2352cfa Compare November 18, 2026 21:41
@BaaRai
BaaRai merged commit b0e3851 into BaaRai:main Nov 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants