Skip to content

fix(security): accept host events only from window.parent - #193

Draft
pritesh-jain-cstk wants to merge 2 commits into
mainfrom
fix/MKT-22128-host-only-listeners
Draft

pritesh-jain-cstk wants to merge 2 commits into
mainfrom
fix/MKT-22128-host-only-listeners

Conversation

@pritesh-jain-cstk

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

Copy link
Copy Markdown
Contributor

Branch graph

Epic MKT-21672. This PR is highlighted. Only [Routine] depends on [Tests]; the rest are independent.

graph LR
  main --> bug["Bug: host-only listeners MKT-22128"]
  main --> hyg["Security: Dependabot MKT-22129"]
  main --> s191["Snyk axios: existing #191"]
  main --> tests["[Tests] MKT-22130"]
  tests --> ci["[Routine] MKT-22131"]
  main --> docs["[Docs] MKT-22132"]
  style bug fill:#f9d71c,stroke:#333,stroke-width:2px
Loading

What

Jira: MKT-22128

Consumer impact (runtime, bug fix): messages on the extensionEvent and uploadReady_<uid> post-robot channels are now accepted only from window.parent. Messages on those channels from any other window (a sibling app iframe, a popup) are ignored. Nothing else changes: dist/src/**/*.d.ts has no diff between main and this branch, and no exported name, type or signature changes.

  • Bug: src/uiLocation.ts and src/stack/api/asset/index.ts called postRobot.on(name, handler) with no window/domain option. post-robot 8 then accepts the message from any window and origin (node_modules/post-robot/src/public/server.js: domain || WILDCARD, window undefined). Every Marketplace app on a page is a sibling iframe, so any of them could send a fake entrySave/entryChange/contentTypeSave/onError (and so on) to another app and run its onSave/onChange callbacks with chosen data.
  • Confirmed before changing: the host app-extension-component sends both channels from the window that holds the iframe (postRobotConfig.ts: postRobot.client({ window: iframe.contentWindow }); events.tsx: postRobot.send(iframeReference.contentWindow, uploadReady_${uid})). That window is the app's window.parent, the same window that answers init. The host side already scopes its listeners per iframe; the SDK side did not. JSON RTE plugins run in the shared RTE iframe, hosted by UI-React, whose source I could not read: that sender is inferred (wiki app-platform-communication.md, and venus-components JsonRTE/lib/requestModule whose own uploadReady_ listener replies to window.parent). Before merge, check in UI-React that RTE events reach the RTE iframe from its parent; if not, this change would drop them.
  • Fix: { window: window.parent } on both listeners. src/types/post-robot.d.ts (a local ambient declaration, not shipped in dist) gains the options argument that post-robot already accepts, matching its once declaration.
  • Test: __test__/hostOnlyListeners.test.ts (2 tests). jsdom's window.parent is window, so the tests stub the parent getter with a distinct object and assert against it. Mutation check: { window: window } or no option on either listener fails its test.
  • Left alone: the window.parent.postMessage(..., "*") upload post goes to the same parent sendToParent already talks to.

Readiness items

Security Bug found in the fix track (MKT-22128)

Commands (exit codes, Node 24 locally)

