Cloudflare AppSec Lab API · Playground · santosedge.com
Interactive API Playground

AppSec Lab API — click, run, watch the edge decide.

Every request goes through Cloudflare’s edge before reaching this origin. Interactive reference: API Shield Test Drive · mTLS · Swagger /docs · openapi-cf.json (curated OAS 3.0.3 for API Shield)

Service

GET/api/health

Liveness check.

POST/echo

Diagnostics: shows exactly what reached the origin — method, headers, cf-ray, body. If an attack was blocked at the edge, this never fires.

Catalog (public)

GET/api/customers

List all customers (fake data).

GET/api/customers/1

Fetch one customer by id.

Schema validation demo (API Shield)

POST/api/customers

Valid payload — passes schema and reaches the origin (201 Created).

After enabling API Shield schema validation, attacks like the one below are blocked at the edge with 403 — Security Events shows the rule.

POST/api/customers

Malformed payload — invalid tier and string credit limit. Today the origin rejects it (422); with API Shield it is blocked at the edge before this server.

More schema violations (query, path, header, extra field)

GET/api/customers?limit=9999&tier=gold

Query violation — limit above 100 and an unknown tier.

GET/api/customers/abc

Path violation — the id must be an integer between 1 and 1,000,000.

POST/api/customers

Header violation — valid body, but X-Request-Id is not a UUID.

POST/api/customers

Extra field — mass-assignment style property not defined in the schema.

Session identifiers (API Shield)

Configure up to three identifiers in Security → Settings → API abuse: cookie lab_session, header X-Session-Id and JWT claim (sub). Login first, then compare what the origin received.

POST/api/login

Creates one session and returns it three ways: Bearer JWT, lab_session cookie and a session id for X-Session-Id.

GET/api/whoami

All three carriers. Origin shows which ones arrived and which are valid.

GET/api/whoami

Bearer only (no cookie, no header).

GET/api/whoami

X-Session-Id header only.

GET/api/whoami

Cookie only (browser sends lab_session automatically).

GET/api/whoami

Anonymous (no carrier, no cookie).

JWT validation — Token Lab (API Shield)

Each button mints a token on the server and sends it to GET /api/orders. With the JWT validation configuration and rule from the guide, Edge shows what Cloudflare decides before the origin; Origin is what the application returns when the request arrives. Public key: /.well-known/jwks.json (ES256).

Sequence — login → cart → quote → confirm (API Shield)

Valid order: POST /api/cart/items → POST /api/checkout/quote → POST /api/checkout/confirm. Each button below starts a fresh session. Today the origin enforces the order (409). With a sequence rule at the edge (closed beta) the same wrong order is blocked before the origin (403). Sequence Analytics learns the valid order from real traffic.

Auth flow (JWT)

POST/api/login

Issues a demo JWT (HS256). The token is kept in your browser and used by the orders calls.

GET/api/orders

Protected route — requires a valid bearer token.