Push2Commit
Book a Call
All blog posts

API Security Testing Checklist for REST and GraphQL

Author: Abderrahmen Lahmedi6 min read
Glass block splitting a single cyan data line into two authenticated branches amid a row of endpoint lights

Most API breaches are not clever. Someone changes /orders/1041 to /orders/1042 and the server happily returns another customer's order. That single failure has its own slot at the top of the OWASP API Security Top 10, and it is the first thing worth testing.

This checklist follows the OWASP API Security Top 10 (2023 edition). Each item says what to test and what a failure looks like. You can run most of it yourself with two test accounts and a request tool such as curl, Postman or Burp. Where a test needs a specialist, we say so.

Before you start

  • Two accounts at the same privilege level (A and B), plus one admin. Most authorization tests need one account to try to reach another's data.
  • A staging environment with realistic data. Never run abuse tests (rate limits, resource exhaustion) against production without agreement.
  • An inventory of every endpoint. Export the OpenAPI/Swagger file or the GraphQL schema. If you cannot list your endpoints, you cannot test them (see API9 below).
  • Written authorization if a third party is doing the test.

The checklist

API1: Broken object-level authorization

The most common serious API flaw. The user is logged in, but the server never checks that the object belongs to them.

  1. Log in as A, create a resource, note its ID.
  2. Log in as B, request that ID with GET, PUT, PATCH and DELETE.
curl -s -H "Authorization: Bearer $TOKEN_B" https://staging.example.com/api/orders/1041

Fail: anything other than 403/404. Also test IDs in query strings, bodies, headers and nested paths (/users/{id}/invoices/{invoiceId}). Unguessable UUIDs reduce the risk but are not an authorization check.

API2: Broken authentication

  • Does the login endpoint rate-limit failed attempts and lock or slow down?
  • Do tokens expire? Does logout actually invalidate them server-side?
  • Are JWTs verified with a fixed algorithm? Try alg: none and a token signed with the wrong key.
  • Is the password reset token single-use, short-lived and bound to the account?
  • Are API keys ever accepted in URLs (they end up in logs)?

Fail: a replayed, expired or tampered token is accepted.

API3: Broken object property-level authorization

The object is yours, but you can read or write fields you should not.

  • Compare the response for a normal user and an admin. Does the normal user see fields like isAdmin, internalNotes, costPrice?
  • Mass assignment: send extra fields the client never sends.
curl -X PATCH -H "Authorization: Bearer $TOKEN_A" -H "Content-Type: application/json" \
  -d '{"displayName":"Test","role":"admin","balance":999999}' \
  https://staging.example.com/api/me

Fail: role or balance changes. Fix with an explicit allow-list of writable fields per endpoint, not a blind Object.assign(user, body).

API4: Unrestricted resource consumption

  • Rate limits on login, signup, password reset, search and any endpoint that sends email or SMS.
  • Pagination caps: does ?limit=100000 return 100,000 rows?
  • Upload size and type limits.
  • GraphQL: query depth and cost limits (see the GraphQL section).

Fail: one client can slow the service or run up your SMS/email bill.

API5: Broken function-level authorization

A normal user calling admin functions.

  • As user A, call every admin endpoint you can find in the OpenAPI file or the front-end bundle: /admin/*, /internal/*, POST /users/{id}/role.
  • Try changing the HTTP verb: if GET /users/{id} is protected, is DELETE /users/{id}?

Fail: a non-admin token reaches an admin function.

API6: Unrestricted access to sensitive business flows

Not a bug in one endpoint, but abuse of a legitimate flow: bulk coupon redemption, ticket scalping, referral farming, account enumeration through signup.

  • List the flows where automation would hurt the business and test whether a script can run them at volume.

Fail: the flow has no per-user, per-device or per-IP friction. This one needs product knowledge, so it is hard to test with a generic scanner.

API7: Server-side request forgery

Any endpoint that fetches a URL you supply (webhooks, image import, link previews).

  • Point it at http://169.254.169.254/ (cloud metadata) and internal hostnames on staging.

Fail: the server fetches internal addresses. Fix with an allow-list of hosts and by blocking private IP ranges after DNS resolution.

API8: Security misconfiguration

  • CORS: does Access-Control-Allow-Origin reflect any origin, especially with credentials?
  • Verbose error messages and stack traces in responses.
  • Missing TLS, outdated TLS versions, default credentials on admin panels.
  • Debug endpoints, public Swagger UI, GraphQL introspection on production.

Fail: any of the above is reachable from the internet.

API9: Improper inventory management

  • Old versions (/v1/) still live and less protected than /v3/.
  • Staging or test hosts reachable from the internet with real data.
  • Endpoints in the code that are missing from the documentation.

Fail: you find an endpoint nobody on the team can account for.

API10: Unsafe consumption of third-party APIs

Your API trusts what Stripe, a CRM or an LLM tool returns.

  • Validate and size-limit third-party responses as you would user input.
  • Verify webhook signatures and handle replays.

Fail: a malformed third-party response can crash the service or write bad data. For payment webhooks, see our guide on Stripe webhooks, idempotency and retries.

GraphQL-specific checks

GraphQL needs the list above plus a few of its own.

Check What to try Fail if
Introspection Send an __schema query on production The full schema is public and you did not intend it
Query depth Nest a relationship 15+ levels deep The server executes it
Batching/aliases Send 500 aliased login or OTP mutations in one request Per-request rate limiting is bypassed
Field-level auth Query fields on other users' objects Authorization is only on the root resolver
Suggestions Send a misspelled field name Error messages leak real field names even with introspection off

The usual fix: authorization in the resolver or data layer (not just the route), depth and cost limits, and persisted queries for public clients.

What a scanner will not find

Automated tools are good at API8 (misconfiguration) and basic injection. They are weak at API1, API3, API5 and API6, because those depend on knowing who is allowed to see what. That is why authorization testing with real test accounts is the part worth paying a human for.

If you want to know which type of test fits your situation, read black box vs white box penetration testing. If you are wondering what a test involves cost-wise, see how much a penetration test costs.

FAQ

How often should I test my API? Before launch, after any major change to authentication or permissions, and at least yearly. Run the cheap automated checks (API8, API9) in CI on every release.

Can I use a scanner instead of a pentest? A scanner is a good first pass for misconfiguration and known vulnerabilities. It will miss most authorization flaws, which are the ones that expose customer data.

Do I need to test GraphQL differently from REST? The same risks apply. GraphQL adds introspection, query depth, aliasing and field-level authorization, covered in the table above.

Next step

If you want a second pair of eyes on authorization and business flows, we scope API penetration tests around your endpoints, roles and release date. Send us your OpenAPI file or schema and the number of roles, and we will tell you what a test should cover.

Our Clients

We partner with startups, scale-ups and established businesses across industries, from fintech and SaaS to AI and trading platforms. Our client portfolio reflects the trust and long-term collaboration we build by shipping production-ready products.

Copyright © 2026 P2C - All Rights Reserved.

STE PUSH TO COMMIT · VAT No. 000/M/A/1877276/G