Skip wave-attack detection for bypassed requests#624
Open
bitterpanda63 wants to merge 2 commits intomainfrom
Open
Skip wave-attack detection for bypassed requests#624bitterpanda63 wants to merge 2 commits intomainfrom
bitterpanda63 wants to merge 2 commits intomainfrom
Conversation
The request URL captured for attack events was missing the query string, causing path-traversal events (and other query-driven attacks) to lose the malicious payload from their reported URL. Re-enables test_path_traversal in the QA suite.
Adds a defensive bypass-flag check inside is_attack_wave so that wave detection consistently honours the BypassedContextStore signal even if a caller forgot to skip post_response for a bypassed request. Also adds two regression tests: - 16 requests with distinct query strings produce 15 unique samples (previously collapsed to 1 sample because URL stripped the query string). - Bypassed flag set: is_attack_wave returns False and never collects samples. Re-enables test_wave_attack in the QA suite. The QA test relies on: - The BypassedContextStore wiring from "Skip context creation for bypassed IPs". - The query-string preservation from "Include query string in URL for ASGI/WSGI requests".
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
Two related fixes for the wave-attack detector:
Defensive bypass check. `is_attack_wave` now returns False when `BypassedContextStore.is_bypassed()` is set. Callers should normally never reach here for bypassed requests (the framework entry point clears the context), but this keeps wave detection consistent with all other per-request blocking sites.
Regression test for sample collection. 16 requests with distinct query strings should produce 15 unique samples — but `context.url` previously stripped the query string, collapsing them all into 1 sample. Test added to lock in the post-fix behavior.
Tests fixed in QA suite
Dependencies
This PR's QA gate passes only after both dependencies merge:
The detector code change here is independent of either, but the QA test re-enable will fail until both land.
Test plan
Merge notes
🤖 Generated with Claude Code
Summary by Aikido
🚀 New Features
⚡ Enhancements
🐛 Bugfixes
More info