Skip to content

AAK-SECRET-004: Generic high-entropy secret

Severity
HIGH
Category
Secret Exposure (secret-exposure)
Scanner
agent_audit_kit/scanners/secret_exposure.py
Auto-fixable
No.
SARIF name
GenericHighEntropySecret

What it detects

A value assigned to a secret-like key has high Shannon entropy, indicating a likely credential or API key.

How to fix

Move to environment variables or secrets manager.

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

agent-audit-kit scan . --rules AAK-SECRET-004

Limitations

Reads NAME=value pairs and quoted values ("NAME": "value") whose name contains SECRET, PASSWORD, TOKEN, KEY or CREDENTIAL, and reports a value of 16 or more characters whose Shannon entropy exceeds 4.5 bits per character. A secret drawn from a small alphabet cannot reach that: a 64-digit hexadecimal secret, such as the output of openssl rand -hex 32, tops out at 4 bits per character and is never reported. An unquoted YAML value (SECRET_KEY: value in a compose file) is not read, and neither is Markdown: read, they gave 23% and at most 56% precision on 1,527 YAML and 1,909 Markdown files from public MCP repositories. A file over 1,000,000 bytes is not read.

References


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-SECRET-004.md: the page then shows that text, with the registry reference appended under it.