Skip to content

fix: override GenericLFI_BODY in WAF to unblock LLM agent requests#38

Closed
koljahuang wants to merge 1 commit intomainfrom
fix/waf-rate-limit-all-protocols
Closed

fix: override GenericLFI_BODY in WAF to unblock LLM agent requests#38
koljahuang wants to merge 1 commit intomainfrom
fix/waf-rate-limit-all-protocols

Conversation

@koljahuang
Copy link
Copy Markdown
Contributor

Summary

  • Override GenericLFI_BODY rule in AWSManagedRulesCommonRuleSet to count mode
  • Root cause confirmed via aws wafv2 get-sampled-requests: OpenCode Prometheus agent requests (~157KB body) were being BLOCKed by GenericLFI_BODY because system prompts contain file path patterns like ../../ that trigger LFI detection
  • This was the actual cause of the 403 Forbidden from awselb/2.0 — requests never reached the backend pods

Evidence from WAF sampled requests

07:19:20 | BLOCK | POST /v1/chat/completions | CL=156976 | opencode/1.14.22 | GenericLFI_BODY
07:24:12 | BLOCK | POST /v1/chat/completions | CL=157046 | opencode/1.14.22 | GenericLFI_BODY

Test plan

  • terraform plan confirms only the new rule_action_override is added
  • After apply, verify OpenCode Prometheus Agent no longer returns 403
  • Confirm GenericLFI_BODY matches are logged as COUNT in CloudWatch (not blocked)

…ositives

Agent system prompts contain file path patterns (../../) that trigger
the GenericLFI_BODY rule. Confirmed via WAF sampled requests that
OpenCode Prometheus requests (157KB body) were being blocked by this rule.
@koljahuang koljahuang closed this Apr 24, 2026
@koljahuang koljahuang deleted the fix/waf-rate-limit-all-protocols branch April 24, 2026 23:31
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.

1 participant