Skip to content

fix: Add confirmation dialog before broadcasting a transaction - #45

Open
lakshyaog wants to merge 2 commits into
Swapso-App:mainfrom
lakshyaog:fix/transaction-confirmation-dialog
Open

fix: Add confirmation dialog before broadcasting a transaction#45
lakshyaog wants to merge 2 commits into
Swapso-App:mainfrom
lakshyaog:fix/transaction-confirmation-dialog

Conversation

@lakshyaog

Copy link
Copy Markdown

Summary

Fixes #44 — Adds a transaction confirmation modal that displays all details before broadcasting.

Changes

  • wallet-ui/app.js: Split sendTransaction() into a validation + confirmation step and a separate broadcastTransaction() function that only executes after user confirmation.
  • wallet-ui/index.html: Added a confirmation modal overlay showing recipient address, amount, fee rate, and estimated total deducted.
  • wallet-ui/style.css: Added modal styling consistent with the existing dark theme.

How it works

  1. User fills in recipient, amount, and fee rate, then clicks "Send Transaction"
  2. Input validation runs (same as before)
  3. A confirmation modal appears showing: recipient address, amount in sats/BTC, fee rate, and total deducted
  4. User can Cancel (returns to send form) or Confirm & Send (signs and broadcasts)

Testing

  1. Create/restore a wallet with funds
  2. Go to Send → fill in address, amount, select fee
  3. Click "Send Transaction"
  4. Verify the confirmation modal appears with correct details
  5. Click Cancel → verify modal closes, no transaction sent
  6. Click Confirm & Send → verify transaction broadcasts as before

lakshyaog added 2 commits May 24, 2026 22:47
Security Fix:
- Added immediate key zeroing in encryptMnemonic() after encryption
- Added immediate key zeroing in decryptMnemonic() after decryption
- Prevents memory dump attacks by destroying sensitive cryptographic material
- Keys are now zeroed using Buffer.fill(0) immediately after use

Issue:
AWS KMS plaintext data keys were persisting in RAM after encryption/
decryption operations. If an attacker gained access to process memory
(via memory dump, debugging, or system compromise), they could extract
these keys and decrypt any mnemonic encrypted with them, leading to
complete wallet compromise.

Solution:
The fix ensures plaintext keys are overwritten with zeros immediately
after cryptographic operations, following security best practices for
handling sensitive key material. This matches the existing security
patterns used in btc-controller for private key handling.

Testing:
- Added test-key-zeroing.js to verify basic key zeroing functionality
- Added test-actual-fix.ts to verify encryption/decryption with zeroing
- Added SECURITY-FIX-VERIFICATION.md with complete documentation
- All tests pass successfully

Impact:
- Eliminates memory-based key extraction vulnerability
- Provides production-grade security for wallet operations
- No breaking changes to existing API
Resolves Swapso-App#44 - Users now see a summary screen showing recipient address,
amount, fee rate, and total deducted before the transaction is signed and
broadcast. They can cancel or confirm from this modal.
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.

Title: Security: No confirmation dialog before broadcasting a transaction

1 participant