agents/skills/aptos/ref-lifecycle/SKILL.md
Type Thought-template (instantiate before use) - Trigger Pattern Always (Aptos Move) -- ConstructorRef/TransferRef/MintRef/BurnRef lifecycle
npx skillsauth add plamentsv/plamen ref-lifecycleInstall 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.
Type: Thought-template (instantiate before use) Trigger Pattern: Always (Aptos Move) -- ConstructorRef/TransferRef/MintRef/BurnRef lifecycle Inject Into: Breadth agents, depth-state-trace, depth-token-flow Research basis: Aptos Object model capability-based access control, permanent reference semantics
In Aptos Move, object capabilities (Refs) are unforgeable tokens that grant specific permissions over objects. Unlike role-based access control in EVM, Refs are permanent once created -- they CANNOT be revoked. A leaked or improperly stored Ref grants permanent capability to its holder.
Key Ref types:
object::create_*. Parent of all other Refs. Grants ability to generate TransferRef, MintRef, BurnRef, DeleteRef, and ExtendRef.TransferRef is frozen. Bypasses ungated_transfer restrictions.ConstructorRef|TransferRef|MintRef|BurnRef|DeleteRef|ExtendRef|
object::create_named_object|object::create_sticky_object|object::create_object|
fungible_asset::generate_mint_ref|fungible_asset::generate_burn_ref|
fungible_asset::generate_transfer_ref|object::generate_delete_ref|
object::generate_extend_ref|object::generate_transfer_ref
Enumerate ALL Ref types found in the codebase. For each:
| Ref Type | Created In (module::function) | Stored Location | Access Control | Capability Granted | |----------|-------------------------------|-----------------|----------------|--------------------| | ConstructorRef | {module}::{init_fn} | {consumed / stored in resource} | {who can access} | Generate all other Refs | | MintRef | {module}::{init_fn} | {global resource at @addr} | {who can access} | Unlimited minting of {asset} | | BurnRef | {module}::{init_fn} | {global resource at @addr} | {who can access} | Burn {asset} from any store | | TransferRef | {module}::{init_fn} | {global resource at @addr} | {who can access} | Transfer {asset} bypassing freeze | | DeleteRef | {module}::{init_fn} | {global resource at @addr} | {who can access} | Delete {object} | | ExtendRef | {module}::{init_fn} | {global resource at @addr} | {who can access} | Generate signer for {object} |
Completeness check: Search for ALL generate_*_ref calls and object::create_* calls. Every Ref created MUST appear in the table.
The ConstructorRef is the root capability. It exists only during the init_module or object creation call.
Check 2a: Is ConstructorRef stored?
ConstructorRef -- this type has drop but NOT store, so it CANNOT be stored in global storage directly.object::generate_signer(&constructor_ref) and stores the signer reference indirectly, trace what that signer can do.Check 2b: What Refs are generated from it?
generate_*_ref call that uses this ConstructorRefpublic visibility or weak access control -> unlimited minting capability leak.Check 2c: ExtendRef derived signer
object::generate_extend_ref is called, the resulting ExtendRef can later produce a signer via object::generate_signer_for_extendingmove_to/move_fromCheck 3a: Storage access control
acquires and signer requirements)public fun that exposes MintRef via return value or mutable reference?public fun returning &MintRef or &mut MintRef = capability leak to any module.Check 3b: Mint amount validation
fungible_asset::supply check before mint)Check 3c: BurnRef scope
fungible_asset::burn_from with a BurnRef can burn tokens from ANY FungibleStoreCheck 3d: Mint/Burn symmetry
Check 4a: Freeze bypass
fungible_asset::transfer_with_ref bypasses frozen store checksfungible_asset::set_frozen_flag for compliance/security: does a stored TransferRef undermine the freeze?Check 4b: Transfer direction
fungible_asset::transfer_with_ref takes from: Object<FungibleStore> and to: Object<FungibleStore> -- the holder controls BOTH endsCheck 4c: Who holds TransferRef?
public entry fun to the transfer_with_ref invocation.Check 5a: Resource cleanup before deletion
object::delete(delete_ref) is called, what happens to resources stored at the object address?move_from of all resources = stranded assets (Rule 9: minimum MEDIUM).Check 5b: Deletion authorization
Check 6a: Public function returns
public fun or public(friend) fun that returns a Ref type&MintRef (immutable reference) leak is dangerous because it can be passed to fungible_asset::mint within the same transactionpublic fun returning Ref = Critical leak (any module can use). public(friend) fun returning Ref = Medium leak (friend modules can use -- check friend list).Check 6b: Friend module exposure
friend declarations in modules that store Refspublic fun that uses the Ref without additional access control?public fun that calls Module A's mint function = any module can mint via Module B.Check 6c: Store ability check
store ability can be placed in arbitrary global storage locationsstore? (standard Aptos Refs: ConstructorRef has drop only; MintRef/BurnRef/TransferRef/DeleteRef/ExtendRef have drop and store)store ability placed in a resource with weak access control = Ref can migrate to uncontrolled storage.Critical fact: Aptos Refs CANNOT be revoked once created. There is no revoke_mint_ref function in the framework.
Check 7a: Maximum blast radius
Check 7b: Compensating controls
Check 7c: Module upgrade path
compatible or immutable policy?): can an upgrade change who accesses the Ref?Check 8a: Ref combination attacks
Check 8b: Ref holder alignment
## Finding [{PREFIX}-N]: {Title}
**Verdict**: CONFIRMED / PARTIAL / REFUTED / CONTESTED
**Step Execution**: {see checklist below}
**Ref Type**: {ConstructorRef / MintRef / BurnRef / TransferRef / DeleteRef / ExtendRef}
**Severity**: {Critical/High/Medium/Low/Info}
**Location**: {SourceFile:LineN}
**Description**: {What capability is exposed and how}
**Impact**: {What an attacker/compromised entity can do with the Ref}
**Evidence**: {Code showing Ref creation, storage, and access path}
### Blast Radius
- **If compromised**: {Maximum damage description}
- **Revocable**: NO (Aptos Refs are permanent)
- **Compensating controls**: {pause/multisig/rate-limit or NONE}
| Step | Required | Completed? | Notes | |------|----------|------------|-------| | 1. Reference Inventory | YES | Y/N/? | Must enumerate ALL Refs | | 2. ConstructorRef Analysis | YES | Y/N/? | | | 3. MintRef/BurnRef Analysis | IF present | Y/N(none)/? | | | 4. TransferRef Analysis | IF present | Y/N(none)/? | | | 5. DeleteRef Analysis | IF present | Y/N(none)/? | | | 6. Ref Leakage Path Analysis | YES | Y/N/? | Check public returns + friends | | 7. Ref Revocation Assessment | YES | Y/N/? | Always: Refs are permanent | | 8. Cross-Ref Interaction | IF 2+ Ref types | Y/N(single)/? | |
**Step Execution**: check1,2,3,4,6,7,8 | x5(no DeleteRef)
OR if incomplete:
**Step Execution**: check1,2,3 | ?4,6,7(TransferRef not fully traced)
**FLAG**: Incomplete analysis -- requires depth review (leakage paths not exhausted)
{CONTRACTS} -- Move modules to analyze
{ASSET_NAME} -- Primary fungible asset name
{REF_STORAGE} -- Where Refs are stored (resource name and address)
{ACCESS_CONTROL} -- Who can access stored Refs (signer requirements)
{FRIEND_MODULES} -- Modules declared as friends
{FREEZE_USED} -- Whether protocol uses freeze functionality (YES/NO)
{UPGRADE_POLICY} -- Module upgrade policy (compatible/immutable)
| Field | Required | Description | |-------|----------|-------------| | ref_inventory | yes | Complete table of all Refs in codebase | | constructor_ref_analysis | yes | ConstructorRef lifecycle and consumption | | mint_burn_analysis | if present | MintRef/BurnRef storage and access control | | transfer_ref_analysis | if present | TransferRef and freeze bypass potential | | delete_ref_analysis | if present | DeleteRef and resource cleanup | | leakage_paths | yes | Public/friend exposure of Refs | | revocation_assessment | yes | Blast radius and compensating controls | | cross_ref_interactions | if 2+ types | Combined Ref attack scenarios | | finding | yes | CONFIRMED / REFUTED / CONTESTED / NEEDS_DEPTH | | evidence | yes | Code locations with line numbers | | step_execution | yes | Status for each step |
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