Harden layout persistence against poisoned localStorage - #869
Draft
bingenito wants to merge 1 commit into
Draft
Conversation
…F#16) loadLayout replays a layout JSON blob from localStorage on every future session, so a one-shot XSS that plants a malicious desktopJS-layouts entry keeps firing on reload. Close that off: - sanitizeUrl rejects non-http(s)/relative schemes (javascript:, data:, etc.) on persisted window urls before createWindow is called (F#14). - Layout JSON is parsed with a reviver that strips __proto__/constructor/ prototype keys, closing the Object.assign(window.options, ...) prototype-pollution gadget, and malformed/missing storage no longer throws out of getLayoutFromStorage/getLayouts (F#13). - ContainerBase.storage is now set via an overridable constructor parameter instead of being hard-bound to window.localStorage (F#16). F#03 (Object.assign smuggling arbitrary createWindow option keys) is intentionally not addressed here: createWindow is a thin pass-through shim in both remaining containers (window.open features string / fin.desktop.Window options), so smuggled keys carry no more privilege than a caller already has by calling createWindow/window.open directly. The one option key that did escalate privilege, Electron's webPreferences, is removed along with the rest of the Electron package. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #869 +/- ##
==========================================
+ Coverage 74.03% 74.36% +0.32%
==========================================
Files 16 16
Lines 1510 1529 +19
Branches 318 324 +6
==========================================
+ Hits 1118 1137 +19
+ Misses 392 386 -6
- Partials 0 6 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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
loadLayoutreplays a layout JSON blob fromlocalStorageon every future session, so a one-shot XSS that plants a maliciousdesktopJS-layoutsentry keeps firing on reload. This closes that off inContainerBase: