Skip to content

test: e2e HTTP analyzer → reporter regression tests#58

Merged
Zious11 merged 2 commits intodevelopfrom
worktree-issue-56-http-reporter-e2e
Apr 10, 2026
Merged

test: e2e HTTP analyzer → reporter regression tests#58
Zious11 merged 2 commits intodevelopfrom
worktree-issue-56-http-reporter-e2e

Conversation

@Zious11
Copy link
Copy Markdown
Owner

@Zious11 Zious11 commented Apr 10, 2026

Summary

  • Adds 3 end-to-end tests that drive HttpAnalyzer::on_data with crafted HTTP requests containing C1 CSI (U+009B) injection, then render through both TerminalReporter and JsonReporter, verifying ADR 0003's output sanitization contract.
  • Key discovery during issue validation: httparse rejects C0 control bytes (including ESC 0x1b) in URIs and header values, but accepts C1 codepoints (U+009B CSI = 0xC2 0x9B) because their UTF-8 encoding uses high bytes (≥ 0x80). C1 CSI is the real viable injection vector through the HTTP analyzer.
  • Closes the coverage gap identified by pr-test-analyzer during the ADR 0003 PR review (feat(reporter): layered output sanitization + ADR 0003 #57).

Tests added

Test Vector Path
test_http_finding_c1_csi_escaped_by_terminal_reporter C1 CSI in path-traversal URI Finding → TerminalReporter
test_http_finding_c1_csi_in_json_reporter C1 CSI in path-traversal URI Finding → JsonReporter round-trip
test_http_analyzer_summary_c1_csi_escaped_by_terminal_reporter C1 CSI in Host header AnalyzerSummary → TerminalReporter

Closes #56

Test plan

  • All 12 reporter tests pass (cargo test --test reporter_tests)
  • Full suite passes (170+ tests, 0 failures)
  • cargo clippy --all-targets clean
  • cargo fmt --check clean
  • Multi-agent PR review (test-analyzer, code-reviewer, comment-analyzer) — 0 critical issues

Zious11 added 2 commits April 10, 2026 15:44
Add 3 end-to-end tests that drive HttpAnalyzer with C1 CSI (U+009B)
injection and verify the full reporter pipeline escapes dangerous bytes.

Key finding during issue validation: httparse rejects C0 control bytes
(including ESC 0x1b) in URIs and header values, but accepts C1
codepoints because their UTF-8 encoding (0xC2 0x9B) uses high bytes.
C1 CSI is the real injection vector through the HTTP analyzer.

Tests added:
- test_http_finding_c1_csi_escaped_by_terminal_reporter
- test_http_finding_c1_csi_in_json_reporter
- test_http_analyzer_summary_c1_csi_escaped_by_terminal_reporter

Closes #56
RFC 8259 only mandates escaping C0 (U+0000-U+001F). serde_json also
escapes DEL (U+007F) as an implementation choice, not per RFC mandate.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end regression coverage for ADR 0003’s “raw in data layer, escape at render time” contract specifically on the real HttpAnalyzer::on_data path, focusing on the viable C1 control-code injection vector (U+009B CSI) that survives httparse parsing.

Changes:

  • Add 3 e2e tests that feed crafted HTTP requests into HttpAnalyzer::on_data and validate reporter behavior.
  • Assert terminal output escapes C1 CSI (no raw 0xC2 0x9B bytes) for both findings and analyzer summaries.
  • Assert JSON round-trip preserves the C1 CSI codepoint in Finding.summary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Zious11 Zious11 merged commit 3a4cac7 into develop Apr 10, 2026
8 checks passed
@Zious11 Zious11 deleted the worktree-issue-56-http-reporter-e2e branch April 10, 2026 19:58
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.

test: end-to-end HTTP analyzer → terminal reporter regression test

2 participants