Skip to content

AAK-POLICY-OPTIONAL-TRUST-001: A trust check reads a missing answer as a passing one

Severity
MEDIUM
Category
Trust Boundaries (trust-boundary)
Scanner
agent_audit_kit/scanners/agent_gates.py
Auto-fixable
No.
SARIF name
PolicyOptionalTrust

What it detects

A function takes a trust input as a parameter and refuses only on the explicit failure: if key_matches_pin is False: on a parameter that may be None, so None passes, or a parameter such as verified: bool = True or revoked: bool = False whose default is the passing value. A caller that never ran the check then reads the same as one that ran it and passed. Compare None as unknown, not clean: a function that also tests the value against None or True, reads it as a truth value, or hands it to a helper does not fire, and neither does a directive such as require_verified=True, where the default asks for the check.

How to fix

Make a missing answer refuse. Require the input with no default, or treat None as not checked and return the same refusal a failed check gets, and add a test that leaves each input out. Do this before the first test of the explicit failure, so every path sees it.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-POLICY-OPTIONAL-TRUST-001

Limitations

The shape comes from the reference implementation of the tool outcome attestation proposal (github.com/Carmel-Labs-Inc/toa, classify_absence): commit 8327499 fires twice, and its fix at f849f0a, where a helper refuses every input left unknown, does not fire. Reads Python function parameters, one function at a time, by name, word by word of a snake_case name: verified, trusted, authenticated, authorized, attested, revoked, tampered, compromised, forged, untrusted and unverified alone, and valid, matches, matched, signed, approved, permitted, allowed, available, expired, denied and blocked only beside what was checked (key, pin, signature, cert, token, hash, digest, credential, issuer, audience, nonce, caller, client, session, origin). So another word (ok, passed), a camelCase name, a trust input that is no boolean (verify_reason: str | None = None) and a field on an object (ctx.key_matches_pin is False) are not read. The refusal must be an if whose branch raises, returns or exits. A parameter handed to any call counts as answered and the call is not read, so a helper that ignores it stays silent. Callers are not read, so a default that every caller overrides still fires. Paths with a tests, fixtures, examples, samples or demos directory, and test_*.py and conftest.py, are skipped. Other languages are not read. A source file over 512 KB is not read.

References

  • OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation)
  • Adversa AI MCP Top 25 (AAK-defined ids): ADV-AUTH-01 (Missing Authentication)

All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-POLICY-OPTIONAL-TRUST-001.md: the page then shows that text, with the registry reference appended under it.