Command main this branch
npm ci 0 0
npm run lint 1 (8 warnings, pre-existing) 1 (same 8, none added)
npm run build 0 0
npx tsc --noEmit -p . 0 0
npm test 0 (249 passed) 0 (251 passed)
npm audit --omit=dev 1 (3 High: axios, follow-redirects; fixed by #191) 1 (unchanged)

CI: security-sca fails here as on main: the lock pins axios 1.16.0 (8 High). That is fixed by #191 (MKT-22129 links it), not by this PR. The pre-push hook (npm test) passed on every push; none bypassed. Local Snyk cannot authenticate (SNYK-0005); the PR's Snyk checks are the scan.

🤖 Generated with Claude Code

extensionEvent and uploadReady_<uid> listeners had no window filter, so
post-robot accepted them from any frame, including sibling app iframes.
Scope both to window.parent, the window that holds the app iframe and
the only sender in app-extension-component. The local post-robot typing
gains the options argument that post-robot 8 already accepts.

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 6 2 25 ✅ Passed
🟡 Medium Severity 15 2 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

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

🟠 High Severity - SLA Breached Issues (with fixes)

Showing 6 issue(s) that have exceeded the 30-day SLA threshold:

  1. Server-side Request Forgery (SSRF)

    • ID: SNYK-JS-AXIOS-20245060
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 7
    • CVE: CVE-2026-101898
  2. Unintended Proxy or Intermediary ('Confused Deputy')

    • ID: SNYK-JS-AXIOS-20245048
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 7.6
    • CVE: CVE-2026-101905
  3. Prototype Pollution

    • ID: SNYK-JS-AXIOS-20245066
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.3
    • CVE: CVE-2026-101909
  4. Improper Validation of Specified Quantity in Input

    • ID: SNYK-JS-AXIOS-20245044
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.2
    • CVE: CVE-2026-101901
  5. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-20245062
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.2
    • CVE: CVE-2026-101906
  6. Improper Validation of Specified Quantity in Input

    • ID: SNYK-JS-AXIOS-20245046
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.2
    • CVE: CVE-2026-101901

🟡 Medium Severity - SLA Breached Issues (with fixes)

Showing 10 issue(s) that have exceeded the 90-day SLA threshold:

  1. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-18065353
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67317
  2. Permissive List of Allowed Inputs

    • ID: SNYK-JS-AXIOS-18065357
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.9
    • CVE: CVE-2026-67315
  3. Uncontrolled Recursion

    • ID: SNYK-JS-AXIOS-18060167
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67313
  4. Prototype Pollution

    • ID: SNYK-JS-AXIOS-18060659
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67314
  5. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-18060804
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67318
  6. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-18060165
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67312
  7. Prototype Pollution

    • ID: SNYK-JS-AXIOS-18065351
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.9
    • CVE: CVE-2026-67320
  8. Uncontrolled Recursion

    • ID: SNYK-JS-AXIOS-18060730
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.9
    • CVE: CVE-2026-67321
  9. Prototype Pollution

    • ID: SNYK-JS-AXIOS-18065349
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67319
  10. Prototype Pollution

  • ID: SNYK-JS-AXIOS-18065355
  • Package: axios@1.16.0
  • Published: 105 days ago (SLA: 90 days)
  • CVSS Score: 6.3
  • CVE: CVE-2026-67316

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 2
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

…T-22128)

jsdom's window.parent is window, so the old assertion also passed with
{ window: window }. Stub the parent getter and assert against the stub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pritesh-jain-cstk pushed a commit that referenced this pull request Nov 4, 2026
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 6 2 25 ✅ Passed
🟡 Medium Severity 15 2 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

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

🟠 High Severity - SLA Breached Issues (with fixes)

Showing 6 issue(s) that have exceeded the 30-day SLA threshold:

  1. Unintended Proxy or Intermediary ('Confused Deputy')

    • ID: SNYK-JS-AXIOS-20245048
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 7.6
    • CVE: CVE-2026-101905
  2. Prototype Pollution

    • ID: SNYK-JS-AXIOS-20245066
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.3
    • CVE: CVE-2026-101909
  3. Improper Validation of Specified Quantity in Input

    • ID: SNYK-JS-AXIOS-20245046
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.2
    • CVE: CVE-2026-101901
  4. Improper Validation of Specified Quantity in Input

    • ID: SNYK-JS-AXIOS-20245044
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.2
    • CVE: CVE-2026-101901
  5. Server-side Request Forgery (SSRF)

    • ID: SNYK-JS-AXIOS-20245060
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 7
    • CVE: CVE-2026-101898
  6. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-20245062
    • Package: axios@1.16.0
    • Published: 35 days ago (SLA: 30 days)
    • CVSS Score: 8.2
    • CVE: CVE-2026-101906

🟡 Medium Severity - SLA Breached Issues (with fixes)

Showing 10 issue(s) that have exceeded the 90-day SLA threshold:

  1. Prototype Pollution

    • ID: SNYK-JS-AXIOS-18060659
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67314
  2. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-18060804
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67318
  3. Permissive List of Allowed Inputs

    • ID: SNYK-JS-AXIOS-18065357
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.9
    • CVE: CVE-2026-67315
  4. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-18060165
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67312
  5. Uncontrolled Recursion

    • ID: SNYK-JS-AXIOS-18060167
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67313
  6. Prototype Pollution

    • ID: SNYK-JS-AXIOS-18065349
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67319
  7. Uncontrolled Recursion

    • ID: SNYK-JS-AXIOS-18060730
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.9
    • CVE: CVE-2026-67321
  8. Prototype Pollution

    • ID: SNYK-JS-AXIOS-18065351
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.9
    • CVE: CVE-2026-67320
  9. Allocation of Resources Without Limits or Throttling

    • ID: SNYK-JS-AXIOS-18065353
    • Package: axios@1.16.0
    • Published: 105 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-67317
  10. Prototype Pollution

  • ID: SNYK-JS-AXIOS-18065355
  • Package: axios@1.16.0
  • Published: 105 days ago (SLA: 90 days)
  • CVSS Score: 6.3
  • CVE: CVE-2026-67316

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 2
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

pritesh-jain-cstk pushed a commit that referenced this pull request Nov 4, 2026
Drop the internal workflow block, internal wiki links and Jira keys;
known traps stated inline; listener rule links PR #193.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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