Skip to content

fix: invalidate sandboxed preload code cache when source changes without changing length#51933

Merged
VerteDinde merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-fix-invalidate-sandboxed-preload-code-cache-when-source-changes-without-changing-length-1780977157123
Jun 9, 2026
Merged

fix: invalidate sandboxed preload code cache when source changes without changing length#51933
VerteDinde merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-fix-invalidate-sandboxed-preload-code-cache-when-source-changes-without-changing-length-1780977157123

Conversation

@trop

@trop trop Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #51930

See that PR for details.

Notes: Fixed sandboxed preload scripts running a stale cached version after the script was modified without its file size changing.

…out changing length

V8's CachedData source check hashes only the source length, so a preload
edit that preserves byte length consumed the stale blob and ran the old
bytecode. Bind cache entries to sha256 of the source: the renderer ships
the hash of what it compiled, the browser stores it in the cache entry
and only serves a blob whose hash matches the contents it just read.
Reject cache writes for preload ids not served to the sending frame.

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
@trop trop Bot requested a review from VerteDinde June 9, 2026 03:52
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Jun 9, 2026
@VerteDinde VerteDinde enabled auto-merge (squash) June 9, 2026 04:37
@VerteDinde VerteDinde merged commit 06b2741 into 42-x-y Jun 9, 2026
77 checks passed
@VerteDinde VerteDinde deleted the trop/42-x-y-bp-fix-invalidate-sandboxed-preload-code-cache-when-source-changes-without-changing-length-1780977157123 branch June 9, 2026 05:40
@release-clerk

release-clerk Bot commented Jun 9, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed sandboxed preload scripts running a stale cached version after the script was modified without its file size changing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants