#353

Approve every new OAuth client on the iPhone

OpenZhehanZhangopened 8d ago

What you want to do

Approve on my iPhone every time a new agent or client signs in to my relay connector, so that holding the connector URL alone is never enough to reach my phone.

What happens today

The relay (deploy/cf-relay/worker.js) asks the phone for consent only when the client's redirect is unknown. Consent is skipped for loopback redirects (http://127.0.0.1, http://localhost), app schemes, and a built-in list of known hosts. Anyone who has a connector URL can register a loopback redirect and complete the sign-in without the owner seeing anything.

The known host list also matches by domain, and several entries host content written by their users (for example google.com, github.com, n8n.cloud, zapier.com, make.com, huggingface.co).

Refresh tokens last 30 days and are not rotated. The only way to revoke one is to revoke the connector secret.

The phone already has the prompt for this (AppModel.askToConnect, "Allow … to connect?"). It is only shown for clients outside the list.

Area

Connection (USB, LAN, Tailscale, relay)

Proposal

  • Ask on the phone for every new client registration, whatever its redirect. Show the client name, the redirect, and the connector, as the prompt does today. A setting could keep the current behaviour for people who want it.
  • Remember an approved client on the phone, so the same client does not ask again, and list approved clients in Settings › Agents with a way to remove one.
  • If a known list stays, match exact callback URLs, not whole domains.
  • Rotate refresh tokens on use, and let removing a client on the phone end its tokens without replacing the connector secret.

The relay stays a thin, stateless forwarder under this proposal. The approved client list lives on the phone, which already answers the relay's consent question.

Activity

2
ScottH11227d ago

Thanks for spelling out the consent boundary and the follow-up client-management needs. I opened #373 for the first, independently testable part: every new OAuth authorization now waits for explicit approval on the connected phone, regardless of callback host, loopback address, app scheme or REDIRECT_HOSTS. A refusal or unanswered prompt issues no code.

All 16 relay tests pass locally in workerd/Miniflare, including allow/deny cases across seven callback types, waiting for the phone, timeout refusal and the configured-host case. The Worker dry-run build also passes, and the checked-in bundle and deployment notes are updated. All four PR checks also pass. I have not deployed it or tested a real phone prompt/client reconnect.

This leaves the issue open: remembered clients, per-client revocation and refresh-token rotation are not included, and already-issued tokens retain their current behavior. Maintainer deployment and a real-client retest are still needed. Thanks again for the clear proposal; I am happy to follow through on the review and remaining integration questions.

JosssphZhou7d ago

Thanks for raising this, and for splitting the first part out as #373.

Status: #373 (every new OAuth authorization waits for explicit approval on the connected iPhone) is approved on review. It is now being checked here, with the relay and Poki Setup tests and the phone prompt on a real device, and it will be merged after that passes. The relay deployment stays with us after that, so the change is not live until we deploy it.

This issue stays open for the remaining parts of the proposal: remembering approved clients with a way to remove them in Settings, per-client revocation, and refresh token rotation. Tokens that were already issued keep their current behavior for now.