Requirements
- The target is verified. An API description is a list of things to
attack, so it is accepted only for an application you have proven is yours;
on an unverified target the request is refused with
dast_target_not_verified. - The document is OpenAPI 3 or Swagger 2, as JSON or YAML, at most 1 MB, with at least one path.
Store the document
On the target, choose Settings and, under API description, choose the document file, and save. With the API (the document travels as a string):has_openapi: true and the document’s size. The
document itself is not returned. Send an empty string to remove it.
Store it again whenever the API changes. TRUSTIVAN does not fetch the document
from a URL, so it does not follow your API as it evolves.
What the scan does with it
During an active scan, after the crawl, the engine reads the document and builds one request for each operation, filling parameters and request bodies from the document’sexample and default values and, where there are none,
from values generated to fit the schema. Those requests are then tested like
any other: every parameter is attacked.
- The server is your target. Whatever
serversthe document names, every request goes to the target’s origin. A document cannot send the scan anywhere else. - Authentication is the target’s authentication header. Security schemes declared in the document are not acted on.
- Every operation is called, including
DELETEand other operations that change or remove data. Use a staging environment. - If the document cannot be read, the scan still runs on what the crawl found and carries a warning saying so.
Getting useful coverage
The engine can only send what the document lets it build. Coverage is better when:- parameters and bodies have realistic
examplevalues (an identifier that exists, a date in the right format), because a request your API rejects as malformed never reaches the code you want tested; - path parameters have examples that point at real records;
- the document describes the API that is actually deployed at the target.
Read the result
Findings on API operations are ordinary dynamic findings. Their endpoint is the operation’s path with identifiers replaced by a placeholder (/orders/{id}), and their parameter is the one the attack was in.