-
Notifications
You must be signed in to change notification settings - Fork 1
🟠 HIGH: test-contract.cjs uses PostConditionMode.Allow on mainnet transactions #223
Copy link
Copy link
Closed
Description
Description
The deployment test script scripts/test-contract.cjs broadcasts transactions to mainnet with postConditionMode: PostConditionMode.Allow. This disables Stacks post-condition enforcement, meaning the contract could transfer more STX than the sender intended without the transaction being rejected by the chain.
The frontend correctly uses PostConditionMode.Deny everywhere, but this script creates a dangerous precedent and could be copied by contributors.
Files Affected
scripts/test-contract.cjs(line ~65)
Current Behavior
postConditionMode: PostConditionMode.Allow,Expected Behavior
postConditionMode: PostConditionMode.Deny,
postConditions: [
Pc.principal(senderAddress).willSendLte(amount).ustx(),
],Proposed Fix
- Change mode to
PostConditionMode.Deny - Add explicit STX post-conditions matching the expected transfer2. Add explicit Sco2. Add explicit STX post-conditions matching the expected ttion scripts
Severity
High -- Weakens transaction safety on mainnet
Labels
security, bug
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels