Agent Security Harness

Even if an agent is properly authenticated and authorized, can it still be manipulated into unsafe or policy-violating behavior?
A test that did not reach the target is not a passing security test.
This harness sends adversarial traffic at a live endpoint, records what the target actually
serviced, and reports PASS, FAIL or INCONCLUSIVE. It will not convert a request the target
never answered — or a capability the target never exposed, or an answer that establishes
nothing either way — into evidence that a control held.
That distinction is enforced by testing/test_serviced_guard.py and
testing/test_x402_capability_controls.py rather than asserted here, and the repairs that put
it there are in CHANGELOG.md.
How that is checked: five target shapes
A verdict is only worth what it does when the target changes. Four scripts point every
suite at a sentinel that differs only in how it answers, and four state files under
testing/ pin what each one claims:
python3 scripts/dead_host_sweep.py # a closed port: nothing answers
python3 scripts/permissive_host_sweep.py # HTTP 200, grants everything
python3 scripts/refusing_host_sweep.py # HTTP 403, refuses everything
python3 scripts/empty_answer_sweep.py # HTTP 200 `{}`: answers, does nothing
The fourth transport shape is the one the other three cannot see. A target answering 200
with an empty body satisfies every serviced-request guard -- the answer is real -- while
supplying no refusal, no decision, no inventory and no prose. The fourth external review
found 47 rows passing against it, including two AIUC-1 controls; the remainder and the
reading of each row is in testing/test_empty_answer_is_not_a_control.py.
The fifth shape is a live agent rather than a transport, and it is asserted in
testing/test_refusal_establishes_a_pass.py rather than run as a script: one agent that
complies with every request without using an indicator word, and one that declines in plain
prose. A prose-graded module must pass nothing against the first and something against
the second. Those two assertions are what v4.17.0 repaired eight modules against.
The first two ask whether a verdict can be wrong: a PASS against either is a control
reported as holding when it was never exercised. The third asks whether a verdict can be
right, which the other two cannot see — a suite that cannot pass a target which refuses
every attack scores zero against all three, and that is what a healthy module looks like from
the first two poles. The fourth asks whether a verdict needs the target to have done
anything at all.
These are diagnostic sentinels, not conformant implementations. A non-zero row is a reading
list rather than a defect count: it may be correct by construction (over_refusal_harness
asks whether legitimate requests are wrongly blocked, so it should pass a target that blocks
nothing), it may need a marker the generic sentinel does not emit, or it may be a real
inversion. Only reading the test separates them.
Sentinels are the floor. The first run against a real MCP implementation found two defect
classes all three had structurally missed, because every sentinel spoke the response idiom the
harness already expected.
$ agent-security test mcp --url http://localhost:8080/mcp
Running MCP Protocol Security Tests...
MCP-001: Tool List Integrity Check [PASS] (0.234s)
MCP-002: Tool Registration via Call Injection [PASS] (0.412s)
MCP-003: Capability Escalation via Initialize [FAIL] (0.156s)
...
Results: 8/10 passed (80% pass rate) - see report.json
Illustrative output. A target the harness cannot reach, or that answers without
servicing the request, reports INCONCLUSIVE — never PASS. See
v4.13.1 for why that distinction is enforced rather than assumed.
662 executable security tests across 50 test-bearing modules on main (verified 2026-11-24 via scripts/count_tests.py; the v4.32.0 release carries 662, the same as main). MCP + A2A + L402 + x402 wire-protocol testing, plus UCP/ACP merchant-journey, AP2 mandate-chain, Fireblocks x402 hardening, Visa TAP / Mastercard Agentic Token funding-instrument, and denial-of-settlement finality conformance across the full agentic-payments stack. Decision-layer attack scenarios. One pip install away.
If this evidence discipline is useful in your agent-security work, star this
repository to follow releases.
Evidence before coverage
Every claim in this project is bounded by the
E1-E5 Evidence Class Taxonomy: observation,
runtime characterization, enforcement, persistence/replay resistance, and
isolation. A second axis, I0-I2, states who produced the oracle:
self-authored, independently reimplemented, or an independent sensor the target
does not control. Strength and independence are different properties, so both
are cited. A result is not promoted beyond what its retained artifact and
execution record demonstrate. Author-performed mappings and test runs are not
independent certification.
The AIUC-1 Evidence Field Guide is a
plain-language companion that applies this same taxonomy. It adds one distinction
the ladder above does not encode: whether evidence is mapped (a documented
requirement relationship), executed (a recorded run against a stated target and
pinned revision), or independently reviewed (assessed by a qualified outside
party). Those describe the status of evidence and are orthogonal to E1-E5, which
describes its strength. A mapping alone is E1-level material regardless of how many
requirements it covers. The taxonomy in this repository is canonical; the field
guide is hosted outside it and is not version-pinned.
OWASP Agentic AI v1.1 Threat Coverage Report — commit-pinned mapping from the full T1–T17 taxonomy to executable tests: 13 direct, 4 partial, 0 not evidenced, across 96 mapped tests and 66 named OWASP scenarios. Mitigation-control validation is tracked separately from threat coverage (11 validated, 10 partial, 1 guidance-only), and every gap, evidence class and reproduction command is in the report. (T1–T15 submission view · canonical mapping)
Adapted from OWASP Agentic AI — Threats and Mitigations v1.1 under CC BY-SA 4.0. A test-capability report — not a certification, conformance claim, or OWASP endorsement. The adjudication is author-performed and is not independent review.
Quick Start
pipx install agent-security-harness
pipx is the recommended install because this is a command-line tool. It builds
an isolated environment and puts agent-security on your PATH, with no sudo
and no PATH edits. Get it with brew install pipx, apt install pipx, or
python3 -m pip install --user pipx.
Use a virtual environment:
python3 -m venv .venv && source .venv/bin/activate
pip install agent-security-harness
pip install agent-security-harness outside a virtual environment fails on
most current systems, including Homebrew Python on macOS and Linux, Debian,
Ubuntu, and Fedora:
error: externally-managed-environment
Those interpreters ship a PEP 668 marker
that blocks installs into the system environment. --user does not bypass it.
--break-system-packages does, and is a bad idea on a Homebrew Python. Use
pipx or a venv.
pipx upgrade agent-security-harness
topgrade picks this up automatically
through its pipx step, or its pip3 step for a --user install. No
configuration needed.
There is no Homebrew formula for this package.
# Confirm which build you're on:
agent-security --version
# See it work immediately — no server needed:
agent-security test mcp --simulate
# Watch a verdict move: both bundled mocks ship in the package (MCP on 8402, A2A on 8404)
agent-security-mock-a2a --vulnerable & # or without --vulnerable: the hardened target
agent-security test a2a --url http://localhost:8404
# Then test your real MCP server (2024-11-05 through 2026-07-28; the negotiated version is used):
agent-security test mcp --url http://localhost:8080/mcp
# A2A: 0.3 or 1.0, chosen from the Agent Card (--a2a-version 0.3|1.0 to force one)
agent-security test a2a --url https://agent.example.com
# x402: X4-058..X4-069 send signed spec payments and need a testnet payer key; without one
# they report INCONCLUSIVE. The older pre-spec probes grade only 5 tests against a spec v1/v2
# server and say why for the rest (see CHANGELOG).
agent-security test x402 --url https://your-x402-endpoint.com
# Human-oversight surface: reviewer exposure (T10) and agent-to-human
# manipulation (T15). An unreachable target reports INCONCLUSIVE, never PASS.
agent-security test hitl --url http://localhost:8080
# Which tests back a given OWASP threat, scenario or mitigation control
python scripts/owasp_agentic_select.py --threat T16
python scripts/owasp_agentic_select.py --control P5-REA-001
Exit status. Every agent-security test <harness> run, and every harness run directly
with python -m protocol_tests.<module>, exits with the same three codes:
| Code |
Meaning |
0 |
every result PASSED |
1 |
at least one genuine FAIL (whatever else the run contains) |
2 |
no FAIL, but at least one result is INCONCLUSIVE or not executed, or no result was produced (this includes --simulate) |
Nonzero always means "not clean", so a pipeline that only checks for nonzero behaves as
before, except for receipt-claim, cloud-agents, autogen, crewai-cve,
mcp-tool-poisoning and capability-residue, which exited 0 whatever their results said
until 2026-09-24 and now follow this table (see CHANGELOG). Before 2026-09-24 most harnesses
exited 1 for an INCONCLUSIVE row as well as for a FAIL; branch on 1 specifically if you want to gate on a failed control. argparse also exits
2 on a usage error, and that run writes no report. Exception: the --trials N statistical
paths of l402 and x402 still exit 0/1 (they do not track INCONCLUSIVE per trial).
Modules run directly with their own --simulate (cloud-agents,
crewai-cve, mcp-tool-poisoning) exit with what their reference rows say; through
agent-security test ... --simulate every row is INCONCLUSIVE and the run exits 2.
See docs/QUICKSTART.md for mock server setup, rate limiting, MCP server mode, and CI/CD integration.
Three Layers of Agent Decision Security
| Layer |
What it covers |
Example focus |
| Protocol Integrity |
Prevent spoofing, replay, downgrade, diversion, and malformed protocol behavior |
MCP, A2A, L402, x402 wire-level tests |
| Operational Governance |
Validate session state, capability boundaries, platform actions, trust chains, and execution context |
capability escalation, facilitator trust, provenance, session security |
| Decision Governance |
Test whether an agent should act at all under its authority, confidence, scope, and policy constraints |
autonomy scoring, scope creep, return-channel poisoning, normalization-of-deviance |
| Human Oversight |
Test whether the human review layer can be saturated, starved, blinded, or turned against its own principal |
approval flooding, risk starvation, stripped decision context, agent→human manipulation (OWASP T10/T15) |
How This Differs From Other Projects