iOS: allow configuring the Keychain accessibility of stored credentials (e.g. afterFirstUnlockThisDeviceOnly)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- ios, typescript
Research direction
Start with ios/NativeBridge.swift and trace how credentialsManagerStorageKey reaches the two SimpleKeychain constructions. Check how the iOS client options are declared and passed through, then inspect the existing credential storage behavior for items saved before a configuration change. Done means an optional iOS accessibility setting reaches both constructions, existing credentials are handled as described, and the default remains .afterFirstUnlock; add or update focused tests and documentation for the recommended setting.
Written by the indexing model from the issue text.
Description
Checklist
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
On iOS, NativeBridge.swift builds the credentials manager with SimpleKeychain(service: key) or the default SimpleKeychain(), with no accessibility argument (lines 71 and 73 on master, unchanged in 5.11.x through 6.2.0). Stored credentials, the refresh token included, therefore get SimpleKeychain's default kSecAttrAccessibleAfterFirstUnlock.
Items in that class move to another device through an encrypted backup restore or Quick Start. React Native apps have no way to choose a …ThisDeviceOnly class. Mobile security assessments (OWASP MASVS-STORAGE) regularly flag a refresh token that isn't bound to the device. Today the only fix is patching ios/NativeBridge.swift.
Describe the ideal solution
An optional, iOS-only client option (for example credentialsManagerKeychainAccessibility, next to credentialsManagerStorageKey), mapped to SimpleKeychain's Accessibility and passed to both SimpleKeychain constructions in NativeBridge.swift. The default stays .afterFirstUnlock, so nothing changes for existing apps.
Two details matter for apps that adopt it:
- Existing installs. SimpleKeychain's
setfalls back toSecItemUpdatewith onlykSecValueDatawhen the item exists, so an item stored before the option was set keeps its old class until the user signs out. Ideally the SDK moves existing items to the configured class in place withSecItemUpdateonkSecAttrAccessible. That is atomic and never signs the user out. (The read query names only service and account, so items stay readable before and after the move.) - Docs. Recommend
.afterFirstUnlockThisDeviceOnlyover.whenUnlocked*, since renewals that run while the device is locked (background tasks, silent pushes) need the item.
Alternatives and current workarounds
- A
patch-package/pnpm patchofios/NativeBridge.swiftthat passesaccessibility: .afterFirstUnlockThisDeviceOnlyand, once at init, runs aSecItemUpdateover thecredentials,dpop_thumbprintandcredentials_session_expiryitems. credentialsManagerStorageKeychanges only the Keychain service, andlocalAuthenticationOptionsadds a biometric prompt. Neither changes the accessibility class.
Additional context
- Checked on 5.11.4, 6.0.0, 6.1.0, 6.2.0 and
master. - Auth0.swift 3.3.0 (
CredentialsManager,storage: CredentialsStorage = SimpleKeychain()) and SimpleKeychain 1.3.0 (accessibility: Accessibility = .afterFirstUnlock) keep the same default. - Android is unaffected:
SecureCredentialsManageralready encrypts with a key held in the Android Keystore. - The DPoP key is already stored
ThisDeviceOnly(SecureEnclaveKeyStore/KeychainKeyStorein Auth0.swift), so this would bring the credentials in line with it.
- Dominant language
- TypeScript
- Stars
- 553
- Forks
- 244
- Avg merge
- 19h
- Merged PRs (30d)
- 39
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/react-native-auth0
-
feature request
Difficulty 5/5 Over a week Newbie friendliness 45/100
auth0/react-native-auth0#1458 · 8 comments · 3 reactions ·
Maintainers usually reply within 1 day
-
Users getting logged out with "Unsuccessful Refresh Token exchange, reused refresh token detected"Possibly taken @subhankarmaiti claimed this 339 days ago. Openbug
auth0/react-native-auth0#1374 · 50 comments · 2 reactions · 1 assignee ·
Maintainers usually reply within 1 day
All issues in auth0/react-native-auth0
Similar issues
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug ready-for-human
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
LucasSantana-Dev/Lucky#3150 ·
Maintainers usually reply within 1 day
-
enhancement good first issue priority: low size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day