# Workflow - `git pull` `next` and cut a branch from it — one branch per issue, named `issue--`. Never branch from `main`. - Do the work as one commit whose title ends with ` (closes #N)`, with the `TODO.md` update in that same commit. - Move Next Step to the top of Completed Steps; move the top item of Future Steps into Next Step. - Run `make fmt`, then `make check`. A feature branch may be red; `next` and `main` may not. - Rebase onto current `next` immediately before pushing — other branches land on `next` continuously — and re-run `make check` after resolving, because a clean textual merge can still break the build. - Push the branch and open one PR per issue with base `next`. Never base `main`. - An independent reviewer who did not write the change gates the merge. On a passed review the PR is squash-merged into `next`. - `next` is the branch for the next milestone. It is kept green and mergeable to `main` at any moment, without notice. - `main` receives exactly one PR per milestone, from `next`. Releases are tagged from `main`. # Status pre-1.0, working towards the 1.0.0 milestone. Tagged v0.1.0 on 2026-02-27. The milestone is in flight on `next`; its `next` -> `main` PR is [#190](https://git.eeqj.de/sneak/AutistMask/pulls/190). `make check` verified green on `next` at `e9fa8be` on 2026-08-10, and `make build` produces `dist/chrome/` and `dist/firefox/`, verified against the build's own receipt to be exactly what that build emitted with `DEBUG` compiled off. The backlog lives on the [Gitea tracker](https://git.eeqj.de/sneak/AutistMask/issues), which is authoritative; this file does not duplicate it. Full policy file set present. Real-browser end-to-end suites (`make test-e2e` for Chrome, `make test-e2e-firefox` for Firefox) sit alongside `make check`, which now does static analysis as well as formatting, and `.gitea/workflows/e2e.yml` runs both of them on every push. # Next Step Pre-1.0 security review of the extension (key handling, DEBUG mode policy, RPC input validation) before any 1.0rc tag. Individual filed issues are parts of it, but the review is broader than any of them. # Completed Steps - 2026-08-20: `make build` can no longer hand back a debug build, and `script/verify-build` can no longer be satisfied by bytes the build did not produce ([#309](https://git.eeqj.de/sneak/AutistMask/issues/309)). The verifier used to compute its expectation from `AUTISTMASK_DEBUG` in its own environment, so an operator with that exported who ran the release target got a debug bundle — every wallet it creates carrying the publicly committed test phrase — certified green at exit 0. The expected mode is now the required argument `--expect release|debug`, with no default and nothing read from the environment, and the `Makefile` scrubs the flag from the verifier while deliberately leaving it reaching the compiler, so that shell fails the build loudly instead of quietly getting something other than what it asked for. Provenance was the other half: the check was a marker grep over a file list read back out of `dist/`, so a 26-byte file containing only `autistmask-build-debug=off` verified `ok`, `manifest.json` and the content script that runs on every page were never read at all, and an entire hand-written `dist/` passed. `build.js` now records every file it emits, with its sha256 and whether it is one of the bundles containing `constants.js`, into a receipt whose path the `Makefile` makes fresh per invocation outside the repo and deletes afterwards; `dist/constants-bundles.txt` is gone, and `dist/` is cleared before a build so it holds only what that build wrote. The standalone `make verify-build` target went with it: re-verifying a `dist/` from the `dist/` itself is the thing that was broken. What this establishes is narrow and stated as such in README.md — `dist/` is byte for byte the output of the `build.js` run that just finished — and it is not signing, which is [#310](https://git.eeqj.de/sneak/AutistMask/issues/310). `script/test-verify-build` grew from 18 cases to 39, including one per demonstrated bypass and the `make -n` read-back that proves the recipes pass the mode as an argument. - 2026-08-20: A hostile ERC-20 symbol no longer renders as live HTML in the popup ([#307](https://git.eeqj.de/sneak/AutistMask/issues/307)). A token symbol is whatever the contract's `symbol()` returns, the block explorer passes it through unfiltered, and `balanceLine()` interpolated it into an `innerHTML` string — so a token with the 1,000 holders the spam filter asks for, airdropped to the victim, could paint a full-viewport cross-origin iframe over the wallet's own UI, on the screens where the user types their password. `escapeHtml` moved to `src/shared/html.js` as a pure string replace over `&`, `<`, `>`, `"` and `'`: the old implementation round-tripped through a detached element's `textContent`, which does not escape quotes, and it was already being used inside `data-copy="..."`. Every interpolation into an `innerHTML` string across `src/popup/views/` was audited, not just the reported one — the transaction lists' direction label, the wallet name and ENS name in the Home list, the `href` in the explorer link, and the confirmation screen's warning line were all unescaped as well. Both manifests now declare `default-src 'self'` with `frame-src 'none'`; the four directives that had to stay looser than `'self'` are named and justified in the Content Security Policy section of README.md, and `tests/manifest.test.js` pins the whole set exactly. A display cap of 12 characters bounds the symbol, matching the bound `lookupTokenInfo()` already applied on the contract-read path. Not repurposed for any of this: `isSpoofedSymbol()`, which answers a different question and would have been the wrong control. - 2026-08-20: A page asking which chain the wallet is on is told the chain the user is actually on ([#317](https://git.eeqj.de/sneak/AutistMask/issues/317)). `eth_chainId` and `net_version` answered from `currentNetwork()`, which reads the module-level `state` singleton that nothing populates at module scope, so a service worker revived by the page's own message answered out of `DEFAULT_STATE` and reported mainnet `0x1`/`1` to a user on Sepolia — a dApp building its interaction for the wrong chain. Both now answer from `getState()`, the per-call detached storage read the other read handlers use, rather than from the singleton: these two are reachable by any page on every provider init, and mutating the shared singleton on that path would detach the wallet objects an in-flight `backgroundRefresh()` is mutating. The read side of the background was audited with it: the remaining singleton reads are the chain switch, the transaction verification path and `backgroundRefresh`, which each already load, and everything else answers from storage per call through `getState()`. One stale read is left named but unfixed, outside this issue's scope: `handleSendTransaction` builds its provider with no network name, so `getProvider()` falls back to the same unloaded singleton for ethers' static network hint. - 2026-08-20: The dApp approval screen no longer shows a token transfer it cannot scale as `0.0000` ([#306](https://git.eeqj.de/sneak/AutistMask/issues/306)). `decodeCalldata` read decimals from the 512-entry bundled token list alone and fell back to 18, so every token outside it — most of them, including anything the user added by contract address — was displayed at the wrong scale: a `transfer` of 5,000 units of a 6-decimal token read as `0.0000`, and a user who reads zero confirms the drain. The new `src/shared/approvalAmount.js` resolves the scale from the bundled list, then `state.trackedTokens`, then the decimals the block explorer already reported in `addr.tokenBalances`, and refuses one the explorer's own entries disagree about. Where no source knows it, the amount line is not formatted at all: it shows the base-unit integer and states that the scale is unknown, for `approve` as well as `transfer`. An unbounded allowance still reads `Unlimited`, which needs no scale. - 2026-08-20: A web page can no longer switch the wallet's chain, and switching no longer destroys the user's endpoints ([#308](https://git.eeqj.de/sneak/AutistMask/issues/308)). `wallet_switchEthereumChain` was answered for any origin at all, with no connection check and no prompt: any page could clear the `[TESTNET]` banner under a user who believed they were on Sepolia. It now takes the same `allowedSites`/`connectedSites` gate the signing methods take, ahead of the same-chain and unsupported-chain answers, and refuses an unconnected origin with `4100`. The switch itself also overwrote `state.rpcUrl` and `state.blockscoutUrl` with the network defaults, so a user running their own node lost that url permanently and silently to a public endpoint that then sees every address they hold. Endpoints are now remembered per network in `state.networkEndpoints`, snapshotted from the network being left and restored for the network being entered; `state.rpcUrl` stays the live value for the active network, so no reader changed. A profile written before the map existed has its stored pair adopted for the network it was stored under, and loses nothing. The handler now loads state before it switches ([#316](https://git.eeqj.de/sneak/AutistMask/issues/316)): the service worker populates nothing at module scope, so a worker revived by the page's own message held `DEFAULT_STATE`, and the switch persisted every field of it — wiping every wallet, every site approval and every tracked token from storage along with the endpoint. - 2026-08-20: The wallet's own ERC-20 send signs the amount it displayed ([#305](https://git.eeqj.de/sneak/AutistMask/issues/305)). The confirmation screen renders from the block explorer's cached decimals; the transfer was encoded from `decimals()` read off the contract at signing time, and nothing compared the two, so a token whose on-chain scale disagreed — an upgradeable or proxy token, a stale explorer entry, a compromised Blockscout — signed an amount that was never on screen, off by a power of ten per decimal place of disagreement. The scale is now carried forward on the pending transaction from the same balance entry the screen's amount, balance and symbol come from, and the contract's answer is read at signing time only to be compared with it: a disagreement is a refusal naming both numbers, never a preference for either (`src/shared/transferAmount.js`, the `confirmTx` counterpart to `approvalVerify.js`). The gas estimate encodes from the same carried value and no longer reads `decimals()` at all. Nothing in the e2e suite had ever clicked `#btn-confirm-send`, which is how this shipped: the popup's own Send → ConfirmTx → Sign & Send → WaitTx path now runs end to end to a broadcast, with the `transfer()` amount decoded out of the raw signed bytes and asserted against what the screen displayed, and a companion case where the contract starts answering a different scale after the screen was built and nothing reaches the RPC. Reverting only the signing-side comparison turns that second case red and leaves the other 53 green. - 2026-08-17: The Settings screen is driven in a browser, and every element id the popup looks up is checked statically. Nothing exercised Settings in the e2e suite, and jest runs with no DOM, so the densest run of `$("...")` lookups in the codebase was unverified at runtime. Seven new cases in `tests/e2e/run.js` reach Settings, assert the About well and the wallet list were actually written, assert the four Token Spam Protection checkboxes are real checkboxes defaulted on, and assert the theme and network selectors offer the choices `src/shared/networks.js` and `index.html` define. The selectors are then driven to `dark` and `sepolia` — neither is the first `