API security as an environment
Modern products are APIs with a few front ends. The failures are mostly authorization, data minimization, and resource limits.
Diagram
The OWASP API Top 10 (2023) as review steps
Step 1 of 4
Objects
API1 broken object level authorization: check owner on every id.
# Objects # API1 broken object level authorization: check owner on # every id.
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Object authorization
- What fails
- APIs expose ids directly, so every call needs an owner check.
- Who is affected
- Every tenant.
- What you would notice
- Responses for other users’ ids.
- What you change
- Check ownership in the data layer.
Property authorization
- What fails
- Responses over-share fields and requests write fields they should not.
- Who is affected
- Users and the business.
- What you would notice
- Hashes in responses, role fields writable.
- What you change
- Explicit read and write schemas.
Resource consumption
- What fails
- No limits means scraping and cost blowouts.
- Who is affected
- Availability and budget.
- What you would notice
- No 429 under burst.
- What you change
- Rate limits, pagination caps, and timeouts.
From pages to published methods
A server-rendered site hides a lot of workflow in HTML. An API publishes the workflow. Mobile apps, single-page front ends, partners, and internal tools all call the same methods. Attackers do not need the UI. They need the method, the identifier, and a token. Anything the UI refuses and the API allows is a bug.
GraphQL, REST, and RPC differ in syntax and share this property. Authorization has to live where the data is fetched, not in the gateway's hope that a route name sounds administrative. A single resolver that forgets the tenant id undoes the rest of the design.
Object and function authorization
Broken object level authorization is the API name for reading or changing someone else's record by substituting an identifier. Broken function level authorization is calling an admin method with a user token. Both show up constantly because the happy path was tested with one account.
Test design, in a lab or an authorized assessment, is boring and effective: two tenants, two roles, and a matrix of every method. If user A can name user B's object and the response is not a denial, you have a finding. Impact is the data in that object, stated in the owner's language.
Data you did not mean to ship
Excessive data exposure happens when the serializer returns the database row and the front end chooses columns. Anyone with a token sees the extra fields: hashes, internal notes, other tenants' metadata, feature flags. Mass assignment is the write-side twin: the client includes a field the UI never shows, and the update endpoint copies it.
Define response and request models per caller. Log the shape, not the secrets. Pagination should have a maximum. Error messages should not include stack traces, query text, or other users' identifiers in production.
Quotas, tokens, and partners
APIs get expensive. Unbounded queries, giant payloads, and webhooks that retry forever are an availability and a bill problem. Partner tokens are a second product: they leak into the partner's logs, they outlive the employee who created them, and they often can do more than the integration needs.
Prefer short-lived tokens, narrow scopes, and a way to revoke a partner without a deploy. Rate limits should exist at the identity, not only at the IP, because attackers have many IPs and your heaviest legitimate caller might have one. The OWASP API Security Top 10 is the checklist to reread when you add a new public method.
Check yourself
Recognition and the fix. Nothing here is a procedure.
User B fetches /api/orders/1001, which belongs to user A, and gets 200. Which category?
Go deeper
Specific techniques, exercises, and glossary cards for this topic.
- 01Broken API authentication: tokens, keys, and the checks that get skippedCommon API authentication failures: unvalidated JWT claims, API keys in URLs, missing rate limits on token endpoints, and long-lived tokens. Includes the diagram and a defensive fix.
- 02API security misconfiguration: defaults, debug modes, and permissive CORSThe configuration mistakes that turn a sound API into an exposed one: debug endpoints, verbose errors, wildcard CORS with credentials, open documentation consoles, and missing TLS settings, with a scan-and-fix workflow. Includes the diagram and a defensive fix.
- 03Injection through API fields: JSON bodies reaching SQL, NoSQL, and shellsWhy JSON APIs are still injection targets: operator injection in MongoDB-style queries, typed fields that are never type-checked, and filter parameters passed to query builders. Includes the diagram and a defensive fix.
- 04Unsafe consumption of third-party APIs: treating partner data as trustedWhen your service calls a partner or SaaS API, its responses are input too. Includes the diagram and a defensive fix.
- 05API inventory gaps: shadow, zombie, and undocumented endpointsYou cannot protect APIs you do not know about. Includes the diagram and a defensive fix.
- 06GraphQL security: introspection, resolver authorization, and query costWhere GraphQL APIs go wrong — missing authorization in resolvers, unbounded nested queries, batching that defeats rate limits, and injection in resolver code — and how to review a schema and test it with a tool like InQL or graphql-cop. Includes the diagram and a defensive fix.
Glossary
- 01Security misconfigurationDefault accounts, open storage, verbose errors, or unused admin ports expose more than the product needs.
- 02Broken API authenticationA caller reaches an API method with a missing, guessable, or never-expiring credential.
- 03API security misconfigurationDebug routes, default accounts, or verbose errors ship with the API.
- 04Injection through API fieldsA field the client sends is glued into a query, a filter, or a command.
- 05Unsafe consumption of third-party APIsYour server trusts a partner response and treats it as already authorized data.
- 06API inventory gapsA forgotten version or a shadow method stays on the internet after the product moved on.