security-permissions
Risk-graded permission audit - wraps native /fewer-permission-prompts with allow/ask/deny tiers
- License 许可
- MIT
- 所属仓库
- cooneycw/skillc
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- security-permissions
- description
- Risk-graded permission audit - wraps native /fewer-permission-prompts with allow/ask/deny tiers
02 资源文件 6
- 参考文档PROVENANCE.md579 B
- 脚本scripts/classify-tool-risk.py9.6 KB
- 脚本scripts/friction-log.sh7.1 KB
- 脚本scripts/hook-permission-census.sh20.6 KB
- 脚本scripts/SHA256SUMS924 B
- 脚本scripts/tool-risk-drift.py3.0 KB
03 SKILL.md 正文
<!-- GENERATED by claude-power-pack - scripts/codex-skill-sync.py; edit .claude/commands/security/permissions.md instead -->
Codex harness adaptations
Generated from a Claude Code command. Where the procedure references these Claude-only surfaces, adapt as follows:
- MCP tools: use the MCP servers configured in
~/.codex/config.toml, or fall back to the referenced repo scripts and CLI entry points. - Helper scripts are bundled under
scripts/in this skill directory (byte-identical copies from the claude-power-pack checkout). Commands run them as"${CPP_SKILL_DIR:-/dev/null}"/scripts/<name>:CPP_SKILL_DIRis the absolute directory containing THIS SKILL.md - the location the skills catalog gives, with any alias such asr0expanded. A shell resolves a barescripts/<name>against your working directory (the target project), never this skill, so substitute that directory, or set it in the same command (CPP_SKILL_DIR=/abs/skill/dir; ...) - each command is a fresh shell. "Not a directory" on/dev/null/scripts/<name>(exit 126, or 127 in some shells) meansCPP_SKILL_DIRis unset: set it and re-run; never run the target project's ownscripts/<name>in its place. Read every "exit 127" fallback in this skill as "exit 127, or 126 Not a directory": set the variable and re-run before falling back. A helper whose verdict gates a step and that prints no verdict line after the whole fallback chain did not run - for the finish gate, noFLOW_FINISH_GATE:verdict line: STOP, never read it as skipped, never commit on it (issue #1547). A barescripts/<name>inside a command is a CPP-checkout operation that the text says so about; in prose,scripts/<name>NAMES the bundled helper. Some helpers expect sibling repo resources, so prefer a full checkout when one is available.
Security: Permissions Audit
A risk-graded wrapper around Claude Code's native /fewer-permission-prompts.
The native skill does a binary read-only / skip split and emits an allowlist only.
This command adds scripts/classify-tool-risk.py to sort every observed tool call
into risk tiers, then proposes a full allow / ask / deny policy.
Use the native
/fewer-permission-promptsfor the quick read-only allowlist. Use this when you also want the mutation and danger tiers surfaced and guarded (it never editspermissions.ask/permissions.denyunless you asked for the graded policy, which this command does by design).
What it produces
- allow - read-only commands not already auto-allowed (e.g.
git fetch) + the safe, reversible subset of local writes (git add,git commit,mkdir,git worktree add) + read-only MCP tools seen >= 3 times. - ask - the recoverable-but-dangerous tier, gated even under auto-accept:
git push --force,git reset --hard,rm -rf. - deny - secrets that must never be auto-edited:
.env,*.pem,*.key,id_rsa*.
Steps
-
Run the graded classifier over recent transcripts:
python3 "${CPP_SKILL_DIR:-/dev/null}"/scripts/classify-tool-risk.py --limit 50(Run from the CPP checkout. It scans
~/.claude/projects/**/*.jsonlacross all projects, not just the current one.) -
Present the tiers as a table (tier, count, examples, verdict). Note that the READONLY-AUTO tier is already covered by Claude Code and needs no rule - do not propose those (see the native skill's auto-allow list).
-
Propose the policy from the tiers:
allow: READONLY-ADDABLE + the SAFE subset of WRITE-LOCAL. Exclude anything with a data-loss mode -git checkout,git rm,git branch -D,git worktree remove,git resetclassify as DESTRUCTIVE, not allow. CODE-EXEC / DUAL-USE-NET / SCRIPT-EXEC are never allowlisted (arbitrary execution or ambiguous network I/O).ask: the DESTRUCTIVE tier (force push,reset --hard,rm -rf) so it prompts even under auto-accept.deny: secret files (.env,**/.env,*.pem,*.key,id_rsa*).
-
Merge into the project
.claude/settings.json(NOTsettings.local.json, NOT~/.claude/settings.json): preserve existing keys and entries, de-duplicate, never remove or reorder. Precedence is deny > ask > allow, so a secretdenyoverrides a broadEdit(**)allow. -
Report: what was added to each tier, what was already covered by Claude Code's auto-allow (so no rule was needed), and what was excluded and why (e.g. dropped
python3/uv/make- arbitrary code execution; droppedcurl/gh api- dual-use network).
File-edit scope (the git-tracked nuance)
To auto-allow file edits "only within the git commit list": Claude Code permissions are path-glob based, not git-aware, so this cannot be expressed directly. Two implementations:
- Approximation (default):
Edit(**)/Write(**)for the repo tree plus adenylist for sensitive gitignored files (.env, keys). - Exact (offer): a
PreToolUsehook that runsgit check-ignoreon the edit target and blocks ignored paths. This literally scopes edits to tracked files. Offered, not applied by default.
Notes
- Wraps, does not replace, the native
/fewer-permission-prompts(a built-in Claude Code skill, not a CPP skill - which is why its graded extension lives in CPP). - Classifier:
scripts/classify-tool-risk.py(the canonical risk taxonomy). Re-run anytime for a fresh view. - Complements the real-time side: the
#482permission-census hook (scripts/hook-permission-census.sh) captures prompts as they happen and vendors the same taxonomy inline. This command is the retroactive side (mine all transcripts, propose a policy in one pass).scripts/tool-risk-drift.pyguards the two taxonomies' safety-critical sets in sync. - The destructive
ask/denyguards are more protective in~/.claude/settings.json(global, every project); the allowlist is project-scoped by design. Offer to promote the guards to global.
04 同仓库更多 Skills
tiny-check
Run the tiny project check
tiny-check
A synthetic gate selection fixture.
flow-check
Use when you are asked to run a project's quality checks (tests, lint, type checks, security scan): runs them in one step and reports what failed, without committing.
flow-check
Use when you are asked to run a project's quality checks (tests, lint, type checks, security scan): runs them in one step and reports what failed, without committing.
flow-check
Use when you are asked to run a project's quality checks (tests, lint, type checks, security scan): runs them in one step and reports what failed, without committing.
flow-check
Use when you are asked to run a project's quality checks (tests, lint, type checks, security scan): runs them in one step and reports what failed, without committing.