access-control-patterns
Role/permission analysis: admin keys, timelocks, governance, privilege escalation. Used during threat modeling to define attacker capabilities.
- License 许可
- MIT
- 最近更新
- 2026-10-18
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- access-control-patterns
- description
- Role/permission analysis: admin keys, timelocks, governance, privilege escalation. Used during threat modeling to define attacker capabilities.
03 SKILL.md 正文
Access Control Patterns Skill
Purpose
Catalog who can do what in the protocol. This directly feeds the "Attacker Capabilities" field of every audit task — the Threat Modeler needs to know what an attacker can and cannot call.
When to Use
- During threat modeling to define attacker capabilities
- During decomposition (permission-flow dimension)
- When assessing admin/governance risk
Extraction Protocol
Step 1: Identify Access Control Mechanisms
# OpenZeppelin Ownable
grep -rn "onlyOwner\|Ownable" --include="*.sol"
# OpenZeppelin AccessControl (roles)
grep -rn "onlyRole\|AccessControl\|ADMIN_ROLE\|MINTER_ROLE" --include="*.sol"
# Custom modifiers
grep -rn "modifier " --include="*.sol"
# Timelock patterns
grep -rn "timelock\|TimelockController\|delay\|queueTransaction" --include="*.sol"
# Multi-sig patterns
grep -rn "multisig\|MultiSig\|threshold\|confirmTransaction" --include="*.sol"
Step 2: Build Permission Matrix
| Function | Contract | Access | Controller | Risk Level |
|---|---|---|---|---|
setFee() |
Vault.sol | onlyOwner | EOA | High (single point of failure) |
pause() |
Vault.sol | onlyRole(PAUSER) | Multi-sig | Medium |
mint() |
Token.sol | onlyRole(MINTER) | Vault contract | Low |
withdraw() |
Vault.sol | public | Any user | N/A (user function) |
Step 3: Identify Risk Patterns
| Risk Pattern | Description |
|---|---|
| Single EOA admin | One address controls critical functions |
| No timelock | Admin changes take effect immediately |
| Privilege escalation | Can a role grant itself more permissions? |
| Unrenounceable ownership | Owner cannot be removed (intentional or bug?) |
| Backdoor functions | Admin-only functions that can drain funds |
| Proxy admin overlap | Proxy admin can change implementation at will |
Step 4: Attacker Capability Matrix
For the Threat Modeler, produce:
## Attacker Capability Levels
### Level 1: External User (no special permissions)
Can call: [list of public/external functions]
Cannot call: [list of restricted functions]
### Level 2: Privileged Role (e.g., keeper, operator)
Can call: [Level 1 + role-specific functions]
Special powers: [e.g., can trigger liquidations, update prices]
### Level 3: Admin / Owner
Can call: [everything]
Critical powers: [e.g., change fees, pause, upgrade, set oracle]
### Level 4: Compromised Admin (worst case)
What damage can a malicious admin do?
[e.g., drain all funds, change oracle to attacker-controlled contract]
Output
Save to: specs/decomposition/permission-flow-decomposition.md
04 同仓库更多 Skills
stripe-patterns
暂无简介
payment-patterns
暂无简介
testing-patterns
Testing patterns for Jest and Playwright. Use when writing tests, setting up test fixtures, or validating RLS enforcement. Routes to existing test conventions.
team-coordination
Agent Teams orchestration patterns for multi-agent SAFe workflows. Use when spawning agent teams, coordinating teammates, enforcing quality gates via task dependencies, or orchestrating the 11-agent SAFe pipeline. Covers team creation, messaging, shared task lists, and SAFe gate enforcement. Do NOT use for single-agent or simple subagent workflows.
task-compilation
Compile broad audit goals into structured proof obligations with 9 mandatory fields. Used after decomposition by the Threat Modeler agent.
storage-layout-analysis
Proxy patterns, slot collisions, upgrade safety. Used during decomposition to identify storage-related vulnerabilities in upgradeable contracts.