Skip to content

AAK-SECRET-005: Private key file present

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

What it detects

A private key file (*.pem, *.key, id_rsa, etc.) or PEM content was found in the project.

How to fix

Remove private keys from repository, add to .gitignore.

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

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

Limitations

Reports a keystore (.p12, .pfx, .jks, .keystore, .jceks or .ppk) or an ssh-keygen default name (id_rsa, id_ed25519 and the like) by its name, a private-key header in a .pem, .key, .p8, .crt or .cer file, and, in any other file under 1 MB, Markdown included, a PEM private key written out whole: its header, its base64 lines and its END marker. There a block whose body is a documentation stand-in is skipped: a line that is not standard base64 (..., <paste your key here>, PRIVATE_KEY_CONTENT_GOES_HERE), fewer than 16 base64 characters, one repeated character, or, in a body shorter than 64 characters (the shortest real key), a run of x or REPLACE, YOUR, EXAMPLE, PLACEHOLDER or CHANGEME in it. A key assembled from several quoted strings in code is not reported: a Python module that writes the header, each base64 line and the END marker as separate string literals is missed, although the same key in one triple-quoted string is found.

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