Skip to content

WAF tuning: a week of CountedRequests, exclusions, then flip the two body-inspecting groups to BLOCK #951

Open

Description

@athvin

What

#949 landed the config half of #921: managed-ip-reputation BLOCKS at priority 1, and managed-common-ruleset + managed-known-bad-inputs COUNT at 40/50 on er-prod-edge. #921's merge closed the issue, so the time-gated tuning half lives here.

After real traffic has accumulated (a week from the #949 apply, so on or after 2026-11-16; scanner-only traffic counts — it exercises the reputation list, not the bodies):

  • read CountedRequests per rule in both groups (CloudWatch metrics er-prod-edge-common-ruleset / er-prod-edge-known-bad-inputs) and sampled requests for what fired
  • write rule_action_override exclusions for every rule that fired on a legitimate request, each with a comment naming the payload shape that tripped it (the known suspects: SQL-shaped blocking configuration, arbitrary customer column names)
  • flip both groups to BLOCK
  • re-run the Prod edge #555 probe, including the uncovered-path control — the three rate rules must still behave
  • report what the IP reputation list blocked over the week (its BlockedRequests)

Refs #921 (acceptance carried over), #555 (the probe to re-run).


Product context (2026-11-26)

Why this matters for the API product: This protects operate safely at the public edge. The body-inspecting groups are also the rules most likely to block a legitimate configure payload: blocking rules are SQL-shaped (blocking[].expr), and customer column names are arbitrary. So exclusions must exist before BLOCK goes on.

Current state:

  • The time gate (2026-11-16) has passed. On main, both groups still COUNT (infra/terraform/envs/prod/edge.tf:467-495, override_action { count {} }), and IP reputation blocks (edge.tf:448). No commit to edge.tf since feat(infra): prod WAF managed rule groups — IP reputation blocks, body-inspecting groups count #949.
  • I couldn't read CountedRequests or BlockedRequests, because AWS was unavailable for this review. Unverified.
  • The prod edge fronts only the Next.js app: one target group, web on port 3000 (edge.tf:199-245, values-prod.yaml:30-37). er-server's /v1 API isn't routed through the edge. Today's traffic is browser and BFF traffic, not customer API-key traffic. A week of counts won't show what an API client's request bodies trip.

Definition of done: As above. Add one item: replay a representative customer configuration (a dataset mapping plus a blocking config with SQL expressions) through the edge under COUNT, and confirm it trips nothing before flipping.

Dependencies / sequencing: The exclusion set depends on how customers will reach the API (#529, #523). If /v1 gets its own edge path, the tuning has to be redone for that path.

Open product decision: Decide how API customers reach er-server: directly through the edge on its own host or path, or through the BFF. That decides which paths and bodies these rules must tolerate.

Size: About 0.5 engineer-weeks.

Activity

  1. added
    mvp
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mvp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions