diff options
| author | Mohamed Hegazy <mhegazy@anthropic.com> | 2026-10-16 16:36:35 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-10-16 16:36:35 +0000 |
| commit | c7608894ec1ec29ae176b0ca60ef239e57f6e776 (patch) | |
| tree | 2b26cd4c26a40ca181c9070831a45c4e531b4946 /plugins/security-guidance/hooks/gitutil.py | |
| parent | ea10b213686c90bb1984b2016937310e05336cf3 (diff) | |
security-guidance: keep Claude Code's own credential files out of reviewsmhegazy/sg-claude-code-credential-files
When the Claude Code config directory is a git repo, .credentials.json and .claude.json show up as changed files each time Claude Code rewrites them, and their contents (sign-in tokens, a saved API key, MCP server secrets) were sent to the Stop review. Treat both names as secret-shaped, like .netrc and .npmrc.
Refs anthropics/claude-code#90010
Diffstat (limited to 'plugins/security-guidance/hooks/gitutil.py')
| -rw-r--r-- | plugins/security-guidance/hooks/gitutil.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/security-guidance/hooks/gitutil.py b/plugins/security-guidance/hooks/gitutil.py index bc4d753b..de9642fb 100644 --- a/plugins/security-guidance/hooks/gitutil.py +++ b/plugins/security-guidance/hooks/gitutil.py @@ -874,9 +874,12 @@ _SSH_PRIVATE_KEY_BASENAMES = frozenset(( 'id_ed25519_sk', 'id_xmss', )) _PRIVATE_KEY_NAME_SUFFIXES = ('_rsa', '_dsa', '_ecdsa', '_ed25519') +# `.credentials.json` and `.claude.json` are Claude Code's own files: sign-in +# tokens, a saved API key, MCP server secrets. Claude Code rewrites them as it +# runs, so they show up as changed when its config directory is a git repo. _CREDENTIAL_BASENAMES = frozenset(( 'credentials', '.netrc', '.pgpass', '.npmrc', '.pypirc', - '.git-credentials', '.dockercfg', + '.git-credentials', '.dockercfg', '.credentials.json', '.claude.json', )) # chezmoi encodes a target file's attributes as stacked name prefixes # (`private_dot_netrc`, `encrypted_private_token`); `dot_` stands for a |
