Remove private key export handler and gate three message handlers #44

Open
AFDudley wants to merge 1 commits from afdudley/remove-pk-export-gate-handlers AGit into main
pull from: afdudley/remove-pk-export-gate-handlers
Owner

Deletes the REQUEST_ACCOUNT_PK handler, which sent the raw private key to any origin with no approval. Adds the REACT_APP_ALLOWED_URLS origin check to REQUEST_WALLET_ACCOUNTS, REQUEST_TX, and CHECK_BALANCE. Local dev-build test: key request gets no reply from any origin; wallet-accounts request gets no reply from a disallowed origin and a correct reply from the allowed origin. eslint and tsc pass. See the commit message for details.

Deletes the REQUEST_ACCOUNT_PK handler, which sent the raw private key to any origin with no approval. Adds the REACT_APP_ALLOWED_URLS origin check to REQUEST_WALLET_ACCOUNTS, REQUEST_TX, and CHECK_BALANCE. Local dev-build test: key request gets no reply from any origin; wallet-accounts request gets no reply from a disallowed origin and a correct reply from the allowed origin. eslint and tsc pass. See the commit message for details.
AFDudley added 1 commit 2026-11-15 20:30:34 +00:00
The REQUEST_ACCOUNT_PK handler (src/hooks/useExportPrivateKeyEmbed.ts)
sent the raw private key to any window that posted the message. It had
no origin check and no user approval. App.tsx mounted it on every route.
This commit deletes the hook and its two message constants.

Three other handlers had no origin check: REQUEST_WALLET_ACCOUNTS and
REQUEST_TX (WalletEmbed.tsx) and CHECK_BALANCE (App.tsx). This commit
adds the REACT_APP_ALLOWED_URLS check that the six other handlers use.

Local test on a dev build with REACT_APP_ALLOWED_URLS set to one origin:
- REQUEST_ACCOUNT_PK from an allowed and a disallowed origin: no reply.
- REQUEST_WALLET_ACCOUNTS from a disallowed origin: no reply.
- REQUEST_WALLET_ACCOUNTS from the allowed origin: reply with the address.
eslint and tsc --noEmit pass.
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin refs/pull/44/head:afdudley/remove-pk-export-gate-handlers
git checkout afdudley/remove-pk-export-gate-handlers
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LaconicNetwork/laconic-wallet-web#44