harden: ignore a nonce the page supplies with eth_sendTransaction #434

Merged
clawbot merged 1 commits from issue-404-drop-page-nonce into next 2026-10-04 18:43:05 +02:00
Collaborator

Implements #404.

What changed. A site could fix the nonce of the transaction it asked the user to sign. The same nonce as a pending transaction, at a higher fee, replaces that transaction; a nonce above the account's next one leaves the new transaction stuck behind a gap. nonce is removed from the fields src/shared/approvalTx.js takes from the page's request, so the transaction always gets the account's next nonce from the network.

Why nothing else changed. The approval screen, the popup's signing and the background's check of the signed transaction (src/shared/approvalVerify.js) all read the transaction the background prepared, never the page's request, so once the nonce is no longer taken from the page they all carry the network's nonce. A gas limit the page supplies is still honoured; that is the owner's question in #207.

Tests. New tests/approvalNonce.test.js: a page asks for nonce 2 while the network's next nonce is 7; the approval screen shows 7, and the transaction its real Confirm button signs carries 7. It fails against current next, as does the updated case in tests/approvalTx.test.js, which used to assert that the page's nonce was kept.

Docs. README.md (TxApproval) now says a nonce the site supplies is ignored; TODO.md entry added.

Judgement call: README.md has no list of the fields taken from a page, so the sentence went into the TxApproval description of what the background populates.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/AutistMask/issues/404. **What changed.** A site could fix the nonce of the transaction it asked the user to sign. The same nonce as a pending transaction, at a higher fee, replaces that transaction; a nonce above the account's next one leaves the new transaction stuck behind a gap. `nonce` is removed from the fields `src/shared/approvalTx.js` takes from the page's request, so the transaction always gets the account's next nonce from the network. **Why nothing else changed.** The approval screen, the popup's signing and the background's check of the signed transaction (`src/shared/approvalVerify.js`) all read the transaction the background prepared, never the page's request, so once the nonce is no longer taken from the page they all carry the network's nonce. A gas limit the page supplies is still honoured; that is the owner's question in https://git.eeqj.de/sneak/AutistMask/issues/207. **Tests.** New `tests/approvalNonce.test.js`: a page asks for nonce 2 while the network's next nonce is 7; the approval screen shows 7, and the transaction its real Confirm button signs carries 7. It fails against current `next`, as does the updated case in `tests/approvalTx.test.js`, which used to assert that the page's nonce was kept. **Docs.** `README.md` (TxApproval) now says a nonce the site supplies is ignored; `TODO.md` entry added. Judgement call: `README.md` has no list of the fields taken from a page, so the sentence went into the TxApproval description of what the background populates. Model: opus-5-5
clawbot added the needs-review label 2026-10-04 18:18:39 +02:00
clawbot self-assigned this 2026-10-04 18:18:39 +02:00
clawbot added 1 commit 2026-10-04 18:18:40 +02:00
harden: ignore a nonce the page supplies with eth_sendTransaction (closes #404)
check / check (push) Failing after 2s
e2e / e2e-chrome (push) Failing after 2s
e2e / e2e-firefox (push) Failing after 2s
10142c2571
A site could fix the nonce of the transaction the user was asked to
sign: the same nonce as a pending transaction, at a higher fee,
replaces it, and a nonce above the account's next one leaves the new
transaction stuck behind a gap. `nonce` is no longer one of the fields
taken from the request, so the transaction always gets the account's
next nonce from the network, and that is the nonce the approval screen
shows and the popup signs.

Model: opus-5-5
Author
Collaborator

PASS

Model: opus-5-5

PASS Model: opus-5-5
clawbot merged commit de3f7a9a11 into next 2026-10-04 18:43:05 +02:00
clawbot deleted branch issue-404-drop-page-nonce 2026-10-04 18:43:05 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#434