Skip to content

fix(security): accept extensionEvent only from window.parent - #65

Draft
pritesh-jain-cstk wants to merge 3 commits into
masterfrom
fix/MKT-22139-host-only-extension-events
Draft

pritesh-jain-cstk wants to merge 3 commits into
masterfrom
fix/MKT-22139-host-only-extension-events

Conversation

@pritesh-jain-cstk

@pritesh-jain-cstk pritesh-jain-cstk commented Nov 4, 2026 •

Copy link
Copy Markdown

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.json and package-lock.json: merge #64 first, then bring master into #69 with a merge (no rebase) and regenerate the lock with npm install --legacy-peer-deps (expect a lock conflict). #65, #66, #67 and #70 are independent.

graph LR
  master --> bug1["Bug: host-only extensionEvent MKT-22139"]
  master --> bug2["Bug: getField console.log MKT-22140"]
  master --> sec["Security: Dependabot MKT-22141"]
  master --> s64["Snyk/audit + LICENSE: existing #64"]
  master --> tests["[Tests] MKT-22142"]
  tests --> ci["[Routine] MKT-22143"]
  master --> docs["[Docs] MKT-22144"]
  style bug1 fill:#f9d71c,stroke:#333,stroke-width:2px
Loading

What

Jira: MKT-22139

Consumer impact (runtime, bug fix): extensionEvent messages are now accepted only from window.parent. Messages on that channel from any other window (a sibling extension iframe, a popup) are ignored. No exported name or method signature changes.

  • Bug: lib/extension.js called postRobot.on('extensionEvent', handler) with no window/domain option. post-robot 8.0.29 then accepts the message from any window and origin (node_modules/post-robot/src/public/server.js: domain || WILDCARD, window undefined). Any frame that can reach the extension (a sibling via window.parent.frames[i]) could send a fake entrySave/entryChange/entryPublish/dashboardResize/extensionFieldChange and run the extension's onSave/onChange/... callbacks with chosen data. Same flaw as app-sdk MKT-22128 (fix(security): accept host events only from window.parent app-sdk#193).
  • Fix: { window: window.parent } on that listener (the only postRobot.on in lib/).
  • Test: test/hostOnlyEventsSpec.js. Karma runs specs in an iframe; the spec replaces the window.parent getter 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 own message listener receives) from the mocked parent and from a sibling frame: only the parent's entrySave reaches onSave. Both specs fail without the fix and with { window }.
  • Merge gate: confirm in the host (UI-React / the legacy extension host) that every extensionEvent (entrySave, entryChange, entryPublish, entryUnPublish, extensionFieldChange, dashboardResize) is sent from the extension's parent window. Checked: UI-React dashboard/utils/helper.ts sends dashboardResize with postRobot.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.
  • Release: the fix reaches customers only through a release that publishes. The last one (2.2.4) never did: its npm-publish build job (Node 16: 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)

Command master this branch
npm ci 1 (ERESOLVE, pre-existing) 1 (same)
npm ci --legacy-peer-deps 0 0
npm run build 0 (26 ESLint warnings) 0 (same)
lint / typecheck n/a (lint runs inside build; plain JS) n/a
npm test 1 (5 failed, 128 passed) 1 (same 5 failed, 129 passed)
npm audit --omit=dev 0 0

Commits 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-license fails here as on master: it requires the current year in LICENSE (still 2019-2025). Fixed by #64 (DX-29607), not by this PR. All Snyk, GitGuardian, CodeQL and policy checks pass.

🤖 Generated with Claude Code

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-io

snyk-io Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ 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>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ 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>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants