Skip to content

feat: accept passkeys from Android apps by their signing certificate - #14353

Merged
ChiragAgg5k merged 3 commits into
mainfrom
feat/passkey-android-origins
Oct 12, 2026
Merged

ChiragAgg5k merged 3 commits into
mainfrom
feat/passkey-android-origins

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Passkeys now work in native Android apps.

  Android app                         Appwrite
  (signed with cert X)
       |                                  |
       |  passkey sign-in                 |
       |  origin = android:apk-key-hash:  |
       |           base64url(sha256(X))   |
       |--------------------------------->|
       |                                  |   Android platform
       |                                  |   fingerprints: [ 14:6D:...:44:E5 ]
       |                                  |          |
       |                                  |          v  hex -> bytes -> base64url
       |                                  |   allowed origins:
       |                                  |     https://example.com
       |                                  |     android:apk-key-hash:FG3p...PROU
       |                                  |          |
       |       match -> session           |          v
       |<---------------------------------|   origin in list?
       |       no match -> 401            |

Why it failed before: Android apps don't send a web origin like https://example.com. They send a hash of the certificate the app is signed with. We only allowed web origins and the Apple origin, so every passkey from an Android app was rejected.

What changed:

  • New fingerprints field: Android platforms take an optional list of the app's SHA-256 signing certificate fingerprints, as shown in Play Console or by ./gradlew signingReport. Most apps have more than one: debug, upload and the Play App Signing key.
  • New allowed origins: each fingerprint becomes an allowed passkey origin. It shows up in the passkey policy's origins list, next to the web and Apple ones.
  • Updating a platform: leaving fingerprints out keeps the current list, and an empty list clears it.
  • Validation: fingerprints must be 32 colon-separated hex bytes. They are stored uppercase, without duplicates.
  • Schema: a new fingerprints attribute on the platforms collection, added to the V25 migration.
  • No library change: the WebAuthn library version we use (5.3.9) already matches these origins exactly.

What the developer still does: host /.well-known/assetlinks.json on their domain, listing the app as allowed to use its passkeys. iOS already works this way with apple-app-site-association.

Verified on an Android emulator

An Android 16 emulator ran the real Credential Manager against a local Appwrite built from this branch. The test app is signed with the debug key from Google's identity-samples, and the relying party is project-sesame-426206.appspot.com, whose assetlinks.json already trusts that key. The passkey provider is Google's MyVault sample, which checks those asset links.

Before fingerprints are added: the app gets a challenge and the device creates the passkey, but Appwrite rejects the app's origin.

Device creates the passkey Appwrite rejects the origin
Create passkey sheet Rejected

After the fingerprint 4F:20:47:…:FA:11 is added to the Android platform: the policy's origins include android:apk-key-hash:TyBHH9maupZHjVknwsim6o7SjRTAtqI5mZ-jTUc9-hE, the exact origin the device sends.

Create passkey Registered Choose passkey Signed in
Create passkey sheet Registered Choose passkey Signed in

Test Plan

  • E2E testAndroidAppSignIn: a passkey from the app is rejected until fingerprints are added. After that it signs in from the release build, the debug build and the website. Other signing keys and broken hashes are still rejected. This test fails without the fix.
  • E2E testAndroidPlatformFingerprints: creating and updating fingerprints, keeping or clearing them, uppercasing, removing duplicates and rejecting invalid formats.
  • Unit tests: fingerprint validation, the hash conversion, old react-native-android platforms, and exact origin matching in the library.
  • Passing locally: the passkey, platform, policy and Console passkey suites. Pint, PHPStan and Rector are clean on the changed files.

