agents/skills/soroban/semi-trusted-roles/SKILL.md
Trigger Pattern operator/keeper/crank require_auth checks, authority-gated functions - Inject Into Breadth agents, depth-state-trace
npx skillsauth add plamentsv/plamen semi-trusted-rolesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger Pattern: operator/keeper/crank
require_authchecks, authority-gated functions, admin actions beyond pure parameter-setting Inject Into: Breadth agents, depth-state-trace Finding prefix:[STR-N]Rules referenced: R2, R6, R10, R13
operator|keeper|crank|authority|admin|require_auth|guardian|relayer|updater|manager
Soroban role context: No role-based modifiers. Access control is custom: stored Address from Instance/Persistent storage + .require_auth(). Address is opaque — may be keypair, Stellar multisig, or contract.
In {CONTRACTS}, find all functions callable by {ROLE_NAME}. For each at {ROLE_FUNCTIONS}:
invoke_contract / TokenClient)?require_auth() vs inline vs direct check)| Function | Auth Check | Storage Mutations | Cross-Contract Calls | Parameters | |----------|-----------|-------------------|---------------------|------------|
Auth patterns: stored Address + require_auth(), e.current_contract_address().require_auth() (sub-invocation), NO auth on privileged state mutation (missing auth bug).
For each permitted action, ask:
Timing Abuse (~5s ledger close, no mempool):
Parameter Abuse:
Sequence Abuse:
Omission Abuse:
Scenario A: Timing Attack (Transaction Ordering)
1. {ROLE_NAME} observes pending user transaction
2. {ROLE_NAME} submits role_function() in same or prior ledger
3. State changes before user transaction executes
4. Impact: {TIMING_IMPACT}
Note: No public mempool. Requires role to be validator or fee-bumper.
Scenario B: Parameter Attack
1. {ROLE_NAME} calls {ROLE_FUNCTION} with {MALICIOUS_PARAMS}
2. Parameters not validated against {EXPECTED_CONSTRAINTS}
3. Impact: {PARAM_IMPACT}
Scenario C: Key Compromise
1. {ROLE_NAME} Address keypair compromised (or: Address is a contract that gets compromised)
2. Attacker can call: {ROLE_FUNCTIONS}
3. Maximum extractable value: {MAX_DAMAGE}
4. Recovery: {RECOVERY_PATH} — rotation function exists? If Address is upgradeable contract, who holds upgrade key?
{ROLE_NAME} actions? (multi-ledger proposal+execute){ROLE_NAME} a Stellar multisig (M-of-N) or governance contract?update_current_contract_wasm): can compromised role be replaced?Soroban patterns: Two-step transfer (propose_new_admin + accept_admin), multisig Address. Role in Instance/Persistent storage takes effect immediately (no built-in delay).
Predictability Analysis:
Scenario D: User Exploits Role Timing
1. User observes {ROLE_NAME} executes {ROLE_FUNCTION} when {CONDITION} met
2. User submits higher-fee tx to land before role in same ledger
3. User benefits from known state change. Impact: {USER_EXPLOIT_IMPACT}
Scenario E: User Griefs Role Preconditions
1. {ROLE_FUNCTION} requires state: {PRECONDITION}
2. User manipulates state to violate {PRECONDITION}
3. Role tx panics; protocol enters degraded state. Impact: {GRIEF_IMPACT}
Scenario F: User Forces Suboptimal Role Action
1. User manipulates on-chain state to make worst option appear best
2. {ROLE_NAME} (honest policy) chooses suboptimal path. Impact: {SUBOPTIMAL_IMPACT}
Scenario G: Stale Rate via Discrete Updates
1. Exchange rate only updates when {ROLE_NAME} calls {UPDATE_FUNCTION}
2. User enters at stale rate, role updates, user exits. Impact: {RATE_ARBIT_IMPACT}
For each function callable by {ROLE_NAME}:
| Function | Preconditions | User Can Manipulate? | Grief Impact | |----------|--------------|---------------------|--------------|
Soroban griefing: Persistent storage record proliferation exceeding resource budget during role iteration? TTL expiry on user entries causing unwrap() panics in role functions?
Enumerate ALL authority-gated functions:
| Function | Authority Type | Preconditions | User Can Manipulate? | Grief Impact | |----------|---------------|--------------|---------------------|--------------|
Completeness check: Total authority-gated: {N}, analyzed: {M}. If M < N → analyze missing.
Soroban-specific checks:
transfer_from, causing admin crank to fail?transfer to contract bloat tracked balance beyond admin's expected range?**ID**: [STR-N]
**Severity**: Critical/High/Medium/Low/Info
**Step Execution**: (see below)
**Rules Applied**: [R2:___, R6:___, R10:___, R13:___]
**Location**: src/{file}.rs:LineN
**Title**: {what role can do / what user can exploit}
**Description**: {specific abuse vector with code reference}
**Impact**: {quantified damage at worst-state parameters}
| Step | Required | Completed? | Notes | |------|----------|------------|-------| | 1. Inventory Role Permissions | YES | | | | 2. Analyze Within-Scope Abuse | YES | | | | 3. Model Attack Scenarios (A, B, C) | YES | | | | 4. Assess Mitigations | YES | | | | 5. Model User-Side Exploitation (D, E, F, G) | YES | | MANDATORY — never skip | | 6. Precondition Griefability Check | YES | | MANDATORY — never skip | | 6b. Admin Instruction Griefability | YES | | MANDATORY — never skip |
After Step 4: DO NOT STOP HERE — Steps 5-6 analyze the reverse direction. After Step 5: Cross-reference with TOKEN_FLOW_TRACING for token-related griefing vectors. IF role actions are time-predictable → document ledger-ordering (fee-bump) vectors. After Step 6: IF any precondition is user-griefable → severity >= MEDIUM. Document protocol degradation timeline if role is blocked indefinitely. After Step 6b: IF admin iterates over user-created Persistent entries → check for unbounded iteration / resource exhaustion.
**Step Execution**: check1,2,3,4,5,6,6b | (no skips for this skill)
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline