Skip to content

test: add missing HTTP analyzer test coverage#59

Merged
Zious11 merged 2 commits intodevelopfrom
worktree-issue-20-http-test-coverage
Apr 10, 2026
Merged

test: add missing HTTP analyzer test coverage#59
Zious11 merged 2 commits intodevelopfrom
worktree-issue-20-http-test-coverage

Conversation

@Zious11
Copy link
Copy Markdown
Owner

@Zious11 Zious11 commented Apr 10, 2026

Summary

  • Adds 6 tests closing the 5 remaining gaps from issue test: add missing HTTP analyzer test coverage #20 (the other 2 — garbage recovery and concurrent flow isolation — were already covered by existing tests).
  • Perplexity-validated: confirmed the 2048-char URI threshold is a reasonable (if conservative) forensic signal, and that empty User-Agent (Some("")) is more anomalous than missing UA (None).

Tests added

Test Gap covered
test_buffer_cap_no_panic_on_oversized_headers >64KB header data silently truncated, no panic
test_detect_long_uri URI >2048 chars triggers Execution finding
test_detect_empty_user_agent Empty UA header triggers Anomaly finding
test_missing_user_agent_no_finding Absent UA header does NOT trigger finding
test_detect_admin_panel_paths /wp-admin, /admin, /phpmyadmin, /manager
test_partial_response_reassembly Response split across two chunks reassembles

Issue #20 gap status

# Gap Status
1 Garbage input recovery Already covered (test_single_error_does_not_poison)
2 Buffer cap (64KB) New
3 Long URI detection New
4 Empty User-Agent New (2 tests: positive + negative)
5 Admin panel detection New
6 Partial response reassembly New
7 Multiple concurrent flows Already covered (test_cross_flow_isolation_*)

Closes #20

Test plan

  • All 35 HTTP analyzer tests pass (cargo test --test http_analyzer_tests)
  • Full suite passes (176 tests, 0 failures)
  • cargo clippy --all-targets clean
  • cargo fmt --check clean
  • Multi-agent PR review (test-analyzer, code-reviewer) — 0 issues

Add 6 tests closing 5 of 7 gaps identified in issue #20 (the other 2
were already covered by existing tests):

- test_buffer_cap_no_panic_on_oversized_headers: >64KB header data
  is silently truncated, no panic, no unbounded growth
- test_detect_long_uri: URI >2048 chars triggers Execution finding
- test_detect_empty_user_agent: empty UA header triggers Anomaly finding
- test_missing_user_agent_no_finding: absent UA header is not flagged
- test_detect_admin_panel_paths: /wp-admin, /admin, /phpmyadmin, /manager
- test_partial_response_reassembly: split response across two chunks

Closes #20
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 missing unit tests for the HTTP analyzer to close remaining coverage gaps tracked in issue #20, focusing on edge-case parsing, anomaly signals, and response reassembly behavior.

Changes:

  • Add tests covering header buffer cap behavior, long-URI detection, and empty vs missing User-Agent handling.
  • Add tests for admin panel path reconnaissance detections.
  • Add test for response header reassembly across multiple on_data calls.

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

Comment thread tests/http_analyzer_tests.rs Outdated
Address Copilot review: send follow-up terminator on the same flow
after oversized header. If buffer had retained all bytes, the request
would complete parsing. With truncation, it stays unparsed — proving
the 64KB cap is enforced, not just that no panic occurs.
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


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

@Zious11 Zious11 merged commit 5d312e5 into develop Apr 10, 2026
8 checks passed
@Zious11 Zious11 deleted the worktree-issue-20-http-test-coverage branch April 10, 2026 20:30
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: add missing HTTP analyzer test coverage

2 participants