Follow-ups

  • Console: add a fingerprints field to the Android platform form
  • Cloud: create the platforms.fingerprints attribute before release (appwrite-labs/cloud#6473)

Related: appwrite-labs/cloud#5805

Native Android apps send android:apk-key-hash:<base64url SHA-256 of the signing certificate> as the WebAuthn origin, so passkeys created in an app were rejected. Android platforms now take the SHA-256 fingerprints of their signing certificates, and each becomes an allowed origin on the relying party.
@luxor-code-review

luxor-code-review Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 1 medium

💬 Inline comments (1)


This PR wires Android app signing-certificate fingerprints through the platform lifecycle: the Fingerprint validator normalizes AA:BB:.. hex strings, the Android create/update endpoints accept and persist a fingerprint list, and Ceremony derives android:apk-key-hash: origins from stored fingerprints for passkey authentication.

Files Change
src/Appwrite/Network/Validator/Fingerprint.php, tests/unit/Network/Validators/FingerprintTest.php New colon-separated SHA-256 fingerprint validator plus unit coverage
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/{Create,Update}.php, tests/e2e/Services/Project/PlatformsBase.php Endpoints accept an optional fingerprints array (nullable on update) and e2e helpers updated
app/config/collections/platform.php, src/Appwrite/Migration/Version/V25.php, src/Appwrite/Utopia/Response/Model/PlatformAndroid.php New fingerprints string-array attribute, V25 migration to add it, and response model rule
src/Appwrite/Auth/Passkey/Ceremony.php, packages/auth/tests/Passkeys/CeremonyTest.php, tests/unit/Auth/Passkey/CeremonyTest.php, tests/e2e/Services/Account/PasskeysCustomClientTest.php Ceremony builds Android apk-key-hash origins from fingerprints, with package/unit/e2e test coverage

Reviewed commit: bd49cef

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 12, 2026
@ghost

ghost commented Oct 12, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The incremental change preserves the model's existing required-field behavior and verifies the empty-list default for documents without fingerprints.

Android platforms can now store validated SHA-256 signing-certificate fingerprints, which are converted into Android passkey origins and exposed through platform responses. The PR adds the platform schema and migration, Android platform API handling, and unit and end-to-end coverage for validation, persistence, and passkey origin matching.

Latest changes: The latest commit marks Android fingerprints as required in the response model and adds a regression test confirming legacy platform documents serialize a missing fingerprint list as empty.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 13
File Change
app/config/collections/platform.php Adds the fingerprints attribute to the platforms collection schema.
packages/auth/tests/Passkeys/CeremonyTest.php Tests exact matching for Android app origins in passkey ceremonies.
src/Appwrite/Auth/Passkey/Ceremony.php Derives Android app origins from configured signing-certificate fingerprints.
src/Appwrite/Migration/Version/V25.php Adds migration support for the new platform fingerprints attribute.
src/Appwrite/Network/Validator/Fingerprint.php Validates colon-separated SHA-256 certificate fingerprints.
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Create.php Accepts, normalizes, and stores fingerprints when creating Android platforms.
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Update.php Supports retaining, replacing, and clearing Android platform fingerprints.
src/Appwrite/Utopia/Response/Model/PlatformAndroid.php Includes fingerprints in Android platform responses and declares the field required.
tests/e2e/Services/Account/PasskeysCustomClientTest.php Covers passkey sign-in using configured Android app origins.
tests/e2e/Services/Project/PlatformsBase.php Covers fingerprint API persistence, normalization, and validation.
tests/unit/Auth/Passkey/CeremonyTest.php Tests Android-origin derivation and localhost behavior.
tests/unit/Network/Validators/FingerprintTest.php Tests valid and invalid fingerprint formats.
tests/unit/Utopia/Response/Model/PlatformAndroidTest.php Verifies missing fingerprints on a legacy platform document serialize as an empty list.

Reviewed the commits since bd49cef · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost 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.

🟢 Tier S · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

32 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (17)
  • php.appwrite.permissive-write-permission (8)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@luxor-code-review luxor-code-review 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.

Adds Android SHA-256 certificate fingerprints to platform endpoints, passkey WebAuthn origin derivation, the platform schema with a V25 migration, and a Fingerprint validator with tests.

Key findings

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/passkey-android-origins (after).

Metric Before After Change
🚀 Requests/sec 202.3 204.16 ⚪ +0.9%
⏱️ Latency P50 84.75 ms 86.96 ms ⚪ +2.6%
⏱️ Latency P95 196.55 ms 190.99 ms ⚪ -2.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 86.96 190.99 12,654 204.16 -5.56
Account 161.59 300.81 666 11.08 +26.09
TablesDB 85.71 152.43 6,882 112.33 -11.24
Storage 77.66 160.73 3,330 56.55 -4.98
Functions 119 221.72 1,776 30.92 -1.45

Top API waits (after)

API request Max wait (ms)
account.name.update 462.36
account.prefs.update 416.09
functions.variables.update 356.61
tablesdb.rows.update 356.5
tablesdb.rows.list 328.69

Android platforms created before this attribute have no fingerprints, so the rule is explicitly required to make Response::output() fill in the [] default instead of null.
@ChiragAgg5k
ChiragAgg5k merged commit c3f6868 into main Oct 12, 2026
63 checks passed
abnegate added a commit that referenced this pull request Oct 12, 2026
Brings in Android passkey origins (#14353) and membership delete
events for the removed member (#14210). Ported to database 8.0: the
platforms fingerprints attribute as Attribute::string, and Id in place
of ID in the realtime adapter and the new tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
huangyingting pushed a commit to repomesh/appwrite that referenced this pull request Oct 12, 2026
Passkeys created in an Android app are accepted once its signing certificate fingerprint is on the platform (appwrite#14353). The app drawer edits them, and the passkey preview and origin list show the Android origins.
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