fix(input): parse raw request line and headers by name, not position - #7627
Conversation
The second line was always consumed as the Host line, so any request-shaped input whose Host header sat elsewhere lost that header silently and skipped fuzzing. Reading values by skipping one byte past the colon also truncated unspaced values and panicked on valueless headers, crashing the scan. Absolute request targets, as used by proxy captures, were appended to the authority instead of replacing it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesRaw HTTP parsing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/input/types/http.go`:
- Around line 243-250: Normalize the HTTP or HTTPS scheme to lowercase in the
absolute-form branch before calling ParseAbsoluteURL, while preserving the rest
of the request target unchanged; use the existing case-insensitive scheme
detection around urlx parsing. Add a regression test for an uppercase-scheme
target that verifies both the parsed authority and path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c3181448-9729-44de-96f4-d3395fa4c105
📒 Files selected for processing (2)
pkg/input/types/http.gopkg/input/types/http_test.go
Fixes #7626
ParseRawRequestread the request line and headers positionally: line 2 was always taken as the Host line, and header values were read by skipping one byte past the colon.Hostis picked up by name, wherever it sitsHost:example.comno longer loses a character andX-Empty:no longer panics the scanpkg/protocols/http/raw.readRawRequestalready handles all of this for templateraw:requests.Tests cover each shape. Well-formed requests parse exactly as before, and the full integration suite is green.
Summary by CodeRabbit
Bug Fixes
Tests