Repository navigation
Description
Found during dogfood triage on 2026-08-04. It produced two separate critical false positives from a single mis-tagged event.
What happens
_CREDENTIAL_PATTERNS in apps/orchestrator/agentmetry/core/audit/mitre.py:116 contains the bare string ".env", matched with p in text against the whole command. Any command whose text happens to contain those four characters is tagged T1552.001 Credentials In Files.
The event that triggered it was a Python heredoc rewriting import paths across source files. It contained:
from agentmetry.core.diagnostics.env_file import upsert_env_key
diagnostics.env_file contains .env. No credential was read.
$ echo ...diagnostics.env_file...
mitre -> T1552.001 Credentials In Files
traits -> []
Why it matters more than one bad tag
classify_command() returns zero traits for that command. The credential verdict comes only from the MITRE mapper, and the sequence rules trust it. So two classifiers disagree, the rules consume the weaker one, and one mis-tagged event became the credential-access half of two separate critical findings:
credential-exfil(credential access then network egress)dotfile-read-then-git-push(credential read then git push)
Both were dispositioned false_positive. The git push in the second one was real and correctly traited; only its partner was fiction.
Any commit message, doc edit, or source file mentioning .env does this. That is a common thing for a coding agent to touch, which makes this a recurring critical-severity false positive, and critical false positives are how a feed gets muted.
Suggested fix
Two parts, and the second is the more important one:
- Require a path-ish or read-ish context around
.envrather than a bare substring anywhere in the command. Reusemask_literals()so quoted example text does not count. - Decide which classifier is authoritative for credential access. Sequence rules keying off MITRE tags while
classify_command()says otherwise means the trait layer can be improved without the rules noticing. Acredential_accesstrait that both consume would make the disagreement impossible rather than merely unlikely.
Acceptance criteria
- A benchmark corpus case: a command mentioning
.envin an import path or commit message produces no detection. - The existing true positive (an actual
cat ~/.aws/credentials-style read) still fires. -
agentmetry benchmarkgreen, including zero false positives on the benign half.
Blocked until the dogfood gate closes. The detection sources are frozen for the current four-week run and landing this restarts the clock. Tracked so it is not lost, not to be merged yet.
Activity
fix(detection): close the evasions F1 found, and the split brain behi…
blitzcrieg1 commentedon Aug 5, 2026
Fixed in 74edf7e, along with the deeper problem this issue names.
The
.envsubstring..envnow needs to look like a path (~/.env,./.env,config/.env.local) or sit directly after something that reads a file. Anchoring it as a filename was not enough on its own:git commit -m "docs: explain .env handling"still matched, and a commit message is the single most likely place for a developer to type it.The split brain, which mattered more. Credential recognition existed twice, and the sequence rules read only the MITRE tag, so the mapper was the sole opinion that counted while being the one with less information and no corpus.
traits.pynow owns the patterns,mitre.pyimports them, and_is_credential_accessaccepts either signal.While closing it I also widened credential access to cover environment variables, which was the larger hole:
echo $AWS_SECRET_ACCESS_KEYwas generic Execution, socredential-exfilcould not fire on the way every container and CI runner holds secrets.Corpus grew 20 → 24. The new benign case pins the counterweight: a commit message naming
.env, an attack string echoed into docs, a fixture written to disk. Benchmark green, 17/17 detected, 0 false positives, 695 tests.docs(changelog): 0.4.0 describes what shipped, not what was written o…
feat(detection): secret-manager CLIs and single-quoted inline scripts
detection: measure against Atomic Red Team and close the shapes it found