Request a Consultation

Insights · Cybersecurity

API security: designing for authorization and testing what scanners miss

By the Cystem X Engineering Team - Published - 5 min read

APIs now carry most application traffic, and attackers know it. Unlike traditional web pages, APIs expose business logic directly, and many of their weaknesses are failures of authorization that automated scanners cannot recognize. Securing them requires good design, consistent enforcement and tests written with the business rules in mind.

Know your API inventory

Organizations often run more APIs than they know about: old versions, internal endpoints exposed accidentally and undocumented shadow services. Maintain a catalog generated from gateways, code and traffic.

Retire deprecated versions on a schedule and monitor for unexpected endpoints.

Get object-level authorization right

The most common serious API flaw is allowing a user to access another user object by changing an identifier. Every request that references an object must check that the caller is permitted to access that specific object, on the server, every time.

Use unpredictable identifiers as a secondary measure, not as the control.

Authentication tells you who is calling. Authorization decides what they may touch.
Hands typing on a laptop with code on screen
Authorization logic belongs in the service, tested like any other code.

Authenticate and scope properly

Use standard protocols such as OAuth 2.0 and OpenID Connect, short-lived tokens and least-privilege scopes. Validate tokens fully, including signature, issuer, audience and expiry.

Keep machine-to-machine credentials in a secrets manager and rotate them.

Limit data exposure

Return only the fields the client needs, rather than whole objects filtered on the client. Apply property-level authorization so that users cannot read or modify fields they should not, such as role or price.

Use explicit response schemas and reject unknown input fields.

Engineer at a workstation with several monitors
Manual testing finds the business logic flaws scanners miss.

Protect against abuse

Apply rate limits and quotas per client, validate input size and shape, and defend against resource-heavy queries, especially in GraphQL. Monitor for credential stuffing, enumeration and scraping patterns.

A gateway helps enforce these controls consistently, but must not replace authorization checks in the services.

Test beyond scanning

Combine automated schema-driven testing with manual testing of authorization across roles and tenants. Write test cases for business logic abuse, such as skipping workflow steps or replaying requests.

Add contract tests and authorization tests to the pipeline so regressions are caught before release.

Developer with headphones working on code
Pipeline tests catch regressions early.

Monitor and respond

Log requests with caller, object and outcome, without recording secrets. Alert on repeated authorization failures and unusual access patterns, and have a way to revoke tokens quickly.

Review API access in incident exercises, because stolen tokens are a common attack path.

Key takeaways

  • Maintain a live inventory of APIs and retire old versions.
  • Check authorization on every object, every request, on the server.
  • Use standard authentication with short-lived, scoped tokens.
  • Return minimal data and enforce property-level rules.
  • Test authorization across roles and tenants in the pipeline.

Sources and further reading

This article reflects general practice and publicly available guidance. Teams should consult primary sources, including the OWASP API Security Top 10, the OAuth 2.0 and OpenID Connect specifications and the OWASP API Security testing guidance, and adapt the guidance to their own environment, risk appetite and legal obligations.

Software Engineering

Secure your APIs from design to production.

We design, build and test APIs with authorization and abuse resistance built in.

Explore Software Engineering

Let’s engineer what’s next.

Tell us about your initiative - a solution architect will respond within one business day.