Skip to content

fix(#1287): skills stop pre-approving broad shell access in allowed-tools - #1291

Merged
admarble merged 5 commits into
mainfrom
feature/1287-fix-skills-narrow-broad-allowed-tools-grants-bare-
Oct 4, 2026
Merged

admarble merged 5 commits into
mainfrom
feature/1287-fix-skills-narrow-broad-allowed-tools-grants-bare-

Conversation

@admarble

@admarble admarble commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Skills no longer pre-approve broad shell access in allowed-tools. These entries are gone or narrowed in every skill:

  • bare Bash
  • Bash(*)
  • tool wildcards (Bash(git *), Bash(gh *), Bash(git:*), Bash(npm run *), Bash(npx *))
  • runner wildcards (npx …:*, npm install:*, node -e:*)
  • global-option wildcards (git -C:*)
  • relative-path script wildcards (./scripts/new-feature.sh:*) and package-manager flag wildcards (npm --version:*, which the portal reads as any npm command)
  • curl:*
  • the unrendered {{PM_RUN}} entry

Each list now names the subcommands its skill's body and references/ run. Edits were made in .claude/skills (canonical) and synced to templates/, skills/ and plugin/. A new gate, src/lib/__tests__/skill-allowed-tools-gate.test.ts, checks the frontmatter of every skill in all four roots.

Phases started by sequant run use bypassPermissions, so they are unaffected. Only interactive use changes: see New prompts below.

Fixes #1287

AC

  • AC-1: no bare Bash, Bash(*), or Bash(<gh|git|npm|npm run|npx|…> *) / :* entry in any root. The gate normalizes X:* to X * and also rejects git -C/-c and gh -R/--repo wildcards, where the subcommand falls inside the wildcard.
  • AC-2: runner wildcards are narrowed or removed. The gate rejects any npx/node/tsx/npm install|ci|exec/bash/python/uv run entry ending in *, except the two RUNNER_ALLOWLIST entries (npx sequant worktree resolve * / verify *; the wildcard is an issue number or path). Removed because no body or reference runs them:
    • exec: npx tsc:*, npm install:*
    • upstream: npx tsx *
    • test: npx tsx:*, a per-feature seed path
    • setup: node -e:*
  • AC-3: test's Bash({{PM_RUN}} dev:*) is replaced by literal npm run dev:*, pnpm dev:*, pnpm run dev:*, yarn dev:* and bun run dev:*. The gate rejects {{ anywhere in an allowed-tools block. It is scoped to the frontmatter, because the body's {{DEV_URL}}/{{PM_RUN}} still render for consumers via init.ts.
  • AC-4: bare Write/Edit/Skill are kept, each with a reason. See the table.
  • AC-5: accepted by owner decision (2026-10-04). The owner accepted the New prompts list below as AC-5's evidence, in place of an interactive /verify + /fullsolve run on a scratch issue. Phase agents run under bypassPermissions and can't observe prompts. No interactive run was performed.
  • AC-6: portal Validate on this branch, path plugin, at fda34ab: the "Pre-approves broad shell access in allowed-tools" hold is gone (11 → 8 policy holds). See Portal result below.

Mutation-verified: AC-1 — re-added bare Bash to .claude/skills/verify/SKILL.md and synced; src/lib/tests/skill-allowed-tools-gate.test.ts > skill allowed-tools grant no broad shell access (#1287) > .claude/skills — no bare Bash, Bash(*), tool or runner wildcard, or placeholder failed (reported "verify/SKILL.md: Bash — bare Bash (AC-1)", same case in all 4 roots); restored.

Mutation-verified: AC-2 — re-added Bash(npx tsc:*) to .claude/skills/exec/SKILL.md and synced; src/lib/tests/skill-allowed-tools-gate.test.ts > skill allowed-tools grant no broad shell access (#1287) > .claude/skills — no bare Bash, Bash(*), tool or runner wildcard, or placeholder failed ("runner wildcard not in RUNNER_ALLOWLIST (AC-2)"); restored.

Mutation-verified: AC-3 — re-added Bash({{PM_RUN}} dev:*) to .claude/skills/test/SKILL.md and synced; src/lib/tests/skill-allowed-tools-gate.test.ts > skill allowed-tools grant no broad shell access (#1287) > .claude/skills — no bare Bash, Bash(*), tool or runner wildcard, or placeholder failed ("unrendered placeholder (AC-3)"); restored.

The same case also fails, each with its own reason, when any of these is re-added:

  • Bash(git -C:*) to spec
  • Bash(curl:*) or Bash(npm --version:*) to setup
  • Bash(./scripts/new-feature.sh:*) to exec

Portal result (AC-6)

The owner's session drove Validate in Claude in Chrome. It was a draft "Submit new" form, never submitted.

  • First run, at fccaab9: the hold had 3 findings, down from 9 on main:
    • exec: ./scripts/new-feature.sh:*, ./scripts/cleanup-worktree.sh:*
    • fullsolve: the same two plus ./scripts/list-worktrees.sh:*
    • setup: npm/yarn/pnpm --version:* and curl:*
  • Fix, in fda34ab: none of these are run by the skill bodies, so all were dropped. The relative scripts are the user's project scripts, and exec's body says never to run new-feature.sh. The gate now rejects all three forms.
  • Second run, at fda34ab: Validation passed: 5 warnings, 8 policy holds, and "Pre-approves broad shell access in allowed-tools" is absent.

These holds remain, and none is part of this issue:

  • "Uses a credential from the user's machine" (5)
  • "Install may use a custom registry or package source" (2)
  • "Scripts the validator couldn't follow" (hooks/post-tool.sh)

These notes remain too: "Allowed tools unscoped write" (9) and "Allowed tools skill any" (fullsolve). They are covered by the AC-4 table.

AC-4: bare Write / Edit / Skill

Path-scoped Write(...)/Edit(...) rules in skill frontmatter weren't verified against the CLI. Scoping them blind risks a silently dead grant, so every row is "kept, with a reason". The path candidates are noted for a later pass.

Skill Grant Decision Reason
exec Edit, Write keep Implements the issue: writes arbitrary source and test paths in the worktree
loop Edit, Write keep Fixes QA/test findings anywhere in the worktree
fullsolve Edit, Write keep Drives implementation and fix iterations, which write arbitrary worktree paths
fullsolve Skill keep Starts /spec, /exec, /test, /qa, /loop. Per-skill Skill(<name>) rules not verified in the CLI.
testgen Write, Edit keep Writes test stubs at paths derived from the project's test layout
docs Write keep Writes docs/admin/ or docs/features/. Path-scoping candidate.
setup Write keep Creates .sequant/settings.json and .sequant-manifest.json. Path-scoping candidate.
upstream Write keep Writes .sequant/upstream/<version>.md. Path-scoping candidate.
reflect Write keep Writes memory/notes files (references/documentation-tiers.md: project memory)
clean Write keep Writes the archive manifest before moving files

New prompts (interactive use only)

With a broad grant gone, these now ask before running:

  • /verify: every command it executes. Its job is to run the user's own commands, so Bash(*) is now a prompt per command. This is the intended trade-off.
  • /fullsolve, /loop, /test: any shell command outside the listed gh/git/npm test/npm run build/worktree-script grants.
  • /spec: git -C <path> diff … (per-worktree overlap check). The path sits before the subcommand, so no prefix grant can narrow it.
  • /exec: npm install, npx tsc, ./scripts/new-feature.sh, ./scripts/cleanup-worktree.sh.
  • /fullsolve: also ./scripts/new-feature.sh, cleanup-worktree.sh, list-worktrees.sh.
  • /setup: node -e … and curl. The body runs neither, nor the npm/yarn/pnpm version checks.
  • /improve, /upstream, /assess, /solve, /merger: gh/git subcommands outside each skill's new list.

Follow-ups

  • Broad grants the portal didn't flag (qa gh api:*; clean rm:*/mv:*/find:*; setup sed:*/cat:*/cp:*/jq:*) are tracked in fix(skills): narrow the broad allowed-tools grants the portal didn't flag — qa gh api, clean rm/find, setup curl/sed #1292.
  • qa's semgrep-scan: QA round 1 found that references/semgrep-rules.md runs it. Restored in this PR as two exact grants with no wildcard (npx tsx scripts/semgrep-scan.ts and … --changed-only).
  • Path-scoping Write for docs/setup/upstream, and Skill(<name>) for fullsolve: dropped from this PR, reason in the AC-4 table. The owner can reopen them if the AC-6 portal run flags "unscoped write".

Test plan

  • npx vitest run src/lib/__tests__/skill-allowed-tools-gate.test.ts src/lib/__tests__/fullsolve-merge-gate-skill.test.ts: 47/47 pass
  • npm run lint:skill-sync (47 synced), npm run lint:skill-calls (no violations), npx tsc --noEmit: clean
  • Full suite: CI

Runner notes

QA round 1 returned AC_NOT_MET. After it, the runner made these changes:

docs/reference/permissions.md now says frontmatter grants pre-approve rather than restrict.

🤖 Generated with Claude Code

Replace bare Bash, Bash(*), tool wildcards and runner wildcards with the subcommands each skill runs; add a frontmatter gate test over all four skill roots.

Entire-Checkpoint: 55ad47f69a09
… exact grants, gate rejects git -C/gh -R wildcards

Entire-Checkpoint: bb9a68d54186
@admarble admarble changed the title fix(#1287): narrow broad allowed-tools grants — bare Bash, Bash(*), and runner wildcards hold the directory listing for review fix(#1287): skills stop pre-approving broad shell access in allowed-tools Oct 3, 2026
…ipts, package-manager --version wildcards, curl; gate rejects all three

Entire-Checkpoint: 21b8dfad8bd5
@admarble
admarble merged commit eecbb12 into main Oct 4, 2026
11 checks passed
@admarble
admarble deleted the feature/1287-fix-skills-narrow-broad-allowed-tools-grants-bare- branch October 4, 2026 17:38
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.

fix(skills): narrow broad allowed-tools grants — bare Bash, Bash(*), and runner wildcards hold the directory listing for review

1 participant