agents/skills/sui/external-precondition-audit/SKILL.md
Trigger Pattern Any external package function call detected in program - Inject Into Breadth agents (merged via M5 hierarchy)
npx skillsauth add plamentsv/plamen external-precondition-auditInstall 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: Any external package function call detected in program Inject Into: Breadth agents (merged via M5 hierarchy) Finding prefix:
[EPA-N]Rules referenced: R1, R4, R8, R10 Constraint: Interface-level inference only -- no production fetch required
use.*external|friend|public.*package|transfer::public_|dynamic_field|coin::from_balance|
clock::timestamp_ms|sui::pay|dex|swap|oracle|price_feed
For every external package the protocol calls:
From the imported module signatures, infer what the external package requires:
| External Function Called | Parameters Passed | Likely Preconditions (from signature) | Our Protocol Validates? | Package Immutable? | |-------------------------|-------------------|--------------------------------------|------------------------|--------------------|
Inference method: Read the function signature, type constraints, and any doc comments. Example: pool::swap<A, B>(pool: &mut Pool<A, B>, coin_in: Coin<A>, ...) -> infer that pool must be the correct pool for A/B pair, coin_in must have sufficient balance, and return Coin<B> may have zero value (slippage).
Package immutability check (CRITICAL Sui-specific):
UpgradeCap destroyed)?UpgradeCap? What upgrade policy (compatible, additive, dependency-only)?compatible policy: the external package can change function behavior arbitrarily. Apply Rule 4 (adversarial assumption) -- treat the external package as potentially malicious after upgrade.| External Call | Return Type | How Protocol Uses Return | Failure Mode if Return Unexpected | |--------------|-------------|-------------------------|----------------------------------|
For each return value:
Coin<T> with zero balance? (division by zero, incorrect share calculation)Coin<T> with less value than expected? (slippage not checked)Sui-specific: External package calls within a PTB share the same abort scope. If any external call aborts, the entire PTB reverts. Model: can an attacker cause an external call to abort to grief a user's multi-step PTB?
| Protocol State | Depends on External Shared Object | External State Can Change Between Epochs/Txns? | |---------------|----------------------------------|------------------------------------------------|
For each dependency: model what happens when the external shared object state changes between our protocol's transactions.
Sui-specific concerns:
For each external package dependency:
| External Package | UpgradeCap Status | Upgrade Policy | Impact if Upgraded | Our Protocol's Mitigation | |------------------|-------------------|---------------|-------------------|--------------------------| | {package} | {destroyed (immutable) / held by {who}} | {compatible / additive / dep_only / immutable} | {behavior change risk} | {version pin / none} |
Check:
sui::package::UpgradeCap? If so:
UpgradeCap? (single admin, multisig, destroyed for immutability)compatible = can change anything, additive = can add but not change, dep_only = only dependency updates, immutable = frozen forever)compatible policy: shared objects created by the old version may behave differently when accessed by the new version's functions. Our protocol may call into changed behavior without any code change on our side.**ID**: [EPA-N]
**Verdict**: CONFIRMED / PARTIAL / REFUTED / CONTESTED
**Step Execution**: (see checklist below)
**Rules Applied**: [R1:___, R4:___, R8:___, R10:___]
**Severity**: Critical/High/Medium/Low/Info
**Location**: sources/{module}.move:LineN
**Title**: {missing external validation / unexpected return / state dependency}
**Description**: {specific issue with code reference}
**Impact**: {what attacker can achieve via the external package weakness}
| Section | Required | Completed? | Notes | |---------|----------|------------|-------| | 1. Interface-Level Requirement Inference | YES | | Includes package immutability check | | 2. Return Value Consumption | YES | | Hot potato return paths checked | | 3. State Dependency Mapping | YES | | Cross-epoch + package upgrade state | | 3b. Package Upgrade Risk | YES | | UpgradeCap holder + upgrade policy |
If any step skipped, document valid reason (N/A, no external packages, framework-only deps).
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