Skip to content

[Auth] Shared Keychain Unexpectedly Wiped #4076

@tylerjroach

Description

@tylerjroach

Describe the bug

We've been made aware of a bug where Shared Keychain usage (using accessGroup) can result in wiping credentials.

On a fresh install, we check a UserDefaults key to see if were in a fresh install. If so, we clear the Keychain, which may have data from a previous install.

This causes an issue where a shared keychain that involves multiple apps / extensions have different UserDefaults. A successful sign in on 1 app instance can get wiped during another app/extension's first launch.

Steps To Reproduce

Steps to reproduce the behavior:
1. Configure shared Keychain usage for an app + share extension
2. Sign in on the app
3. Open share extension for the first time

[BUG] Observe the Keychain has been cleared!

Expected behavior

Keychain is not cleared.

Amplify Framework Version

All with Keychain Sharing

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

N/A

CLI version

N/A

Xcode version

N/A

Relevant log output

<details>
<summary>Log Messages</summary>


INSERT LOG MESSAGES HERE

</details>

Is this a regression?

No

Regression additional context

This has been present since accessGroup Keychain sharing was introduced.

Platforms

No response

OS Version

N/A

Device

N/A

Specific to simulators

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending-triageIssue is pending triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions