Skip to content

chore(settings): broaden permission patterns + add credential audit script#103

Open
aaronsb wants to merge 1 commit into
mainfrom
chore/settings-broaden-patterns
Open

chore(settings): broaden permission patterns + add credential audit script#103
aaronsb wants to merge 1 commit into
mainfrom
chore/settings-broaden-patterns

Conversation

@aaronsb
Copy link
Copy Markdown
Owner

@aaronsb aaronsb commented May 24, 2026

Summary

Two changes, motivated by the realization that the previous "roll up accumulated grants" PR (#101, closed) would have undone main's curated 59-entry pattern list with 842 hyper-specific entries — and that the same per-command auto-capture was the vector for two real Atlassian API tokens ending up in working-tree settings.json.

Broader permission patterns

  • Adds ~25 Bash(cmd:*) patterns: curl, sudo, tar, printf, pip/pip3, npm/npx/node, jq, adr, adr-tool, dotfiles, mmaid, kg, way-embed, way-match, attend-chat, gpg, gpgconf, base64, .claude/**.
  • Adds 7 mcp__server__* wildcards: knowledge-graph, jira-cloud, chrome-devtools, claude-in-chrome, google-workspace, slack-mcp, thinking-strategies.
  • Keeps the existing 59-entry curation as the base.
  • Net allow-list size: 59 → 88 (vs. 842 in the closed PR).

Credential audit script (scripts/audit-permissions.sh)

Greps settings files for credential-shaped permission entries: basic-auth user:token, Bearer …, and explicit prefixes for GitHub PATs, Anthropic/OpenAI keys, Slack tokens, AWS access keys, Atlassian API tokens, and AUTH=user:secret env-var captures.

Exits non-zero on findings — safe to wire into a pre-commit hook later if you want enforcement.

Test plan

  • python3 -m json.tool settings.json validates.
  • scripts/audit-permissions.sh exits 0 on this branch.
  • scripts/audit-permissions.sh exits 1 when fed a JSON file containing a synthetic curl -u user@host:ATATT3xFf... permission.
  • After merge, sessions that previously prompted for curl …, sudo …, mcp__jira-cloud__*, etc. proceed without prompts.

Notes

  • Doesn't address the capture failure mode (Claude Code recording the full curl -u user:token verbatim when you accept "Always allow"). The audit script is reactive; preventing the capture requires either upstream redaction in Claude Code or behavioral hygiene (use ~/.netrc / env vars instead of -u args).

Settings:
- Adds ~25 broad `Bash(cmd:*)` patterns and 7 `mcp__server__*` wildcards
  covering the command families sessions kept re-prompting on
  (curl, sudo, adr, kg, mmaid, way-embed, jira-cloud MCP, etc.).
- Keeps main's hand-curated 59-entry list as the base — does not
  replace it with raw session accumulation.

Audit script (scripts/audit-permissions.sh):
- Greps settings files for credential-shaped permission entries
  (basic-auth user:token, Bearer tokens, GitHub/Anthropic/OpenAI/
  Slack/AWS/Atlassian key prefixes, AUTH=... env captures).
- Catches the failure mode where `Always allow` on a `curl -u` pins
  the secret into the permission string verbatim.
- Exits non-zero on findings; safe to wire into a hook later.

.gitignore: allowlist the new script (the file uses deny-by-default).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant