19 Aug 2025 5 min read

Main API Security Models

Main API Security Models

APIs are the lifeblood of modern applications. They're also the most targeted attack surface. SQL injection, XXE, broken authentication, lateral movement — all enter through APIs.

At Perimetrical, we believe API security requires a layered approach. Not just blocking what's bad (negative security), but also allowing only what's good (positive security). Let's explore both models and how they work together.

The Architecture: Reverse Proxy with Edge Protection

Our model places a CDN-based reverse proxy between clients and your backend API:

Client → CDN (Edge) → [WAF Inspection + VCL Logic] → Cache or Backend API

This simple architecture unlocks tremendous power:

Model 1: Negative Security Model (Deny the Bad)

The traditional security model: assume everything is legitimate unless proven otherwise. Block known attack patterns.

WAF: Core of Negative Security

A Web Application Firewall (WAF) inspects incoming traffic and blocks requests matching known malicious patterns:

The WAF operates with signature-based and behavioral detection. It's effective against known attacks but can generate false positives and requires continuous rule updates.

Limitations of Negative Security Alone

Model 2: Positive Security Model (Allow the Good)

A more modern approach: instead of blocking what's bad, only allow what you've explicitly defined as good. This requires API schema definition.

OpenAPI Schema Validation

OpenAPI (formerly Swagger) allows you to define your API contract: endpoints, methods, parameters, data types, and constraints.

Using this schema, Perimetrical enforces:

Example: A `/api/users/{id}` endpoint defined as GET-only with `id` as a positive integer will:

Advantages of Positive Security

Limitations of Positive Security Alone

CDN Caching Advantages for Cacheable Requests

Not every API request is dynamic. Read-heavy APIs for configuration, catalogs, or reference data are excellent caching candidates.

Layer 7 Application DDoS Protection

Beyond WAF and schema validation, Perimetrical adds behavioral DDoS protection at the application layer:

The Hybrid Approach: Combining Both Models

The best API security combines negative and positive security:

  1. Layer 1 (Edge): WAF blocks obvious attacks (known SQLi, XSS, etc.) — fast, signature-based, catches the 90% of automated attacks
  2. Layer 2 (Edge): OpenAPI schema validation enforces your API contract — no false positives, zero-day resistant
  3. Layer 3 (Edge): DDoS & behavioral protection blocks abnormal traffic patterns
  4. Layer 4 (Edge): Caching serves legitimate requests from edge; origin only handles cache misses
  5. Layer 5 (Origin): Application-level validation as a final defense — validates business logic constraints

This layering ensures:

Implementation at Perimetrical

Our platform makes this simple:

Conclusion

API security in 2025 demands more than signature-based WAF rules. Modern APIs need a hybrid approach: negative security to catch known attacks, positive security to enforce your API contract, and behavioral protections to mitigate DDoS. Combined with edge caching and CDN intelligence, this creates an impenetrable shield around your API infrastructure.

The result is faster APIs, fewer security incidents, and lower origin load — all without sacrificing the user experience.

Need to strengthen your web security? Our technical team can help you design the perfect protection strategy for your use case.

Get started