Back to Blog Security

API Security in Enterprise Environments — OAuth2, Rate Limiting, WAF

Zespół ESKOM.AI 2026-05-07 Reading time: 7 min

Why Are APIs Particularly Vulnerable?

Application programming interfaces connect internal and external systems, handle sensitive data, and operate in an automated fashion — without human validation on every call. Traditional network perimeter defenses are insufficient when every authorized client can make thousands of requests per minute. The OWASP API Security Top 10 documents recurring vulnerability classes, many of which stem not from code bugs but from inadequate security design at the architectural level.

Authentication and Authorization — The Foundation

OAuth2 with Authorization Code flow and PKCE is the gold standard for APIs accessed through client applications. For server-to-server communication, the Client Credentials flow with short-lived access tokens is appropriate. Key mistakes to eliminate at the design stage include: storing tokens in localStorage instead of volatile memory, failing to validate permission scopes on every call, skipping audience field verification in JWT tokens, and using static API keys without a rotation mechanism.

  • Access tokens: maximum lifetime of 15-60 minutes
  • Refresh tokens: stored in secure, httpOnly cookies or secure server storage
  • API key rotation: mandatory, automated, with zero downtime
  • Inspection of every call for permission scope — not just at login

Rate Limiting as Protection Against Abuse

Throttling the number of calls per time unit protects APIs against several threat classes simultaneously: brute force attacks on credentials, data scraping, DDoS attacks targeting business logic, and accidental overload from buggy clients. Effective rate limiting implementation requires granularity — different limits for unauthenticated requests, different for authenticated users, different for high-trust partners. Limits should be applied at the IP address, user identifier, and API key levels combined.

It is worth paying attention to proper error coding — a 429 Too Many Requests code should include a Retry-After header, enabling correct client behavior and reducing retry attempts. Overly restrictive limits generate user frustration and complicate problem diagnostics.

WAF and API Traffic Inspection

Next-generation Web Application Firewalls understand API structure — they verify JSON correctness, detect injection attempts in field values, block known exploit patterns, and monitor anomalies in payload sizes and call frequency. WAF configuration for APIs requires a different approach than for traditional web applications — rules must account for each endpoint's specifics, acceptable data types and sizes, and expected usage patterns.

Monitoring and Anomaly Detection

Even the best-configured API requires continuous monitoring. Anomaly detection systems learn normal usage patterns — time of day, typical call sequences, IP address distribution — and alert on deviations. Particularly valuable is monitoring calls ending with 401 and 403 errors (unauthorized access attempts), unusual response sizes (potential data leaks), and sequences suggesting resource enumeration.

ESKOM.AI designs API security as a built-in architectural element, not a layer added after the fact. Every API explored by an automation system undergoes a vulnerability assessment compliant with the OWASP API Top 10 before entering production.

#API security #OAuth2 #WAF #rate limiting #OWASP API Top 10