Skip to content

Route every lazy keym-v2 and Shamir import through its typed loader - #212

Open
404SecNotFound wants to merge 2 commits into
mainfrom
claude/serene-carson-0739mv
Open

404SecNotFound wants to merge 2 commits into
mainfrom
claude/serene-carson-0739mv

Conversation

@404SecNotFound

Copy link
Copy Markdown
Owner

Re-targets the change from #211 at main. #211 was based on #210's branch and closed after #210 merged, so main never received it: loadKeym2 in keymaker-crypto.ts is still unexported there and 21 lazy imports still bypass the typed loaders.

What changes

Finding 6 typed the module-load failure in keymaker-crypto.ts and in addShamirSlotKeym2. Twenty-one other sites still used a bare import(): 16 of keym-v2 and 1 of keym-v2-shamir in encryptor-tool.tsx, and 2 each of keym-v2 in crypto-client.ts (the no-worker fallback) and crypto-worker.ts.

None can fail today. The page imports keym-v2 statically, the fallback's imports run after encryptContainer has loaded it, and the worker is one IIFE bundle. Each would bring back the untyped "wrong password" failure if that stopped being true.

  • loadKeym2 (keymaker-crypto.ts) and loadShamir (keym-v2.ts) are exported and all 21 sites use them.
  • secret-erase-core-test.mjs scans src and fails on any bare import() of either module outside the two loaders, and checks its own pattern against the forms it guards and a type-only import().

Why a source scan

No call can model the failure while the static import is there, so the guard is a source check rather than a runtime test.

Negative controls, each type-checked

  • One bare import put back in crypto-client.ts: fails with 1 offender.
  • The bare Shamir import put back in the page: fails with 1.
  • The three files as they were: fails with 21.

Diff

7 files, +79 / -26. Merges cleanly into main at 2aa0b4b.


Generated by Claude Code

Finding 6 typed the module-load failure in keymaker-crypto.ts and in
addShamirSlotKeym2. Twenty-one other sites still used a bare import():
16 of keym-v2 and 1 of keym-v2-shamir in encryptor-tool.tsx, and 2 each of
keym-v2 in crypto-client.ts (the no-worker fallback) and crypto-worker.ts.

None can fail today. The page imports keym-v2 statically, the fallback's
imports run after encryptContainer has loaded it, and the worker is one IIFE
bundle. Each would bring back the untyped "wrong password" failure if that
stopped being true.

- loadKeym2 (keymaker-crypto.ts) and loadShamir (keym-v2.ts) are exported and
  all 21 sites use them.
- secret-erase-core-test.mjs scans src and fails on any bare import() of either
  module outside the two loaders, and checks its own pattern against the
  forms it guards and a type-only import().

No call can model the failure while the static import is there, so the guard
is a source check. Controls, each type-checked: one bare import back in
crypto-client.ts fails with 1 offender; the bare Shamir import back in the
page fails with 1; the three files as they were fail with 21.

This branch has not been deployed

No deployments
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