Repository navigation
fix(auth): remove the unused Expo server plugin and custom-scheme trusted origins - #764
Merged
Merged
Conversation
…sted origins The installed app signs in through /mobile-auth and a PKCE-bound callback code; nothing calls the Expo authorization proxy or sends expo-origin. The plugin's callback hook would copy the session cookie into any redirect to a trusted custom scheme, so openmapx:// and the development exp:// patterns leave trustedOrigins with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
The API registered Better Auth's Expo server plugin "for compatibility with Expo's redirect handling", but nothing has used it since the Expo auth client was removed in #1. This PR removes the plugin, its
@better-auth/expodependency, and the custom-scheme entries intrustedOriginsthat only Expo-style redirects needed.The installed app (as of #757–#759) signs in like this:
SystemAuthSessionopens/mobile-authin the system browser. Better Auth's own callbacks go to a same-origin path there. The page then returns toopenmapx://auth/callbackitself, with a short-lived code bound to a PKCE verifier the app keeps in memory. Native code calls the API without credentials, and the app's bundle rules keepbetter-authout of native code.The plugin did three things, and none of them is needed:
/expo-authorization-proxy, the endpoint behind GHSA-4wq4-2ppv-q3hg (critical, fixed in 1.7.16 by fix(deps): upgrade Better Auth to 1.7.16 for the 2026-11-03 security release #761). Nothing calls it.expo-originheader intoOriginwhen a request had none. Nothing sends that header, and requests from the WebView carry the web origin.openmapx://trusted, a callback URL on that scheme would have put a working session into a deep link that another Android app can register for. The handoff exists to keep exactly that out of the URL.trustedOriginsis now just the configuredCORS_ORIGINweb origins. Removingopenmapx://(and the development-onlyexp://patterns) means Better Auth rejects callback URLs on those schemes. The web app never sends one: its callbacks are paths or the page origin. Development app builds useopenmapx-dev, which was never listed and works the same way. The OAuth provider plugin's ownisTrustedOriginchecks validate HTTPSjwks_urivalues only.A new policy test asserts there is no
expoplugin and noexpoAuthorizationProxyendpoint, and that every trusted origin is an exact HTTP(S) origin. It fails against the code as merged in #761 and passes here.Verification
pnpm verify:full: lint, workspace types, policy, OpenAPI and all 24,748 portable tests pass.pnpm test:database api-privacy: 27 files and 149 tests pass, includingauth-postgres.test.ts. The run used a disposable PostGIS 18-3.6 container at the CI digest, with the production Drizzle migrations applied first.auth:generatewithauth@1.7.16: the formatted schema matches the committedauth-schema.ts.pnpm install --frozen-lockfilepasses with@better-auth/expogone from both the lockfile and the release-age exemptions./mobile-authon a device or emulator, and browser OAuth and passkey sign-in. The handoff code path does not change, but this PR does not exercise it end to end.Release and upgrade impact
Product impact: ordinary
No migration or configuration change. The auth schema regenerates unchanged, and the OpenAPI document never listed the proxy endpoint.
No package release: this changes only
apps/apiand workspace dependency configuration; neither public package's sources change and neither depends on Better Auth.