Skip to content

chore(claude): tune permissions for safer low-friction defaults#7263

Open
jstirnaman wants to merge 5 commits into
masterfrom
claude/search-skills-instructions-Y8BUd
Open

chore(claude): tune permissions for safer low-friction defaults#7263
jstirnaman wants to merge 5 commits into
masterfrom
claude/search-skills-instructions-Y8BUd

Conversation

@jstirnaman
Copy link
Copy Markdown
Contributor

Summary

Tunes .claude/settings.json permissions to reduce prompts for safe, read-only commands while keeping guardrails on destructive actions and sensitive files. Follow-up to #7261 (worktree hooks + lint toolchain).

  • allow — add read-only entries observed in recent sessions: Bash(shellcheck:*), Bash(.ci/shellcheck/shellcheck.sh:*) (static analysis, no mutation), and mcp__github__pull_request_read.
  • ask — add high-impact destructive ops so they prompt even under permissive/Auto modes: git reset --hard, git clean, git rebase, sudo, dd, shred, mkfs. ask takes precedence over the broad allow wildcards, so these still prompt.
  • deny — broaden sensitive-file protection beyond root .env to nested env files, private keys (*.pem/*.key/id_*), credential stores (.netrc/.npmrc/.git-credentials/**/credentials*), and home-dir secrets (~/.ssh, ~/.aws, ~/.gnupg, gh/hosts.yml).

Caveats (documented, not bugs)

  • Read() deny rules govern the Read/Edit/Write tools — they do not stop auto-allowed Bash (cat, head, grep) from reading those paths. The deny list is defense-in-depth; removing secrets from files entirely is the real fix.
  • The broad interpreter wildcards (bash, python, node, npx, make, curl, docker, …) were intentionally left in allow to keep friction low. They remain the widest opening under Auto mode.

Test plan

  • jq empty .claude/settings.json — valid JSON
  • Confirmed new entries present in allow/ask/deny
  • Branch rebased onto current master; PR diff is limited to .claude/settings.json

https://claude.ai/code/session_01Wo4ETjsNM4ggHqFSqRTyPN


Generated by Claude Code

claude added 4 commits May 22, 2026 22:44
- check-bash-worktree.sh: PreToolUse Bash matcher that blocks commands
  referencing the main clone instead of the active worktree (parses
  absolute paths from tool_input.command).
- worktree-context.sh: UserPromptSubmit hook that injects a one-line
  reminder of the active worktree on every user prompt, so the rule
  survives compaction and attention decay.
- settings.json: register both hooks. Reminder + deterministic block
  give belt-and-suspenders coverage — the reminder shapes behavior,
  the block catches lapses.

https://claude.ai/code/session_01Wo4ETjsNM4ggHqFSqRTyPN
Move the inline yarn-install SessionStart command into a dedicated
.claude/hooks/session-start.sh and add ShellCheck installation.

The pre-commit `shellcheck` Lefthook step requires shellcheck >= 0.10.0
and otherwise falls back to Docker. The Claude Code on the web container
ships neither, so shell-script commits previously failed until shellcheck
was installed by hand. The hook now installs the pinned binary (matching
.ci/shellcheck/shellcheck.sh) so linting works on a cold start.

Remote-only (CLAUDE_CODE_REMOTE), idempotent, and synchronous so deps are
guaranteed ready before the session begins.

https://claude.ai/code/session_01Wo4ETjsNM4ggHqFSqRTyPN
- allow: add read-only shellcheck linter, its repo wrapper, and the
  github pull_request_read MCP tool (observed in recent sessions).
- ask: add high-impact destructive ops so they prompt even under
  permissive modes — git reset --hard, git clean, git rebase, sudo,
  dd, shred, mkfs. ask takes precedence over the broad allow wildcards.
- deny: broaden sensitive-file protection beyond root .env to nested
  env files, private keys, credential stores, and ~/.ssh|.aws|.gnupg.

https://claude.ai/code/session_01Wo4ETjsNM4ggHqFSqRTyPN
@jstirnaman jstirnaman requested a review from a team as a code owner May 26, 2026 21:06
@jstirnaman jstirnaman requested review from sanderson and removed request for a team May 26, 2026 21:06
@jstirnaman jstirnaman added the hold off Should not be merged or address yet label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold off Should not be merged or address yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants