Skip to content

Commit 0095f00

Browse files
committed
Early return for blocked user agents before checking attack waves
1 parent ea6fe2d commit 0095f00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

agent_api/src/main/java/dev/aikido/agent_api/collectors/WebRequestCollector.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ public static Res report(ContextObject newContext) {
5656
if (blockedIpsRes != null)
5757
return blockedIpsRes;
5858

59+
Res blockedUARes = checkBlockedUserAgents(newContext.getHeader("user-agent"));
60+
if (blockedUARes != null)
61+
return blockedUARes;
62+
5963
// Check for attack waves
6064
if (AttackWaveDetectorStore.check(newContext)) {
6165
AttackQueue.add(
6266
DetectedAttackWave.createAPIEvent(newContext)
6367
);
6468
}
6569

66-
return checkBlockedUserAgents(newContext.getHeader("user-agent"));
70+
return null;
6771
}
6872

6973
private static Res checkEndpointAllowlist(RouteMetadata routeMetadata, String remoteAddress, ServiceConfiguration config) {

0 commit comments

Comments
 (0)