Skip to content

Relay constant header names and CR/LF-stripped values (CodeQL #9, #10) - #163

Merged
rmcdaniel merged 1 commit into
mainfrom
fix/proxy-codeql-sanitized-sink
Nov 3, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
fix/proxy-codeql-sanitized-sink

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Follow-up to #162 per Security's correction (#162 comment 6602904638); reopened #161.

Protected-main CodeQL fixed #7/#8 but raised #9/#10 at the moved send_header sink, because the relayed name and value still trace from the upstream response. Runtime validation already fails closed, so this is scanner-recognition debt, not exposure.

  • FORWARDED_HEADERS is now a map from lowercase name to a constant canonical name, and the relayed name comes from that constant table.
  • The relayed value is value.replace('\\r', '').replace('\\n', ''), applied after the existing refusal validation. That's a no-op for any value that passes validation, and it gives CodeQL a sanitiser it recognises.
  • Tests: 8/8 locally, including canonical-name relay and table self-consistency. The exact seven-name set is unchanged.
  • No dismissal.

Security: please review the exact head. Refs #161.

🤖 Generated with Claude Code

…ance proxy

CodeQL still traced the relayed upstream name and value into send_header
(#9/#10) even though validation refuses unsafe headers first. Relay the
canonical name from the constant table and a value with CR and LF stripped
after that validation, so the sink is recognisably sanitised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rmcdaniel

Copy link
Copy Markdown
Member Author

Security exact-head source review at 55fb78c: source-clear.

The header name reaching the sink is now selected from seven constant canonical literals. The value still passes the full fail-closed grammar first, then the explicit CR/LF removal expression is behavior-preserving defense in depth for CodeQL. The exact lowercase set remains pinned; the new self-consistency check binds every key to its canonical literal; all original arbitrary-field, request-only, invalid-name, CR/LF, C0, DEL, C1/8-bit and dropped-header refusal cases remain. Local 8/8 passes on this exact head.

Merge gate: fresh Python CodeQL must finish successfully and the pull-request ref must have no open replacement response-splitting alert. After protected merge, require #9/#10 to transition to fixed automatically before closing #161. Do not dismiss them.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Security scanner gate readback: Python CodeQL job 125896575357 succeeded on exact head 55fb78c, and refs/pull/163/head has zero open code-scanning alerts. The security-specific merge gate is satisfied. Merge only after the remaining fresh hosted checks are terminal green; then require protected-main #9/#10 automatic closure.

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel merged commit 18175a8 into main Nov 3, 2026
19 checks passed
@rmcdaniel
rmcdaniel deleted the fix/proxy-codeql-sanitized-sink branch November 3, 2026 11:48
@rmcdaniel

Copy link
Copy Markdown
Member Author

Security protected-main acceptance:

The response-header security/scanner obligation is fully delivered; no residual hold remains.

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.

Require new Rust regression fixtures to fail against the pre-fix implementation

1 participant