Repository navigation
fix(auth): keep a fixed Keychain service for every KeychainLocalStorage - #1394
Conversation
#1208 changed the default service from the fixed `supabase.gotrue.swift` to `Bundle.main.bundleIdentifier`, with a probe-copy-delete migration from the old location. Inside an app extension the bundle identifier is the extension's, so an app and its widget resolved to different services even with a shared access group. Both then raced to migrate the one legacy item, and the loser was signed out. The service is a namespace, not an isolation boundary. Isolation between unrelated apps comes from the access group, and on macOS from the data-protection Keychain, which the same PR made available. So the default service goes back to the fixed constant for every caller. The query is byte-for-byte the one v2 issued, so v2 sessions are read in place and no migration runs. The only remaining legacy probe is the file-based macOS location after opting into the data-protection Keychain, where both targets share one destination and one source, so the first reader's migration serves the second. Deletes the bundle-identifier configuration helpers and the migration guide entry that described them. Fixes SDK-1483
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe default Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to The change gives every target the same default Keychain service, so app extensions and their containing apps read one shared session location. Existing v2 sessions stay readable in place. No concrete merge-blocking risk was found. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The fixed service restores consistent session sharing without changing the configured access controls. However, the remaining macOS migration can race with another target’s sign-in or sign-out and restore an older credential into the newly shared destination. Exposure is limited to targets already authorized to access that storage. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
|
|
Coverage Report for CI Build 36658902579Coverage decreased (-0.07%) to 89.502%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions6 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
|
The following capabilities are marked
The following capabilities are marked
These may have been renamed, removed, or never registered. Please update the capability matrix. |
Why
#1208 changed
KeychainLocalStorage's default service from the fixedsupabase.gotrue.swifttoBundle.main.bundleIdentifier, with a probe-copy-delete migration from the old location. Inside an app extension the bundle identifier is the extension's, so an app and its widget resolved to different services even with a shared access group. Both then raced to migrate the one legacy item, and the loser was silently signed out. Deferred in #1208 review, tracked as SDK-1483.A survey of Firebase, Auth0, Amplify, Clerk, Stytch, and KeychainAccess found no auth SDK that derives its service from the bundle identifier and then migrates. Dedicated auth stores use a fixed, SDK-owned service; Amplify hit this exact widget sign-out bug.
What
supabase.gotrue.swiftfor every caller. The service is a namespace, not an isolation boundary: isolation between unrelated apps comes from the access group, and on macOS from the data-protection Keychain that fix(auth)!: fix macOS Keychain consent prompt and storage contract #1208 made available.KeychainConfiguration,primaryConfiguration,legacyConfigurations, and the migration-guide section about the bundle-identifier service. DocC on both initializers states what an access group does and does not share.Tests
defaultServiceIsFixedWithoutAccessGroupanddefaultServiceIsFixedAndSharedAcrossTargetspin the fixed service.dataProtectionProbesFileBasedLocationWithSameServiceAndGrouppins the one remaining probe.sharedTargetsMigrateOnceIntoOneLocationcovers two targets reading one legacy item through one destination.swift-format lint --strictand cSpell are clean.Fixes SDK-1483