Main models in API security

19 Aug 25
Protecting an API cannot rely solely on traditional perimeter security; rather, it requires a layered approach that operates directly on top of the HTTP/S protocol, encompassing the application logic it protects. In this article, we list the key API security models provided by our cybersecurity suite, Perimetrical.
It operates at the edge, acting as a high-performance reverse proxy to the API origin. The WAF is a fundamental part of Perimetrical‘s cybersecurity strategy. It integrates into the platform and, with the flexibility of the Varnish Configuration Language (VCL), inspects the payload of each request:
Client → CDN (Edge) → [WAF Inspection + VCL logic] → Caché or API Backend
This configuration centralizes security and traffic management, allowing complex policies to be applied before a request consumes backend resources.
We can even complement this with our mid-tier servers to funnel requests prior to reaching the backend or client origin.
Let’s first refresh the concepts of positive and negative security models.
The negative security model is the most common and is based on the principle of “blocking what I know is bad.” It’s easy to implement and maintain, as you only need to define rules for known attacks. It’s a reactive model, and its main weakness is that it can’t protect against unknown/new threats because it doesn’t have a signature for them.
The positive security model is exactly the opposite. It is based on the principle of “only allowing what I know is good.” It offers much stronger and more proactive protection because it only allows requests that respond to legitimate behavior. Here we are getting closer to the zero-trust objective, but its major disadvantage is how expensive and difficult it is to implement and maintain. A change in the API may require updating the rules so that it doesn’t block legitimate traffic.
The industry trend is toward hybrid security models that combine the best of both worlds and incorporate key aspects of each in response to today’s sophisticated attacks.
Integrated as part of the cybersecurity solution, the WAF provides the first line of defense based on a negative security model.
Using rule sets, such as the OWASP Core Rule Set (CRS), we inspect requests for known malicious patterns such as:
While essential protection, this model alone is insufficient, as it protects against known threats but not against zero-day attacks or abuse of business logic in requests made to our API.
Herein lies one of the greatest strategic advantages of this architecture. Modern APIs are defined by a contract, usually an OpenAPI (or Swagger) specification file. This file isn’t just documentation; it’s a machine-readable definition of each endpoint, the allowed HTTP methods (GET
, POST
, PUT
, DELETE
), the expected parameters, and their data types.
Using the flexibility of the VCL, it is possible to load this specification once analyzed and apply a positive security model:
/api/v1/internal/debug
) or uses a method that isn’t allowed for a valid endpoint (e.g., a DELETE
on /api/v1/users
when only GET
is allowed), the node network blocks it at the edge without needing to query the WAF or backend. This neutralizes exploration attempts and access to unexposed functionality.userId
and a string is returned instead, the request is invalid and rejected. This prevents a large category of injection attacks and backend processing errors.This “what’s not explicitly allowed is prohibited” approach dramatically reduces the attack surface, overcoming the limitations of a signature-only WAF, while also avoiding unnecessary analysis costs.
Not all API requests should reach the backend. Idempotent read operations (primarily GET
requests) are perfect candidates for caching.
POST
, PUT
, DELETE
) that are not cacheable. The result is a significant increase in overall system throughput./api/v1/products/123
when that product is updated) using cache tags or calls to our API, ensuring that stale data is not served.Modern DDoS attacks often aim not to saturate bandwidth (Layers 3 and 4), but rather to exhaust application resources (Layer 7) with seemingly legitimate but expensive-to-process requests. Perimetrical is exceptionally effective at mitigating these attacks.
Some of its main control points are:
User-Agent
, geolocation (GeoIP), TLS fingerprint, or behavior. This allows you to create dynamic access control lists (ACLs) to block malicious actors in real time.The combination of CDN, WAF, schema validation and anomaly management, combined with Layer 7 Anti-DDoS, creates a defense-in-depth architecture for API.
Perimetrical surpasses traditional security solutions by combining a negative model (WAF) with a positive model (schema validation), achieving robust and targeted protection. Additionally, its native high-performance caching and Layer 7 attack mitigation capabilities not only strengthen security but also dramatically optimize API performance, scalability, and resiliency.
Author: Óscar Dorrego
Psychologist by training, computer scientist by hobby, pre-sales by profession, new romantic at heart. He does so many things that he doesn’t even remember what he really does. More left hand than Nadal. Living between business and technology allows him to have half the joys and twice the worries, but it is impossible to make a dent in the spirit of our favorite snake charmer.