API Gateway Controls: Rate Limiting, Authentication and Schema Validation

Most organizations discovered their API problem the same way: someone counted the endpoints and the number was far higher than anyone expected. Mobile apps, partner integrations, internal microservices and legacy SOAP wrappers all publish interfaces, and each one is a door. An API gateway is how you stop managing those doors one at a time.

This article is about the defensive side. If you want the offensive side — how testers find broken object-level authorization and mass assignment flaws — that belongs to structured web application testing methodology. Here we are looking at the controls a gateway enforces before a request ever reaches your application code.

What an API Gateway Actually Is

A gateway sits in front of your APIs as a single entry point. Clients talk to the gateway; the gateway talks to your services. That indirection is the whole point. It gives you one place to authenticate, one place to log, one place to throttle, and one place to reject malformed input — instead of duplicating that logic across forty services written by twelve different teams.

Architecturally it is a specialized reverse proxy. The difference is that a reverse proxy mostly cares about routing and TLS termination, while a gateway understands the API contract: which methods exist, what parameters they take, who is allowed to call them and how often.

Authentication and Authorization

Gateways rarely store credentials themselves. They validate tokens issued elsewhere. In practice that means OAuth 2.0 access tokens or JSON Web Tokens, checked against the issuer's signing key on every request. The concepts behind that exchange are covered in federated authentication.

Two failure modes show up constantly on exams and in real incidents:

  • Accepting an unsigned or alg: none token. A JWT whose signature is never verified is just a claim the client made about itself.
  • Authenticating but not authorizing. The gateway confirms the token is valid and forwards the request without checking whether that user may touch that object. This is broken object-level authorization, and it is the most common serious API flaw in the wild.

API keys are still widespread for server-to-server traffic. Treat them as identifiers, not secrets — they end up in source control, mobile binaries and log files. Where keys are unavoidable, scope them narrowly and rotate them on a schedule.

Rate Limiting and Quotas

Rate limiting caps requests per unit of time; a quota caps them per billing period. They solve different problems. Rate limiting protects availability and blunts credential stuffing and enumeration. Quotas protect cost and enforce commercial tiers.

The useful distinction for the exam is what you key the limit on:

  • Per source IP — simple, but defeated by distributed traffic and unfair to users behind NAT.
  • Per API key or token — the usual choice, since it tracks the actual client.
  • Per endpoint — an expensive search endpoint deserves a tighter limit than a health check.

Return HTTP 429 with a Retry-After header rather than dropping traffic silently. Well-behaved clients back off; the ones that do not have told you something useful.

Schema Validation

This is the control teams most often skip, and the one that pays back fastest. The gateway holds the OpenAPI specification and rejects any request that does not match it: unknown fields, wrong types, oversized payloads, missing required parameters.

Positive validation — allowing only what the schema describes — is fundamentally stronger than the pattern matching a web application firewall performs. A WAF looks for attacks it recognizes. A schema validator rejects everything it does not recognize, which includes attacks nobody has named yet. Run both where you can; they fail in different directions.

Schema validation also caps payload size and nesting depth, which is what stops parser-level resource exhaustion, and rejecting unexpected object structures limits the blast radius of insecure deserialization.

Logging and Detection

Because everything passes through one point, the gateway is an excellent telemetry source. Ship its logs to your SIEM and watch for the patterns that matter: authorization failures clustered on one token, sequential object IDs being walked, a single client suddenly touching endpoints it has never used, and 4xx rates climbing on one route. Those signals are far more legible at the gateway than scattered across application logs.

Exam Focus

Expect scenario questions that hand you a symptom and ask for the control. Credential stuffing against a login endpoint points to rate limiting. A user retrieving another customer's record points to object-level authorization, not authentication. Oversized nested JSON crashing a parser points to schema validation and payload limits. Unexpected cost on a metered service points to quotas.

Know too that gateway controls are a shared responsibility in cloud deployments — the provider runs the gateway, you configure the policy. That boundary is worth reviewing alongside multi-cloud security before exam day.

The gateway does not make your application secure. It makes your application's mistakes survivable, and it gives you one place to fix them.

Comments