Skip to content

feat(effects): open a URL in the user's default handler from update - #447

Open
phall1 wants to merge 1 commit into
vercel-labs:mainfrom
phall1:upstream/open-url
Open

phall1 wants to merge 1 commit into
vercel-labs:mainfrom
phall1:upstream/open-url

Conversation

@phall1

@phall1 phall1 commented Sep 19, 2026

Copy link
Copy Markdown

Adds an effect to open a URL in the platform default handler, so an update can do it without dropping to native host code.

@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

`native-sdk.os.openUrl` was a webview bridge command and
`openExternalURLIfAllowed:` a webview external-link policy decision, so a
Zig core with no web content had no way to ask the OS to open a URL —
the platform verb existed on every host (`PlatformServices.openExternalUrl`,
NSWorkspace on macOS) with nothing app-facing wired to it.

`fx.openUrl(url)` closes that. It follows `showNotification`, the
channel's other fire-and-forget platform-service effect: validated on the
loop thread, one synchronous platform call, no terminal Msg (the OS owns
whether a handler launched, so a success Msg would over-promise), inert
under fake execution and session replay.

The URL is treated as hostile, because cores build them from terminal
output, fetch bodies, and pastes. `validation.validateOpenUrl` refuses
whole — never trimmed or coerced into something openable — an empty URL,
one past `platform.max_external_url_bytes`, one carrying a NUL or any
other control byte / whitespace / DEL, and any scheme outside the
allowlist (`http`, `https`, `mailto`, matched case-insensitively so a
shouty scheme is honored and a shouty `JavaScript:` still is not).
`file:` and `javascript:` are refused by not appearing in it.

Unlike `runtime.openExternalUrl`, the effect is not gated on the webview
external-link policy: that policy governs links web content follows,
while this call comes from the app's own `update`.

A test observes it the way the notification effect is observed — bind the
null platform's services and read `lastExternalUrl()`, which records the
request without opening anything; a refused URL leaves it empty.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@phall1
phall1 marked this pull request as ready for review September 20, 2026 05:19

This branch has not been deployed

No deployments
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