test: add missing HTTP analyzer test coverage#59
Merged
Conversation
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
There was a problem hiding this comment.
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_datacalls.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some("")) is more anomalous than missing UA (None).Tests added
test_buffer_cap_no_panic_on_oversized_headerstest_detect_long_uritest_detect_empty_user_agenttest_missing_user_agent_no_findingtest_detect_admin_panel_pathstest_partial_response_reassemblyIssue #20 gap status
test_single_error_does_not_poison)test_cross_flow_isolation_*)Closes #20
Test plan
cargo test --test http_analyzer_tests)cargo clippy --all-targetscleancargo fmt --checkclean