API Security
API security protects application programming interfaces from unauthorized access, data leakage, and abuse. It covers authentication, authorization, input validation, rate limiting, transport encryption, and defense against injection and business-logic attacks targeting API endpoints.
itOffensive security and application security | OpenSkills.info
Intro
API Security
An application programming interface, or API, defines how one software component asks another component to read data or perform an action. API security protects that exchange from unauthorized use, unsafe input, excessive consumption, and unintended disclosure.
The useful mental model is a guarded contract at every trust boundary. The contract describes allowed operations, inputs, outputs, and errors. The guards establish identity, authorize the exact action, validate the exchange, limit consumption, and record evidence.
client identity and request
↓
transport → gateway controls → service controls → business logic
↓ ↓
authorization data and actions
↓ ↓
response validation ← response
An API gateway can apply shared controls. It cannot know every object, field, workflow state, or business rule. The service that owns a resource must still enforce those decisions.
Why APIs need their own security view
APIs expose application logic and data in a form that software can call repeatedly. A legitimate client can become an attack tool by changing an object identifier or adding a property. It can also switch an HTTP method, replay a workflow step, or automate a sensitive business flow.
The browser or mobile interface is not a security boundary. Attackers call the API directly. They can ignore hidden buttons, client-side validation, navigation order, and assumptions built into the official client.
Internal APIs need the same security reasoning. A network location does not prove which service or user initiated a call. Authenticate the calling service where the architecture requires it. Preserve the end-user identity when one service acts for a user. Authorize both identities against the requested operation and resource.
API security applies before and during runtime:
- Pre-runtime controls define the contract, schemas, ownership, permissions, data classifications, tests, and retirement plan.
- Runtime controls encrypt traffic, authenticate callers, authorize actions, validate messages, enforce limits, and produce telemetry.
The two sets depend on each other. Runtime enforcement is unreliable when the organization does not know which APIs exist or what their contracts permit.
Start with the API contract
An API contract describes the operations a client can call. It also describes request and response shapes, field types, required values, errors, and authentication expectations.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-228-upd1.pdf
Supports
- API protection across pre-runtime and runtime lifecycle stages
- Contracts, request and response schemas, inventories, ownership, and runtime discovery
- Service and end-user authentication and authorization at service boundaries
- Request and response validation, resource limits, rate limiting, monitoring, and gateway patterns
- Shadow and zombie API risks and version retirement controls
- https://owasp.org/API-Security/editions/2023/en/0x11-t10/
Supports
- OWASP API Security Top 10 2023 category names and summaries
- The taxonomy's role as API security awareness material
- https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/
Supports
- Object-level authorization on every operation that resolves a client-supplied object identifier
- Unpredictable identifiers as supplementary rather than sufficient protection
- https://owasp.org/API-Security/editions/2023/en/0xa2-broken-authentication/
Supports
- Authentication and account-recovery flows as protected assets
- Token authenticity and lifetime validation
- API keys as unsuitable for user authentication
- https://owasp.org/API-Security/editions/2023/en/0xa3-broken-object-property-level-authorization/
Supports
- Separate authorization for readable and writable object properties
- Explicit field selection, restricted binding, and response schema enforcement
- https://owasp.org/API-Security/editions/2023/en/0xa4-unrestricted-resource-consumption/
Supports
- Resource risk across rate, memory, execution, payload, batching, pagination, and provider cost
- Per-operation limits, payload limits, and business-tuned rate limits
- https://owasp.org/API-Security/editions/2023/en/0xa5-broken-function-level-authorization/
Supports
- Function authorization independent of URL naming and client interface
- Deny-by-default enforcement and explicit grants for operations
- https://owasp.org/API-Security/editions/2023/en/0xa6-unrestricted-access-to-sensitive-business-flows/
Supports
- Harm caused by excessive automated use of technically valid business flows
- Business identification of sensitive flows followed by engineering controls
- https://owasp.org/API-Security/editions/2023/en/0xa7-server-side-request-forgery/
Supports
- Server-side request forgery through user-influenced remote resource fetching
- Destination allowlists, redirect control, maintained URL parsing, network isolation, and response handling
- https://owasp.org/API-Security/editions/2023/en/0xa8-security-misconfiguration/
Supports
- Misconfiguration across the network, gateway, application, orchestration, and cloud stack
- Repeatable hardening, continuous configuration review, TLS, method restrictions, content types, and safe errors
- https://owasp.org/API-Security/editions/2023/en/0xa9-improper-inventory-management/
Supports
- Inventory of hosts, environments, exposure, versions, integrated services, and sensitive data flows
- Retirement planning and equivalent protection for non-production deployments using production data
- https://owasp.org/API-Security/editions/2023/en/0xaa-unsafe-consumption-of-apis/
Supports
- Integrated API responses as untrusted data requiring validation
- TLS, provider assessment, response limits, timeouts, and redirect restrictions for upstream calls
- https://cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html
Supports
- HTTPS-only REST endpoints and access control on each operation
- JSON Web Token claim validation and the limits of API keys
- Method allowlists, workflow-state validation, input limits, content-type validation, and audit logging
- https://www.rfc-editor.org/rfc/rfc9700.html
Supports
- Current OAuth two point zero security best practice and attacker model
- Authorization code flow guidance, proof key for code exchange, token privilege restriction, and sender constraints
- Refresh-token replay protection through rotation or sender constraint
- https://www.rfc-editor.org/rfc/rfc8725.html
Supports
- Explicit algorithm verification and complete cryptographic validation for JSON Web Tokens
- Issuer and audience validation, explicit typing, and mutually exclusive rules for different token kinds
- https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html
Supports
- Separation of authentication from authorization
- Least privilege, deny by default, permission checks on every request, and server-side enforcement
- Authorization matrices and unit and integration testing of policy
- https://owasp.org/www-project-application-security-verification-standard/
Supports
- ASVS as a requirements basis for testing application technical security controls
- ASVS as guidance for secure development and procurement requirements
