Skip to content

Work identity: acquire and hold the enterprise identity assertion - #1760

Draft
RhysSullivan wants to merge 4 commits into
mainfrom
ema-work-identity
Draft

Work identity: acquire and hold the enterprise identity assertion#1760
RhysSullivan wants to merge 4 commits into
mainfrom
ema-work-identity

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Adds the missing front door for enterprise-managed authorization: a per-user work-identity link (server-side authorization-code exchange against the org's registered IdP client) with refresh-token custody in the credential provider, oauth.start resolving the held identity when the payload omits subjectToken, and a work-identity-dead state distinct from connection-dead so one re-link recovers every managed connection. Explicit-subjectToken callers are unchanged. The rollout gate is consulted exactly once per connect and never by the link flow, pinned by tests.

oauth.start required the caller to supply the identity assertion, and nothing
in the product could obtain one: the IdP client's secret is server-side, so a
browser could not reach the profile at all. Whatever was passed also became the
connection's renewal credential, so an ID token made every renewal past its
first hour fail needs-SSO.

Link the identity once per (owner, IdP app) instead. The link runs the IdP
app's own authorization-code flow through the existing OAuth machinery -- one
oauth_session row, buildAuthorizationUrl, exchangeAuthorizationCode, the shared
callback -- redeems the code server-side, and takes custody of the REFRESH
token (id-jag draft 4.5), falling back to recorded ID-token custody with its
deadline when the IdP issues none.

oauth.start's subjectToken is now optional: omitted, it resolves the held
identity and points the connection's refresh slot at the shared record rather
than copying it. An explicit assertion keeps its private copy and behaves
exactly as before.
The renewal path treated every rejected subject the same: mark the connection
dead and demand a reconnect. For a shared work identity that is wrong twice
over -- the connection lost nothing, and reconnecting N of them fixes nothing
one re-link would not.

Record the rejection on the identity record instead, so every connection behind
it short-circuits before spending its own doomed exchange, and surface it as
workIdentityRelinkRequired. Connections get health only, never the reauth stamp
that a reconnect alone clears, so the next resolve after a re-link succeeds
untouched.
Four routes next to the existing oauth ones: start, complete, a status a
console polls, and unlink. The status is the browser-facing projection of a
credential record, so it carries the account and the custody kind and nothing
that could stand in for the token.

Both browser flows land on the one callback URL an enterprise registers, so the
callback route now asks the in-flight session which flow came back rather than
inferring from the URL. A connection's popup payload is unchanged; a link's is
spread under its own key, since the two objects share field names.
A selfhost scenario runs the whole thing through the product: link via a real
OIDC sign-in, connect with no subjectToken in the payload, call a tool. Both
emulator ledgers carry the proof -- the sign-in, executor's own code redemption,
the exchange and the redemption -- and the MCP server sees no authorize request.

Renewal past ID-token expiry is not asserted here: the Okta emulator's token
lifetimes are compiled-in constants with no seed knob to compress them. That
claim is proven hermetically in the SDK suite instead.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 2b6b7ed Aug 26 2026, 11:45 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 2b6b7ed Commit Preview URL

Branch Preview URL
Aug 26 2026, 11:44 PM

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare preview

Console https://executor-preview-pr-1760.executor-e2e.workers.dev
MCP https://executor-preview-pr-1760.executor-e2e.workers.dev/mcp
Deployed commit 2b6b7ed

Sign-in is Cloudflare Access (one-time PIN to an allowed email). The preview has its own database and encryption key; it is destroyed when this PR closes.

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1760

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1760

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1760

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1760

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1760

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1760

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1760

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1760

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1760

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1760

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1760

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1760

executor

npm i https://pkg.pr.new/executor@1760

commit: 2b6b7ed

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