openid / openid/AppAuth-iOS

Serialisation of AuthState failed

Open
#676 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
2k
Forks
867
Avg merge
4d 48m
Merged PRs (30d)
1

Description

When I try to Serialise The AuthState, it failed during unarchiving.

what I do is:

do { let archivedState = try NSKeyedArchiver.archivedData(withRootObject: state, requiringSecureCoding: true) UserDefaults.standard.set(archivedState, forKey: "SavedAuthSateKey") UserDefaults.standard.synchronize() } catch { print("error while archiving") }
and after when I try to unarchive it:

guard let data = UserDefaults.standard.object(forKey: "SavedAuthSateKey") as? Data else { throw RemoteError.badURL } let state = try NSKeyedUnarchiver.unarchivedObject(ofClass: OIDAuthState.self, from: data)

It throws an error during unarchiving:
2022-01-20 15:26:29.477582+0100 SHARE-SSO[74484:30434261] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x105e7fd58) [/Applications/Xcode 13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'OIDServiceDiscovery' (0x101686ab8) [/Users/mehboobalam/Library/Developer/CoreSimulator/Devices/5FB33B70-EE1A-4423-A04C-172417CF59B7/data/Containers/Bundle/Application/42B0FF94-6929-477F-BE50-EE8E477479AF/SHARE-SSO.app]"
)}'. This will be disallowed in the future.
2022-01-20 15:26:29.478058+0100 SHARE-SSO[74484:30434261] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x105e7fd58) [/Applications/Xcode 13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'OIDServiceDiscovery' (0x101686ab8) [/Users/mehboobalam/Library/Developer/CoreSimulator/Devices/5FB33B70-EE1A-4423-A04C-172417CF59B7/data/Containers/Bundle/Application/42B0FF94-6929-477F-BE50-EE8E477479AF/SHARE-SSO.app]"
)}'. This will be disallowed in the future.
2022-01-20 15:26:29.478248+0100 SHARE-SSO[74484:30434261] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x105e7fd58) [/Applications/Xcode 13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'OIDServiceDiscovery' (0x101686ab8) [/Users/mehboobalam/Library/Developer/CoreSimulator/Devices/5FB33B70-EE1A-4423-A04C-172417CF59B7/data/Containers/Bundle/Application/42B0FF94-6929-477F-BE50-EE8E477479AF/SHARE-SSO.app]"
)}'. This will be disallowed in the future.
2022-01-20 15:26:29.478457+0100 SHARE-SSO[74484:30434261] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x105e7fd58) [/Applications/Xcode 13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'OIDServiceDiscovery' (0x101686ab8) [/Users/mehboobalam/Library/Developer/CoreSimulator/Devices/5FB33B70-EE1A-4423-A04C-172417CF59B7/data/Containers/Bundle/Application/42B0FF94-6929-477F-BE50-EE8E477479AF/SHARE-SSO.app]"
)}'. This will be disallowed in the future.
2022-01-20 15:26:29.483827+0100 SHARE-SSO[74484:30434261] *** Assertion failure in -[OIDAuthorizationRequest initWithConfiguration:clientId:clientSecret:scope:redirectURL:responseType:state:nonce:codeVerifier:codeChallenge:codeChallengeMethod:additionalParameters:], OIDAuthorizationRequest.m:147

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the secure archive and unarchive flow for OIDAuthState on the reported iOS simulator setup. Inspect the allowed-class warnings for OIDServiceDiscovery and the OIDAuthorizationRequest assertion, then determine why unarchiving fails. Done means AuthState can be restored without the reported warnings or assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
authentication, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.