Skip to content

fix(publish): enforce the AllowMainnet gate in BuildPSBT (#109)#110

Merged
LiranCohen merged 1 commit into
mainfrom
fix/buildpsbt-mainnet-gate
Jun 8, 2026
Merged

fix(publish): enforce the AllowMainnet gate in BuildPSBT (#109)#110
LiranCohen merged 1 commit into
mainfrom
fix/buildpsbt-mainnet-gate

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

Closes audit finding #23. Writer.Submit refuses mainnet without AllowMainnet (writer.go:81), but BuildPSBT — the external/hardware-signer flow, the PSBT feature's whole reason to exist — had no such gate. So on mainnet it pinned DID files to public IPFS and funded a real-BTC-spending tx with no ion-node mainnet check firing; the out-of-band signer then completes the spend.

Fix

Add the same Params.Name == MainNetParams.Name && !AllowMainnet gate to BuildPSBT, checked before the IPFS pin.

TestBuildPSBTMainnetGuard — refused without AllowMainnet, builds with it; mutation-verified. go test -race ./... green (26 packages).

Post-Deploy Monitoring & Validation

No additional operational monitoring required: tightens a money-path guard to match Submit. Operators using the PSBT flow on mainnet must now pass --allow-mainnet (same as Submit).

Closes #109

🤖 Generated with Claude Code

Finding #23. Submit refuses mainnet without AllowMainnet, but BuildPSBT — the
external/hardware-signer flow — had no such gate, so on mainnet it pinned DID files
to public IPFS and funded a real-BTC spend with no check firing (the out-of-band
signer then completes it). Add the same Params.Name==MainNetParams.Name &&
!AllowMainnet gate to BuildPSBT, checked BEFORE the IPFS pin.

Test: TestBuildPSBTMainnetGuard (refused without AllowMainnet; builds with it).
Mutation-verified. go test -race ./... green.

Co-authored-by: Liran Cohen <liranlasvegas@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LiranCohen LiranCohen merged commit 02561d9 into main Jun 8, 2026
1 check passed
@LiranCohen LiranCohen deleted the fix/buildpsbt-mainnet-gate branch June 8, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

publish: BuildPSBT lacks the AllowMainnet gate that Submit enforces

1 participant