permission-chain
Permission chain analyzer: extracts role definitions, role check sites, middleware mounts, and mutating routes. Identifies transitive chains (role A can reach endpoint E via routes R1,R2...), surfaces
SKILL.mdskills/security/permission-chain/SKILL.md
GitHubWhat this is for
if(user.role=='admin') at one site is not the problem. Five such checks
across 3 roles plus middleware inheritance is the problem - who can do
WHAT, transitively. authorization-xray builds the permission matrix per
route. Missing: transitive closure, divergent-set detection, and unprotected
mutating routes where the only protection is middleware inheritance.
PROTECTION RULE - never ~/.claude/
Read-only skill. Guard required if write mode added later.
## What You Must Do When Invoked
During analysis, assign a confidence level to each finding: proven (confirmed by evidence), likely (strong signal, needs review), or suspected (weak signal).
Step 1
- If
-helpis passed, print the## Usageblock below and stop.
Step 2
- Confirm
-ProjectDiris provided and the path exists.
Step 3
- Run:
scripts/permission-graph.ps1 -ProjectDir "<path>"
Step 4
- LLM reads the JSON output. For each finding:
Step 5
- Unprotected mutating route (no check within +/-40 lines): does it
Step 6
inherit from middleware? what is the abuse path if middleware fails?
Step 7
- Divergent role set: 4 files define
admindifferently. Is one
Step 8
the intended truth? Where is the mismatch?
Step 9
- Diamond chains: same role reaches endpoint via two paths with
Step 10
different truth-values.
Step 11
- Broken chain (set-without-verify): role gets set in middleware but
Step 12
no check ever compares against it.
Step 13
- Write
permission-chain-report.mdto the working directory.
Usage
/permission-chain # interactive
/permission-chain <dir> # scan project
/permission-chain -help # show usage
Returns JSON with roleDefines[], roleChecks[], middleware[],
mutatingRoutes[], unprotectedRoutes[], knownRoles[] plus summary counts.