Harden static-event forwarding and DefaultMessageBus - #870
Draft
bingenito wants to merge 1 commit into
Draft
Conversation
EventEmitter's ipc setter re-broadcast any inbound message.eventName/ eventArgs from the shared MessageBus as a local static event, so anyone able to publish on that bus could forge events like "container-layout- saved" with attacker-controlled args (CHAIN-02's entry point). Container and ContainerWindow now register the static event names their scope actually emits via EventEmitter.registerStaticEventNames, and the ipc setter drops anything outside that allowlist and strips __proto__/ constructor/prototype keys from what it does forward (F#05). DefaultMessageBus.publish had two related issues (F#15): it fell back to reading the windows list off window.opener when the current window hadn't yet had its own list set, which trusts whatever the opener (not necessarily created by this container) planted there; and it forwarded a caller-supplied targetOrigin verbatim, so a "*" would broadcast to whatever origin the target window later navigates to. Publish now only uses the windows list the runtime tracks directly on the window, and never honors a wildcard target origin. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #870 +/- ##
==========================================
+ Coverage 74.03% 74.44% +0.40%
==========================================
Files 16 16
Lines 1510 1530 +20
Branches 318 323 +5
==========================================
+ Hits 1118 1139 +21
+ Misses 392 391 -1
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
EventEmitter'sipcsetter re-broadcast any inboundmessage.eventName/eventArgsfrom the shared MessageBus as a local static event, so anyone able to publish on that bus could forge events likecontainer-layout-savedwith attacker-controlled args (CHAIN-02's entry point).Container/ContainerWindownow register the static event names their scope actually emits viaEventEmitter.registerStaticEventNames, and theipcsetter drops anything outside that allowlist and strips__proto__/constructor/prototypekeys from what it does forward.DefaultMessageBus.publishfell back to reading the windows list offwindow.openerwhen the current window hadn't yet had its own list set (trusting whatever the opener planted there), and forwarded a caller-suppliedtargetOriginverbatim (so"*"would broadcast to whatever origin the target window later navigates to).publishnow only uses the windows list the runtime tracks directly on the window, and never honors a wildcard target origin.