iOS: allow configuring the Keychain accessibility of stored credentials (e.g. afterFirstUnlockThisDeviceOnly)

Abierto
#1,735 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
ios, typescript
Área
mobile, security

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

feature request
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 set falls back to SecItemUpdate with only kSecValueData when 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 with SecItemUpdate on kSecAttrAccessible. 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 .afterFirstUnlockThisDeviceOnly over .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 patch of ios/NativeBridge.swift that passes accessibility: .afterFirstUnlockThisDeviceOnly and, once at init, runs a SecItemUpdate over the credentials, dpop_thumbprint and credentials_session_expiry items.
  • credentialsManagerStorageKey changes only the Keychain service, and localAuthenticationOptions adds 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: SecureCredentialsManager already encrypts with a key held in the Android Keystore.
  • The DPoP key is already stored ThisDeviceOnly (SecureEnclaveKeyStore / KeychainKeyStore in Auth0.swift), so this would bring the credentials in line with it.
Lenguaje dominante
TypeScript
Estrellas
553
Forks
244
Merge medio
19 h
PR fusionados (30 d)
39

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de auth0/react-native-auth0

Todos los issues de auth0/react-native-auth0

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.