Skip to content

feat(app-ui): open an app page once from a one-time launch link - #1

Merged
zackleman merged 5 commits into
selfhost/beta.66-frame-ancestorsfrom
selfhost/beta.66-app-launch
Nov 27, 2026
Merged

zackleman merged 5 commits into
selfhost/beta.66-frame-ancestorsfrom
selfhost/beta.66-app-launch

Conversation

@zackleman

@zackleman zackleman commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Adds appUi.launch: a one-time link that opens a private app page signed in, for a browser that has no Executor session, such as an embedded web view or a fresh browser profile. Today such a browser can only reach an app page through dashboard sign-in, which some sign-in providers refuse inside embedded web views.

What it does

  • POST /api/organizations/:organization/apps/:app/ui/launch returns the same answer as appUi.location. In code mode it's tools.executor.appUi.launch({ path: { organization, app } }). When the page is ready, url is https://<app origin>/_executor/auth/launch?code=<64 hex>.
  • Opening that URL with a top-level GET consumes the code, sets the usual app session cookie (__Host-executor_app, HttpOnly, Secure, SameSite=Lax, Path=/) and redirects to /.
    • A spent, expired, unknown or other app's code gets the existing "Could not sign in to this app" page and no cookie.
    • A HEAD, a prefetch (Sec-Purpose or Purpose), or a browser subresource or frame request (Sec-Fetch-Dest other than document) gets 405 and leaves the code unspent.
    • A browser that already holds an app session that may still open this app keeps it: the link redirects to / without being spent. So a link someone else sends can't swap whose page the browser shows.
  • The link makes the same checks as opening the app: membership, the app's use access, and a token's data action and app scope. It works once and expires after 60 seconds. Only the SHA-256 digest of the code is stored, in the Better Auth verification table the app sign-in records already use. Telemetry records paths only, so the code never reaches a span.

Who may launch, and for how long

  • Only a browser session or an API key may launch. An OAuth token gets 403. A grant's authority can narrow and its tokens can lapse after the page opens, with no row an app request could recheck.
  • An agent connected over MCP launches through the Executor app, which calls with its own managed API key.
  • A launched session records its parent, the dashboard session or the API key, and ends when that parent is revoked, disabled or expired. Either way it lasts at most an hour. That covers a key that outlives the agent's grant.
  • Dashboard sign-ins keep their week.
  • Existing session records still decode: a dashboard parent stays a bare session ID.

The link is a bearer credential for its 60 seconds: whoever opens it first is signed in as the caller. The tool description says to treat it as a password.

Tests

Both new scenarios in e2e/tests/app-ui-launch.spec.ts pass on self-host. The first gets the link through MCP code mode from an OAuth-connected client.

The existing app-page scenarios also pass: app-ui.spec.ts (9), app-ui-failures.spec.ts (2), app-ui-frame-ancestors.spec.ts, and the private app access scenario in resource-access.spec.ts.

Each new guard was disabled in turn, and its assertion failed:

  • OAuth refusal
  • HEAD and prefetch
  • signed-in browser
  • the hour cap
  • reusable code
  • ten-minute expiry
  • no key check
  • no app match

bun run check passes, 17 of 17. The image tag moves to 2.0.0-beta.66-frame.3.

Reviewed with sol-loop: 4 rounds with gpt-6.2-sol. Sol verdict: approved

🤖 Generated with Claude Code

Add `appUi.launch` (POST /api/organizations/:organization/apps/:app/ui/launch).
It answers as `appUi.location` does, and when the page is ready its URL is a
one-time link on the app's origin, `/_executor/auth/launch?code=...`. Opening
it in a browser with no Executor session, such as an embedded web view, signs
that browser in to the one app and redirects to its root.

The link makes the same checks as opening the app (membership, the app's
`use` access, a token's `data` action and app scope), works once, expires
after 60 seconds, and is kept only as the digest of its code in Better Auth's
verification store. Its session is the usual app-origin session (HttpOnly,
SameSite=Lax, `__Host-` and Secure on HTTPS, at most a week) and ends with the
credential that asked for it: a dashboard session as before, or an API key or
OAuth grant, checked on every use like a session's parent login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T01:34:06.710883Z 1cb7a3d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70db459d0b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

zackleman and others added 4 commits November 26, 2026 13:06
…t by previews

An OAuth grant's authority can narrow and its tokens lapse with no row an app
request could recheck, so a launch from one is refused rather than leaving a
page session that outlives or outgrows its grant. A HEAD or prefetch leaves the
code unspent, and a browser already signed in to the app keeps its session.

Release-note: Feature: Self-host can open a private app page in a browser with no Executor session through a one-time launch link from the appUi.launch operation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p logins

A browser's subresource or frame request leaves a launch link unspent, and a
browser counts as signed in to the app only while its session may still open
it. The launch scenario now asks for the link through an OAuth-connected MCP
client, as an agent does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An agent can launch through the Executor app's own key, which outlives the
agent's grant, so a launched page's session lasts an hour, not a signed-in
week. Dashboard sign-ins are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zackleman
zackleman merged commit 7b09e97 into selfhost/beta.66-frame-ancestors Nov 27, 2026
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