⚡ Live · real WAF · graphql.tarheel.us

/graphql — Cloudflare API Shield Live Demo

This endpoint sits on the tarheel.us Cloudflare zone, which has API Shield enabled. A WAF Custom Rule is deployed in front of it that blocks GraphQL queries exceeding documented size or depth thresholds. This is the real product, not a simulation — malicious requests are filtered at the Cloudflare edge before they ever reach this Worker.

How to tell what's blocking what:

403 with Cloudflare HTML challenge page = the real WAF blocked it at the edge.
200 with JSON data response = your query passed the WAF and reached the Worker origin.

Every block lands in Security → Events with the matched rule, parsed query size, and parsed query depth visible.

The deployed rule

(http.host eq "graphql.tarheel.us"
 and ends_with(http.request.uri.path, "/graphql")
 and cf.api_gateway.graphql.parsed_successfully
 and (cf.api_gateway.graphql.query_size > 30
      or cf.api_gateway.graphql.query_depth > 7))  →  Block

Thresholds match the recommended baseline in Cloudflare's API Shield docs (size > 30 leaf fields OR depth > 7 levels).

Try it

Benign — reaches the origin: 200 OK

curl -X POST https://graphql.tarheel.us/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ user(id: \"42\") { id name } }"}'

Oversized — blocked at the edge: 403

curl -X POST https://graphql.tarheel.us/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ user { f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25 f26 f27 f28 f29 f30 f31 f32 f33 f34 f35 f36 f37 f38 f39 f40 } }"}'

Deeply-nested — blocked at the edge: 403

curl -X POST https://graphql.tarheel.us/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ a { b { c { d { e { f { g { h { i { j } } } } } } } } } }"}'

Full attack script

Run all 4 payloads end-to-end:

./scripts/graphql-attack.sh https://graphql.tarheel.us/graphql

Deploy the same rule on your own zone

Use scripts/graphql-shield-setup.sh in cf-demo-app — fill in your Zone ID and API token at the top, run it, and the script deploys the rule and runs the attacks for you.

Want the simulated version?

If you don't have an Enterprise zone with API Shield to deploy a real rule, the same endpoint runs in simulation mode at cf-demo-app.dustinburke23nc.workers.dev/graphql — identical response shapes, no real WAF, no Cloudflare account required.

Docs

Cloudflare API Shield — GraphQL malicious query protection