Skip to content

fix(xswd): prohibit native-DERO burns entirely#18

Merged
DHEBP merged 2 commits into
devfrom
fix/xswd-burn-guard
Jun 17, 2026
Merged

fix(xswd): prohibit native-DERO burns entirely#18
DHEBP merged 2 commits into
devfrom
fix/xswd-burn-guard

Conversation

@DHEBP

@DHEBP DHEBP commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Problem

A transfer carrying a burn on the zero SCID (native DERO) with no smart contract attached destroys the coins permanently — they go to no recipient and cannot be recovered. The generic XSWD transfer path read a caller-supplied burn straight into the transaction with no guard, so a request that set burn without a contract would build and broadcast a destroying transaction. The approval modal presented it as an ordinary cost line, with no indication the funds would be destroyed.

A burn on a non-zero SCID is the normal token-transfer mechanism, and a burn with a contract attached is a legitimate deposit — neither is affected by this change.

Fix — outright prohibition

HOLOGRAM is a consumer wallet and never burns DERO. A native-DERO (zero-SCID) burn with no contract attached is rejected entirely — no override, no approve path. Anyone who genuinely intends to burn DERO must use the DERO CLI wallet.

  • BackendshouldBlockBurn blocks every destructive burn unconditionally; the rejection error points the user to the CLI. The guard is applied at every broadcast site (the transfer case and the scinvoke case), so the prohibition is explicit and does not depend on chain-side refund behavior if the code is later refactored. The block applies only to the destructive case — token transfers (non-zero SCID) and contract deposits (burn with a contract) are unaffected.
  • Approval modal — a destructive burn renders as a red "REQUEST BLOCKED" notice explaining the coins would be destroyed and that HOLOGRAM does not burn DERO (use the CLI to do so deliberately). There is no Approve or Destroy button — only Dismiss. The modal's SC-call check mirrors the backend (real entrypoint / sc_data, not a bare scid string) so a dApp cannot make the UI show Approve for a request the backend blocks.
  • Clearer labeling — a burn that routes to a contract is labeled "Deposit to contract," not "Burn."
  • Tests + CI sentinelburn_guard_test.go asserts destructive burns are always blocked while token transfers and deposits stay allowed, plus a source-level sentinel test that fails the build if a burn-override path is ever reintroduced.

Verification

The change was adversarially audited (multi-agent) against the pinned on-chain DERO code. Result: no path can broadcast a destructive native-DERO burn, no regressions to token transfers / deposits / normal sends, and no dangling references. Two issues surfaced by the audit — a UI/backend hasSCCall mismatch and missing defense-in-depth on the scinvoke path — are fixed in this PR.

Full Go suite, go vet, and the frontend build all pass.

DHEBP added 2 commits June 16, 2026 23:30
A transfer carrying a burn on the zero SCID (native DERO) with no smart
contract attached destroys the coins permanently with no recipient. The
generic XSWD transfer path read a caller-supplied burn straight into the
transaction with no guard, so a request that set burn without a contract
would build and broadcast a destroying transaction, and the approval
modal presented it as an ordinary cost line.

Add defense in depth so this requires deliberate, explicit confirmation:

- Backend: reject a zero-SCID burn with no SC call unless the request
  carries an explicit confirmDestroy flag. The flag is honored only when
  the burn is actually destructive, so it can never weaken a normal
  transfer or a contract deposit. (detectDestructiveBurn / shouldBlockBurn)
- Approval modal: render a destructive burn as a permanent-destruction
  warning (amount, no recipient, unrecoverable) and require typing
  "BURN <amount>" to enable approval. Disable the Enter-to-approve
  shortcut for this case.
- Relabel a burn that routes to a contract as "Deposit to contract" so
  the destructive case is no longer visually identical to a deposit.
- Wire confirmDestroy from the modal through the XSWD approval path.
- Add regression tests for detection and the block-unless-confirmed policy.
HOLOGRAM is a consumer wallet and never burns DERO. Replace the
confirm-to-burn flow with an outright prohibition: a native-DERO
(zero-SCID) burn with no smart contract attached is rejected with no
override and no approve path. Anyone who genuinely intends to burn DERO
must use the DERO CLI wallet.

- Backend: shouldBlockBurn now blocks every destructive burn
  unconditionally; remove the confirmDestroy flag and its plumbing
  (ProcessApprovalConfirmDestroy, the RespondToXSWDRequestConfirmDestroy
  bridge, and the param injection). Rejection points users to the CLI.
- Apply the guard at the scinvoke broadcast site too, so the prohibition
  is explicit at every path that builds a transfer rather than relying on
  chain-side refund behavior if the code is later refactored.
- Approval modal: a destructive burn renders as a "REQUEST BLOCKED"
  notice with only a Dismiss action -- no Approve/Destroy button, no
  type-to-confirm. Mirror the backend's SC-call check (real entrypoint /
  sc_data, not a bare scid) so a dApp cannot make the UI show Approve for
  a request the backend blocks.
- Keep "Deposit to contract" labeling for contract-attached burns.
- Tests: assert destructive burns are always blocked while token
  transfers and deposits stay allowed; add a source-level sentinel that
  fails the build if a burn-override path is ever reintroduced.
@DHEBP DHEBP changed the title fix(xswd): guard against accidental native-DERO burns fix(xswd): prohibit native-DERO burns entirely Jun 17, 2026
@DHEBP DHEBP changed the title fix(xswd): prohibit native-DERO burns entirely harden XSWD dApp safety: prohibit native-DERO burns and wallet-secret methods Jun 17, 2026
@DHEBP DHEBP force-pushed the fix/xswd-burn-guard branch from d636181 to 16d4513 Compare June 17, 2026 04:47
@DHEBP DHEBP changed the title harden XSWD dApp safety: prohibit native-DERO burns and wallet-secret methods fix(xswd): prohibit native-DERO burns entirely Jun 17, 2026
@DHEBP DHEBP merged commit dbd2a6e into dev Jun 17, 2026
4 checks passed
@DHEBP DHEBP deleted the fix/xswd-burn-guard branch June 17, 2026 04:53
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.

1 participant