Skip to content

fix(web): bundle crypto deps into app.js — no runtime CDN loads (#2 review debt) - #20

Merged
Amperstrand merged 1 commit into
mainfrom
sisyphus/vendor-web-crypto
Nov 2, 2026
Merged

Amperstrand merged 1 commit into
mainfrom
sisyphus/vendor-web-crypto

Conversation

@Amperstrand

Copy link
Copy Markdown
Owner

Closes the P1 finding from the Codex review of #2 (inline thread on index.html), verified STILL-ACTIONABLE at current main: the client-side demo resolved @scure/@noble/bech32 at runtime via an import map to esm.sh — anyone deriving from real seed material was exposed to supply-chain compromise or CDN tampering that could alter derivation logic or exfiltrate the seed before derivation runs.

Fix — bundle, don't fetch

  • build:web drops all --external flags: esbuild inlines the crypto deps into web/dist/app.js (181 KB, single origin; versions pinned by package-lock.json — the same ones the CLI and tests use)
  • index.html: the import map is gone
  • scripts/check-web-bundle.mjs guards the invariant inside npm test (CI-enforced): no import map, no external script origins, no --external in build:web, built bundle has zero @scure/@noble/bech32 imports and no CDN references

Verification

  • RED → GREEN: guard fails on main (import map present) → passes after the fix
  • npm test: guard + 53/53 vitest; npm run typecheck clean
  • End-to-end browser QA (demo mnemonic + AcmeCorp path): derivation completes; output is byte-identical to the CLI oracle — path m/83696968'/67797668'/300742085'/1472905663'/816025947', age1n0upp…, AGE-SECRET-KEY-1UKTFS…; performance.getEntriesByType('resource') records zero non-same-origin requests

Separate pre-existing gap (not this PR — workflow change is owner-review-only)

pages.yml uploads the raw checkout with no build step, and web/dist/ is untracked — the deployed Pages demo references ./web/dist/app.js that isn't in the artifact. Filed as an issue for an owner decision.

Audit tracker: Amperstrand/pr-review-audit#98

  • ⏳ CI

…eview debt)

The client-side demo resolved @scure/@noble/bech32 at runtime via an
import map to esm.sh: anyone deriving from real seed material was
exposed to supply-chain compromise or CDN tampering altering
derivation logic or exfiltrating the seed (Codex P1 on #2).

- build:web drops all --external flags: esbuild inlines the crypto
  deps (versions pinned by package-lock.json, same ones the CLI and
  tests use) into web/dist/app.js — 181 KB, single origin
- index.html: the import map is gone
- scripts/check-web-bundle.mjs guards the invariant in npm test: no
  import map, no external script origins, no --external in build:web,
  built bundle contains zero @scure/@noble/bech32 imports and no CDN
  references

Verified end-to-end (demo mnemonic + AcmeCorp path): browser
derivation output is byte-identical to the CLI oracle (path
m/83696968'/67797668'/300742085'/1472905663'/816025947', age1n0upp…,
AGE-SECRET-KEY-1UKTFS…) and performance.getEntriesByType('resource')
records ZERO non-same-origin requests.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-02T18:28:04.800178Z
We couldn’t complete this review. Comment @codex review to try again.
ef6510e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@Amperstrand
Amperstrand merged commit ea97341 into main Nov 2, 2026
2 checks passed
@Amperstrand
Amperstrand deleted the sisyphus/vendor-web-crypto branch November 8, 2026 09:32
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