Skip to content

Origin abuse protection PR3: WAF-equivalent input validation + GraphQL depth/complexity limit #2270

Description

@jung-thomas

Part of the origin-side abuse protection plan (assuming Akamai Bot Manager removal). Follows the merged PR1 #2263 (shared rate limiter + tiering) and PR2 #2264 (edge-cache Fast-Purge hook + flag-coupled s-maxage).

Scope (plan §6)

WAF-equivalent input validation on the anonymous / agentic write surface. DB-flag gated, fail-open, no new BTP entitlements.

  • Anon POST bodies: body-size caps + JSON depth/shape limits before handlers run.
  • GraphQL /graphql/public: query depth + complexity limit, and introspection off in prod.
  • MCP / A2A: reuse the clampLimit pattern in srv/lib/mcp-arg-validators.js.
  • The existing SELECT-only allowlist validator srv/lib/analytics-sql-validator.cjs stays as its own layer (not replaced).

Notes / constraints

  • New srv/lib/* modules reachable from content-store.js must be added to the .deploy/mta.yaml srv-qa cp list (QA boot crashes otherwise).
  • Feature flag must be registered in srv/lib/feature-flags/registry.js (kind:'db') or it won't surface in the admin Feature Flags UI; update test/unit/feature-flags-registry.test.js.
  • Numeric thresholds go in an ImsConfig-backed runtime-config module (~5s cache), env-free (blue-green drops cf set-env).
  • Fail-open everywhere; never throw into a request tx.

Verification

  • Unit (npm test): GraphQL depth rejection, body-size/JSON-depth clamps, config resolution, registry drift test.
  • Manual: oversized/deeply-nested POST rejected; GraphQL introspection query blocked on /graphql/public; deep query rejected; valid queries unaffected.

Default OFF; enable on DEV, observe, then PROD.

Activity

  1. added a commit that references this issue on Sep 12, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions