Security tests
PreviewAI agents

Whatever your API allows, an agent will eventually do

AI agents call your API with real credentials, chain tools nobody designed together and retry until something works. Prompt injection can turn a trusted agent against the data it can reach. Portman tests what your API allows, on every build, so an agent finds no gap you didn’t intend.

  • 49.8%

    of organizations confirmed or suspected an AI agent took an action nobody intended, expected or authorized in the past year.

    Salt Security, Oct 2026
  • 17.5%

    can automatically stop an agent that starts behaving unexpectedly in production. The rest intervene by hand or take the app offline.

    Salt Security, Oct 2026
  • 12.5×

    growth in AI-driven bot activity in 2025. 27% of bot attacks target APIs, often with valid, well-formed requests at scale.

    Thales Bad Bot Report 2026
  • 48%

    of AI agents in production run without security or monitoring. Agent fleets doubled in four months.

    Gravitee, Apr 2026

Vendor surveys, linked to the source.

How agents find the gaps

Agents don’t need an exploit. They use your API the way it actually behaves, which isn’t always the way you meant it to.

  • Uses whatever credentials it holds, for everythingA read-only integration token that can also write, delete or cancel.Run the token you give your agent against every write operation and expect 401 or 403.
  • Calls endpoints no UI ever links toAn endpoint that forgot its auth middleware, because the frontend never called it.Every operation in the spec is called without credentials and with forged ones, on every build.
  • Retries with different inputs until something worksOut-of-range values that crash the API or get accepted, so a path opens by trial and error.Fuzzed requests (missing fields, values past minimum, maximum and maxLength) must get a 4xx.
  • Reads the whole response, and repeats itA field the spec never declared, such as a reset token or an internal note, sent to every caller.Strict schema validation fails on any response field the spec does not declare.
  • Follows instructions hidden in data and tool descriptionsPrompt injection turns a trusted agent against the data its token can reach.You can’t test the agent’s judgement, but you can test the blast radius: what its token is allowed to do.
  • Learns your API from the OpenAPI specAgents and MCP tools trust the spec literally. When the API drifts, the agent does something other than intended.Contract tests keep the API and the spec in agreement.

Test the token you give your agent

Least privilege only works if the API enforces it. Issue the agent its own token, put it in a Postman variable and let Portman call every write operation with it. One variation per method covers every POST, PATCH and DELETE in the spec, including the ones added next sprint.

Add PATCH::* and DELETE::* the same way. If the agent’s token can write anywhere, the build fails.

portman-config.agent-token.json
{  "tests": {    "variationTests": [      {        "openApiOperation": "POST::*",        "variations": [{          "name": "Agent token cannot write",          "overwrites": [{            "overwriteRequestSecurity": {              "bearer": { "token": "{{agentReadOnlyToken}}" }            }          }],          "tests": { "extendTests": [{ "tests": [            "pm.test('Agent token is refused', () => pm.expect(pm.response.code).to.be.oneOf([401, 403]))"          ] }] }        }]      }    ]  }}

Two layers, two jobs

Runtime controls decide who gets in. Portman makes sure the API itself only allows what it should, for anyone who does.

Build time
Portman
  • What the API allows: auth on every operation, token scopes, response fields, input validation
  • Fails the pull request before it ships
Runtime
Gateways, agent identity, bot management
  • Who is calling and how often: rate limits, agent verification, anomaly detection
  • Stops misbehaving traffic in production

What it doesn’t do

Watching agents at runtime
Portman runs in CI. Detecting a misbehaving agent in production is the job of your gateway and monitoring.
Prompt injection itself
It tests what a hijacked agent could do with its token, not whether the agent can be hijacked.
SQL injection, SSRF, XSS
No attack payloads. Pair it with a DAST tool such as ZAP, Burp or StackHawk.
Shadow endpoints
It only tests what's in the spec. Endpoints the spec doesn't list stay invisible to it.
Proof of security
It never proves something is secure, only that the API matches the spec.
Portman Cloud · exploring, not a product yet

Know what every agent token can do

Testing one agent token in CI is a config file. We’re exploring a hosted service that keeps track of every token you give to agents, across all your APIs.

  • An inventory of the tokens you hand to agents, and what each one can reach
  • Scheduled checks that every token stays inside its scope
  • Alerts when a new endpoint is reachable without credentials
  • A report you can show your security team

The Portman CLI stays free and Apache 2.0. Nothing it does today moves behind a paywall.

Try it

Start from the security preset, add your agent’s token as agentReadOnlyToken and run it in CI.

Sources