Repository navigation
fix(web): derive login keys with bundled noble scrypt, not jsdelivr - #14752
Merged
Merged
Conversation
The web login worker loaded scrypt-js and a Buffer polyfill from cdn.jsdelivr.net at runtime with no integrity check. Web now runs @noble/hashes scrypt in a bundled inline worker, and the common default createKey uses noble on every platform. Keys are unchanged: the new test pins outputs taken from the exact CDN scripts the old worker ran. Fixes #14692 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #14692. The web login worker loaded
scrypt-js@2.0.4and a Buffer polyfill fromcdn.jsdelivr.netwithimportScriptsand no integrity check. If that CDN path served different code, it would see every password typed into web and desktop login.Changes
createKey.worker.ts) that runs@noble/hashesscrypt from the bundle. It still starts from a blob URL like the old worker, so it works the same under the desktop app'saudius://scheme.createAuthServiceon web now gets thiscreateKey. Mobile already passes its native one.createKeyuses noble on every platform (lazy import, so it stays out of the entry chunk).authWorker.tsand theWebWorkerhelper are deleted.Keys are unchanged
I ran the exact
scrypt.min.jsandbuffer.min.jsfiles jsdelivr serves today, called the same way as the old worker, on four inputs (ASCII, theusername:::passwordlookup form, non-ASCII plus emoji, and empty). Their outputs are pinned inhedgehogLib.test.ts, and both the sync and async noble paths match them.One input does behave differently: a password containing an unpaired UTF-16 surrogate. The old Buffer polyfill threw on it (
encodeURIComponentURIError), so those logins never worked before. They now produce a key.Testing
hedgehogLib.test.ts: 25/25 pass, including the existing equivalence test against@audius/hedgehog.vite buildwith prod env. The worker is an 11 KB inline chunk, and nojsdelivrstring is left in the build.packages/libsstill uses@audius/hedgehog, which has the same CDN worker. Neither web nor mobile depends on libs.🤖 Generated with Claude Code