-
Notifications
You must be signed in to change notification settings - Fork 11
Attack wave detection: fix bugs & report samples #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
78f0245
b20f122
7068714
7d5f434
5bf79bf
de48b59
f69e3b5
c999ea2
6ba9e84
f084664
2cbaa10
9c83555
6d28ceb
8efec7f
c31c8fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,20 @@ | ||
| import json | ||
| from aikido_zen.helpers.limit_length_metadata import limit_length_metadata | ||
| from aikido_zen.helpers.logging import logger | ||
| from aikido_zen.storage.attack_wave_detector_store import attack_wave_detector_store | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Importing and using the module-level singleton 'attack_wave_detector_store' caches request-specific samples globally and can leak data between requests Details✨ AI Reasoning 🔧 How do I fix it? More info - Comment |
||
|
|
||
|
|
||
| def create_attack_wave_event(context, metadata): | ||
| def create_attack_wave_event(context): | ||
| try: | ||
| metadata = {} | ||
|
|
||
| samples = attack_wave_detector_store.get_samples_for_ip(context.remote_address) | ||
bitterpanda63 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if samples: | ||
| # Convert samples to JSON string, since metadata is a key-value store of strings. | ||
| metadata["samples"] = json.dumps(samples) | ||
|
|
||
| attack_wave_detector_store.clear_samples_for_ip(context.remote_address) | ||
|
|
||
| return { | ||
| "type": "detected_attack_wave", | ||
| "attack": { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.