Repository navigation
feat(passkeys): take passkey origins from web platforms - #14310
Conversation
|
Review complete. 🟡 2 medium 💬 Inline comments (2)
🧹 Nitpicks (1) — 🟢 1 low
The PR implements platform-derived passkey relying parties: the ceremony computes allowed origins from the project's web platforms with a localhost any-port special case, and HTTP actions pass the request
Reviewed commit: 9ee9c60 |
Security rulesNo new WARNING or ERROR findings from security rules. 32 existing findings tracked in
|
🟢 Tier S · Ready to mergePasskey ceremonies now derive allowed origins from a project's web and Apple platforms, with localhost support alongside a production relying party. The passkey policy exposes computed origins and accepts only an RP ID, while Console-configured origins remain supported; the added tests cover the new origin rules and flows.
📂 Walkthrough · 13
Reviewed |
There was a problem hiding this comment.
This PR adds passkey (WebAuthn) support: a ceremony library in packages/auth and src/Appwrite/Auth/Passkey, Account endpoints for passkey registration, sign-in and token challenges that derive allowed origins from the project's web platforms, a project passkey policy endpoint and response model, plus console UI and e2e coverage.
Key findings
- 🟡 Negated
issetguard accepts localhost origins with a path — Ceremony.php:289 - 🟡 Enable dialog PATCH carries over stale origins — EnablePasskeys.tsx:91
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Development servers pick their own port, so a project that trusts localhost should not have to list every one.
Projects already list the hostnames their app runs on as web platforms, so asking for the same origins again in the passkey policy made passkeys the only auth method that needed setup before it could be enabled. Origins in the policy now override the platforms instead of being required, and a localhost web platform gives local development its own relying party without touching the policy.
Native iOS and macOS ceremonies report the relying party ID itself as their origin, which no web platform under it covers.
8d751b7 to
09c30fb
Compare
…low-list Wildcard web platforms such as *.example.com have to work once platforms are the only source of origins. An empty list made the WebAuthn library fall back to matching the RP ID alone.
A second list that overrides the platforms could silently bypass them (a localhost platform still worked past an explicit list), and every web origin that can call Appwrite is already a platform. The policy now takes only the relying party ID; its origins are computed from the platforms so the console and API users see where passkeys work.
The findings that requested changes are resolved. See the summary comment for what is still open.
|
@hansi-codes review |
|
@hansi-codes review — the remaining thread is resolved: the passkey code has never been in any release branch, tag or Cloud tag, so no project can have stored |
The console project's origins come from configuration, and any project that stored origins through the earlier policy API keeps working as it did. Saving the relying party ID no longer drops them.
|
@hansi-codes review |
The findings that requested changes are resolved. See the summary comment for what is still open.
What does this PR do?
Passkeys only worked once the passkey policy had a relying party ID and a hand-typed list of origins, even though the project's web platforms already list the hostnames the app runs on. Of the providers we compared, only Ory asks for both by hand. Supabase, Hanko, Descope and Better Auth derive the relying party ID, and Auth0 and Stytch reuse their existing allowed-domains list for origins.
This PR is the server side. The Console side is #14313, which depends on it.
https://<hostname>). Wildcard platforms count too:*.example.comallows any subdomain, but notexample.comitself. Every web origin that can call Appwrite is already a web platform, so a separate list only added a second source of truth that could bypass the first.rpId.PATCH /project/policies/passkeyno longer acceptsorigins. The policy'soriginsis now read-only and computed from the platforms, so the Console and API users see exactly where passkeys work. Passkeys haven't shipped in any release or SDK yet, so this breaks no one.https://<relying party ID>, which is the origin native iOS and macOS passkey ceremonies report.localhostwithout setup. Alocalhostweb platform gives local development its ownlocalhostrelying party, on any port. The request's origin is now passed intoCeremony::fromProject(), so a request fromlocalhostuses it even when a production domain is configured, and local testing and production no longer compete for the one relying party ID. Requests without an origin (server-side) use the configured relying party._APP_CONSOLE_PASSKEY_ORIGINS, which the API can't change.utopia-php/auth. A portlesshttp://localhostorigin allows any port, a wildcard origin allows subdomains on the default port, and an empty allow-list now fails closed (the WebAuthn library otherwise falls back to matching the relying party ID alone). Origins with a path, query, fragment or credentials are rejected.Out of scope, as follow-ups: Android native passkeys (
android:apk-key-hash:origins need a signing certificate fingerprint on Android platforms), hostingapple-app-site-association/assetlinks.json//.well-known/webauthnfor domains on Appwrite Sites, and recording each passkey's relying party ID so local passkeys stop counting towards the relying party ID lock.Demo
A real WebAuthn registration and sign-in from
http://localhost:5173against this branch (Chrome with a virtual authenticator). The project's relying party ID isexample.com; the request from localhost got thelocalhostrelying party automatically.Test Plan
tests/e2e/Services/Account/PasskeysCustomClientTest.php: 27 tests, including origins from web platforms (and what they reject: sibling subdomains, other ports, http, unrelated platforms), wildcard platforms, the Apple origin, the read-onlyoriginsin the policy, zero-configlocalhost, andlocalhostbeside a production domain.AccountConsolePasskeysTest,PoliciesCustomServerTestandtests/unit/Auth/Passkeypass.packages/authCeremonyTestcovers a portless localhost origin across ports, wildcard origins (subdomains allowed; apex, lookalikes, http, ports and paths rejected), and that a portless origin outside localhost only allows the default port. The new tests fail without the change.bin/monorepo check authpass.Related PRs and Issues
Follow-up to #13983. Console: #14313.
Related: appwrite-labs/cloud#5805