Skip to content

fix(files): bind sim-page navigation messages to the preview frame - #10315

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/sim-page-nav-source-check
Nov 22, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/sim-page-nav-source-check

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The file preview panel's `message` listener routed any `{ __simPageNav }` message, whatever window sent it, so a page holding a handle to the Sim tab (e.g. its opener) could trigger an in-app `router.push` or open an arbitrary http(s) tab
  • The listener now ignores messages unless `event.source` is the preview iframe's `contentWindow`. The sandboxed frame's origin is opaque (`'null'`), so binding to its window is the only reliable check
  • The scheme allowlist stays as defense in depth

Type of Change

  • Bug fix

Testing

  • `html-preview-navigation.test.ts`: new regression test mounts `PreviewPanel` and posts handoffs from a foreign window, a `null` source and the host window (all ignored), then from the preview frame (routed). Fails on the pre-fix code, passes with the guard
  • file-viewer test folder (59 files) passes; biome, `check:test-patterns`, `check:comment-hygiene` clean

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the `test-audit` authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 22, 2026 8:15pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR limits navigation messages to the preview iframe and adds a regression test for rejected senders.

  • HTML previews only act on navigation messages from their own frame.

Reviews (2) · Last reviewed commit: "fix(files): pass required props in previ..." · Reviewed by Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 739b957 into staging Nov 22, 2026
78 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/sim-page-nav-source-check branch November 23, 2026 00:04

This branch was previously deployed

1 inactive deployment
Preview — 05a95388 Deployed Nov 22, 2026 by vercel[bot]
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.

1 participant