Skip to content

ui-server: serve /.well-known/webauthn so one passkey works across an instance's related origins #2564

Closed as not planned

Description

@schlessera

Context

A passkey is bound to one RP ID. One instance can be reachable on two hostnames that share no registrable domain, for example https://ithaca.example and https://penelope-brain.example. Even with WEBAUTHN_RP_ID=ithaca.example, a ceremony from the second origin fails in the browser: an RP ID must equal the page's domain or be a suffix of it. Each hostname therefore needs its own passkeys, and the Security tab badges the other one's as foreign (packages/ui-react/src/components/settings/passkey-list.tsx:65, 170-174).

The server already accepts ceremony origins listed in WEBAUTHN_ORIGINS, and uses WEBAUTHN_RP_ID when set (resolveRp, packages/ui-server/src/middleware/passkeys.ts:180-202; env packages/ui-server/src/config/env.ts:560-570).

WebAuthn Level 3 related origin requests define HTTPS discovery from the RP ID host’s /.well-known/webauthn endpoint. The same specification defines the relatedOrigins client-capability key. This verifies the standard’s shape, not support on any installed browser: the pinned MDN PublicKeyCredential data has no relatedOrigins entry, so recheck each target browser and retain per-host passkeys wherever support is absent or unverified.

Use case needed

Is there a real deployment that serves one instance on two non-sibling hostnames and wants shared passkeys? Without one, close this issue as a documented "no". Per-host passkeys work today.

Decision (maintainer, 2026-11-10): closed as a documented no (not planned). Per-host passkeys are the supported answer: each hostname registers its own passkeys, and resolveRp already accepts the listed WEBAUTHN_ORIGINS. Reopen this issue if a real deployment needs one instance on two hostnames that share no registrable domain; the scope below stays as the plan for that case.

Scope

If the use case is confirmed:

  • When WEBAUTHN_RP_ID is set and WEBAUTHN_ORIGINS is non-empty, ui-server answers GET /.well-known/webauthn with Content-Type: application/json and body { "origins": WEBAUTHN_ORIGINS }. Otherwise it returns 404. The route is public, takes no inputs, and is mounted outside /api and before static serving.
  • Document that the route has to be served on the RP ID's own host, and that browsers without verified related-origin support still need per-host passkeys.
  • Feature detection on the client is informational only. getClientCapabilities().relatedOrigins is the standardized key; verify the installed browser’s actual result before using it to explain the foreign badge.

Out of scope

  • Supporting more than one RP ID per deployment.
  • Changing how resolveRp validates origins.
  • Host-app routing (outside this repo).

Acceptance criteria

  • The use case is recorded on this issue, or the issue is closed as a documented "no".
  • Server test: with both env values set, the route returns exactly { origins } as JSON. With either value unset, it returns 404. A static root does not shadow it. Fails before the change.
  • Cross-origin proof: the browser fetches the well-known file over HTTPS from the RP ID's host, so a keyless loopback test may not be able to show it. Either a real-Chrome runtime test shows a passkey registered on the RP ID origin signing in on the listed origin, or the PR explains why that is impossible and records a manual check on two HTTPS hostnames.
  • docs/http-api.md and the WEBAUTHN_ORIGINS env description document the route and the per-host fallback for unsupported browsers.

Verification

bun run test packages/ui-server/tests/passkeys.test.ts
bun run test packages/ui-react/tests/passkey-login-runtime.test.ts   # BRAIN_REQUIRE_CHROME=1
bun run test
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit. Additive: one new public route.
  • This changes a published package's behaviour, so it needs a changeset.

2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: verified the RP/origin resolver and refreshed its source range. No request or observation supplies the deliberately missing related-origin workflow; retain needs: use-case, p3, contract and native #2554 parent. The documented no remains a maintainer outcome, not an automatic closure; no new route or cross-origin capability is approved.

2026-10-24 triage at main af6300478a07379178bd30221a31c0b917df2283: Corrected the environment pointer to the actual WEBAUTHN_RP_ID and WEBAUTHN_ORIGINS declarations. The requested related-origin workflow still awaits a driving use case; no new demand, rollout or readiness is inferred.

2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Verified moved current-source anchors and refreshed navigation; historical receipts and unresolved prerequisites retain their identities. No new runtime proof is claimed.

2026-11-02 triage at main a84d9bfbcb4e608b504aa0a9feb1144ad9a0b77e: Reverified the RP/origin environment owners and the standards-defined endpoint/capability key. Removed an unqualified browser-support assertion; no cross-origin browser execution or driving use case is supplied. Preserve needs: use-case, p3 and contract.

Triage 2026-11-09 at main fb999b8ba: moved the WEBAUTHN_RP_ID/WEBAUTHN_ORIGINS declaration range. No public request for related-origin passkeys has appeared, so needs: use-case stands.

2026-11-10: closed as a documented no by maintainer ruling. Per-host passkeys are the fallback; reopen on a real two-hostname deployment.

Activity

  1. added
    type: feat
    area: ui-server
    priority: p3
    needs: use-case
    contract
    on Oct 22, 2026
  2. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: verified the RP/origin resolver and refreshed its source range. No request or observation supplies the deliberately missing related-origin workflow; retain needs: use-case, p3, contract and native #2554 parent. The documented no remains a maintainer outcome, not an automatic closure; no new route or cross-origin capability is approved.

  3. schlessera commented on Oct 24, 2026

    @schlessera
    OwnerAuthor

    2026-10-24 triage at main af6300478a07379178bd30221a31c0b917df2283: Corrected the environment pointer to the actual WEBAUTHN_RP_ID and WEBAUTHN_ORIGINS declarations. The requested related-origin workflow still awaits a driving use case; no new demand, rollout or readiness is inferred.

  4. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Verified moved current-source anchors and refreshed navigation; historical receipts and unresolved prerequisites retain their identities. No new runtime proof is claimed.

  5. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: refreshed the moved env pointer (WEBAUTHN_RP_ID/WEBAUTHN_ORIGINS now env.ts:560-570, moved by #3822). Still no public request, observation or deployment requirement for one instance served on two non-sibling hostnames, so needs: use-case and p3 stand; the close-as-documented-no outcome remains a maintainer call.

  6. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-10): close as a documented no (not planned).

    Per-host passkeys are the supported answer. Each hostname an instance is served on registers its own passkeys, which works on every browser today. The Security tab's foreign badge (packages/ui-react/src/components/settings/passkey-list.tsx:65) marks a passkey from the other hostname. No request, observation or deployment needs shared passkeys across two hostnames that share no registrable domain. Browser support for related-origin requests is also unverified.

    Reopen this issue if such a deployment appears. The body keeps the /.well-known/webauthn scope and acceptance criteria as the plan for that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ui-servercontractneeds: use-casepriority: p3type: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions