Repository navigation
fix(security): accept extensionEvent only from window.parent - #65
pritesh-jain-cstk wants to merge 3 commits into
Conversation
MKT-22139. post-robot.on without a window option accepts the message from any window and origin, so a sibling iframe could forge entrySave, entryChange and other host events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
MKT-22139. So the spec fails on its assertion, not on post-robot's duplicate-listener error, when the fix is missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
MKT-22139. Delivers a post-robot request message from the (mocked) parent and from a sibling frame; only the parent's entrySave reaches onSave. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Branch graph
Epic MKT-21682. This PR is highlighted. Only [Routine] depends on [Tests]; the rest are independent.
Merge order: #68 before #69 (#69 is based on #68). #64 and #69 both change
package.jsonandpackage-lock.json: merge #64 first, then bringmasterinto #69 with a merge (no rebase) and regenerate the lock withnpm install --legacy-peer-deps(expect a lock conflict). #65, #66, #67 and #70 are independent.What
Jira: MKT-22139
Consumer impact (runtime, bug fix):
extensionEventmessages are now accepted only fromwindow.parent. Messages on that channel from any other window (a sibling extension iframe, a popup) are ignored. No exported name or method signature changes.lib/extension.jscalledpostRobot.on('extensionEvent', handler)with nowindow/domainoption. post-robot 8.0.29 then accepts the message from any window and origin (node_modules/post-robot/src/public/server.js:domain || WILDCARD,windowundefined). Any frame that can reach the extension (a sibling viawindow.parent.frames[i]) could send a fakeentrySave/entryChange/entryPublish/dashboardResize/extensionFieldChangeand run the extension'sonSave/onChange/... callbacks with chosen data. Same flaw as app-sdk MKT-22128 (fix(security): accept host events only from window.parent app-sdk#193).{ window: window.parent }on that listener (the onlypostRobot.oninlib/).test/hostOnlyEventsSpec.js. Karma runs specs in an iframe; the spec replaces thewindow.parentgetter with a separate frame's window and asserts, in post-robot's own listener registry, that the listener is registered for that window and not for a sibling frame or the wildcard. A second spec delivers a post-robot request message (the form post-robot's ownmessagelistener receives) from the mocked parent and from a sibling frame: only the parent'sentrySavereachesonSave. Both specs fail without the fix and with{ window }.extensionEvent(entrySave, entryChange, entryPublish, entryUnPublish, extensionFieldChange, dashboardResize) is sent from the extension's parent window. Checked: UI-Reactdashboard/utils/helper.tssendsdashboardResizewithpostRobot.send(iframe.contentWindow, ...)from the page that holds the iframe, and builds its init listener/client with{ window: iframe.contentWindow }. The senders of the entry events were not found by code search, so they are inferred. If any of them is sent from another frame, this fix would drop it.npm ci+npm test) failed and publish was skipped, so npm still serves 2.2.3. The run logs have expired; master's 5 failing specs (fixed by the [Tests] PR) would fail that job, but a Node 16 install problem is not ruled out.Readiness items
Security Bug found in the fix track (MKT-22139)
Commands (exit codes, Node 24 locally)
npm cinpm ci --legacy-peer-depsnpm run buildlint / typechecknpm testnpm audit --omit=devCommits went through the repo's hooks (GitGuardian pre-commit and pre-push); none bypassed. Local Snyk cannot authenticate (org permission / 401), so the PR's Snyk checks are the scan.
CI:
security-licensefails here as onmaster: it requires the current year inLICENSE(still 2019-2025). Fixed by #64 (DX-29607), not by this PR. All Snyk, GitGuardian, CodeQL and policy checks pass.🤖 Generated with Claude Code