scope-per-tool-permissions-least-privilege
Use when granting an agent access to tools, files, or network. Give each tool the narrowest scope that completes its job, and revoke the rest.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- scope-per-tool-permissions-least-privilege
- description
- Use when granting an agent access to tools, files, or network. Give each tool the narrowest scope that completes its job, and revoke the rest.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md368 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Scope per-tool permissions to least privilege
An agent inherits whatever the process allows, so a write bug becomes a write-anywhere bug. Grant permissions per tool, scoped to the exact resource, and keep the default deny.
Procedure
- Enumerate the run's tools and, for each, the single resource it needs:
db_read -> customers (SELECT),file_write -> out/report.csv. - Write the grant list explicitly; anything absent is denied. Default-deny, allow by exception.
- Scope filesystem access to a subtree and a mode:
out/:rw,src/:ro. Never grant/or$HOME. - Scope database access to schema verbs:
SELECTfor readers,INSERTon one table for writers — neverALLorGRANT. - Scope network egress to named hosts when the tool only needs a few:
api.internal:443, not0.0.0.0/0. - Give each tool its own credential with the least role, not a shared admin token that every tool can borrow.
- Re-derive the grant list per run from the brief; do not copy last run's permissions wholesale.
- Audit weekly: list grants actually exercised from the action log and remove the ones never used.
- Treat a permission error as a design signal, not an obstacle to widen away — decide whether the step should exist.
Pitfalls
- Granting
sudoor a root token "so the agent is not blocked", which removes every other control at once. - Sharing one credential across tools, so an audit cannot tell which tool did what.
- Scoping to a directory but forgetting mode, giving read-only tasks the ability to delete.
- Copying a previous run's broader grants because re-deriving them is tedious.
- Leaving a grant in place after the tool is retired, accumulating latent access.
- Widening a scope to fix one denied call instead of fixing the call's resource target.
Verification
python3 tools/audit_grants.py runs/grants.json notes/action.log
# fails on any exercised path outside the declared scope, and lists unused grants for removal
Report each tool, its declared scope, and any access the run attempted outside it.
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.