Repository navigation
Add OS-backed Web Crypto secure random - #178
Merged
Merged
Conversation
This was referenced Sep 19, 2026
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.
Problem and resulting behavior
WebScene implemented
crypto.getRandomValues()withMath.random(), accepted unsupported views and oversized requests, filled wider integer elements with only eight useful bits, and omittedcrypto.randomUUID(). VS Code OSS reaches these APIs for UUIDs, authentication nonces/verifiers, WebSocket material, and extension identifiers.This change installs one native Web Crypto random boundary in window, iframe, and dedicated-worker realms. It uses only the operating-system CSPRNG: bounded
getentropy()calls on Apple/BSD, retryinggetrandom()on Linux, andBCryptGenRandom()with the system-preferred provider on Windows. It has no deterministic or userspace PRNG fallback.getRandomValues()accepts every integer TypedArray including BigInt views, fills the view's exact byte range, preserves identity, enforces the 65,536-byte quota before mutation, and rejects DataView, floating-point views, non-views, detached storage, and illegal receivers with browser-shaped errors.randomUUID()uses the same source and emits canonical lower-case UUIDv4 values.Scope
mainatf8a0df56d89f67648e17e963febcf560f66ea775.30806c32788575c021dba7432719e6b79d8a9ff2.crypto.subtleremains absent pending the provider and CryptoKey design in Provide crypto.subtle through a vetted cross-platform provider #102.Correctness and failure coverage
919108f7-52d1-4320-9bac-f847db4148a8.Performance and validation
git diff --checkand profile JSON validation pass.The retained remote merge gates are the native document contract and precompiled/V8 contract because they compile and execute the changed operating-system/V8 behavior. Package and unrelated product matrices are outside this focused slice.