Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

trunk-merge/pr-3645/b3878270-5d46-4a85-b017-236f0b9f9643 - #3685

Closed
trunk-io[bot] wants to merge 5 commits into
mainfrom
trunk-merge/pr-3645/b3878270-5d46-4a85-b017-236f0b9f9643
Closed

trunk-merge/pr-3645/b3878270-5d46-4a85-b017-236f0b9f9643#3685
trunk-io[bot] wants to merge 5 commits into
mainfrom
trunk-merge/pr-3645/b3878270-5d46-4a85-b017-236f0b9f9643

Conversation

@trunk-io

@trunk-io trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown
Trunk Merge Pull Request Banner

This pull request was created and is being managed by Trunk Merge.

This pull request is based on the main branch at SHA 7f1dbba0c29cc3dc25291cfd4557d1409337fd86.

See more details here.

When CI completes, this pull request will be closed automatically.

Pull Requests Being Tested

This pull request is testing the changes from pull request 3645.

k11kirky and others added 5 commits July 21, 2026 18:49
Generated-By: PostHog Code
Task-Id: 2734dc0c-3cac-44d9-bc73-c86e58685df1
… broker

Address review findings on the open-external path:

- New isSafePostHogUrl in @posthog/shared: only absolute https posthog.com
  (or subdomain) URLs may leave the canvas sandbox. Enforced in the Zod
  message schema (safe for every consumer by construction) and re-checked
  in the FreeformCanvas handler with the blocked URL logged.
- Rate-limit successful opens host-side: canvas code can post open-external
  without a user gesture, so opens are throttled to one per second.
- Rewrite the sandbox click interceptor as an exported, unit-tested
  resolveExternalAnchorUrl inlined into the bootstrap: reads the href
  attribute (fixes SVG anchors and relative hrefs resolving against the
  host base URL), matches _blank case-insensitively, brokers absolute URLs
  only, listens in capture phase (immune to stopPropagation) and defers
  the open a tick so a canvas preventDefault() is honored.
- Replace source-string test assertions with behavioral tests, and cover
  the message path (allowlist, rejection, throttle) in FreeformCanvas.

Generated-By: PostHog Code
Task-Id: b3fd12d3-df9b-416d-a660-0dc12ad82803
Addresses the veria-ai review finding: canvas code could call
ph.openExternal during module evaluation or an effect, opening URLs as
soon as a viewer loads the canvas (including dashboard thumbnails, which
render without any click).

The host can't observe gestures inside the null-origin iframe, but a real
link click moves focus into it, so the open-external handler now ignores
requests while the canvas iframe is not the focused element. Combined
with the PostHog-only allowlist and the per-second throttle, load-time
auto-opens are dropped.

Generated-By: PostHog Code
Task-Id: b3fd12d3-df9b-416d-a660-0dc12ad82803
Generated-By: PostHog Code
Task-Id: b3fd12d3-df9b-416d-a660-0dc12ad82803
@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 62fc9e3.

@trunk-io trunk-io Bot closed this Jul 22, 2026
@trunk-io
trunk-io Bot deleted the trunk-merge/pr-3645/b3878270-5d46-4a85-b017-236f0b9f9643 branch July 22, 2026 10:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant