microsoft-authentication-library-for-dotnet
microsoft-authentication-library-for-dotnet copied to clipboard
[Bug] iOS keychain access group crash
Library version used
4.64.0
.NET version
8.0
Scenario
PublicClient - mobile app
Is this a new or an existing app?
The app is in production, I haven't upgraded MSAL, but started seeing this issue
Issue description and reproduction steps
App when released onto iOS is throwing odd keychain errors which often result in total app crashes. The crashes only seem to appear when compiling in AOT mode. Very similar bug that was never resolved is here: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/1562
Relevant code snippets
Code used:
authenticationClient = PublicClientApplicationBuilder
.Create(_azureADConfig.ClientId)
.WithAuthority(AzureCloudInstance.AzurePublic, _azureADConfig.TenantId) // Only allow accounts in the tenant to authenticate
.WithLogging(_logger, false)
.WithIosKeychainSecurityGroup("com.microsoft.adalcache")
.WithRedirectUri($"msal{_azureADConfig.ClientId}://auth")
.Build();
Console error:
QMCMobile[4349]/1#6 LF=0 copy_matching Error Domain=NSOSStatusErrorDomain Code=-34018 "Client explicitly specifies access group com.microsoft.adalcache but is only entitled for (
"2KLF58357X.com.microsoft.adalcache",
"2KLF58357X.com.qmc.qmcmobile"
)" UserInfo={numberOfErrorsDeep=0, NSDescription=Client explicitly specifies access group com.microsoft.adalcache but is only entitled for (
"2KLF58357X.com.microsoft.adalcache",
"2KLF58357X.com.qmc.qmcmobile"
)}
Native Crash
0 libsystem_kernel.dylib 0x00000001e74eb42c __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fb28ac0c pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x00000001a638eba0 abort + 180 (abort.c:118)
3 QMCMobile 0x00000001031f29ac 0x102a80000 + 7809452
4 QMCMobile 0x000000010317630c mono_runtime_setup_stat_profiler + 0 (mini-posix.c:662)
5 libsystem_platform.dylib 0x00000001fb1cee9c _sigtramp + 56 (sigtramp.c:116)
6 libsystem_pthread.dylib 0x00000001fb28ac0c pthread_kill + 268 (pthread.c:1721)
7 libsystem_c.dylib 0x00000001a638eba0 abort + 180 (abort.c:118)
8 QMCMobile 0x0000000102ea9dd4 print_callback(char const*, int) + 0 (runtime.m:1201)
9 QMCMobile 0x000000010302bfd0 monoeg_g_logv_nofree + 212 (goutput.c:167)
10 QMCMobile 0x000000010302c040 monoeg_assertion_message + 40 (goutput.c:207)
11 QMCMobile 0x00000001030f4bac mono_unhandled_exception_checked + 0 (object.c:4540)
12 QMCMobile 0x00000001031030c4 mono_thread_internal_unhandled_exception + 48 (threads.c:4673)
13 QMCMobile 0x0000000103125ec4 mono_gc_run_finalize + 684 (gc.c:352)
14 QMCMobile 0x0000000103050624 sgen_gc_invoke_finalizers + 192 (sgen-gc.c:2852)
15 QMCMobile 0x00000001031270d8 finalizer_thread + 776 (gc.c:905)
16 QMCMobile 0x000000010310395c start_wrapper + 352 (threads.c:1271)
17 libsystem_pthread.dylib 0x00000001fb28906c _pthread_start + 136 (pthread.c:931)
18 libsystem_pthread.dylib 0x00000001fb2840d8 thread_start + 8 (:-1)
Expected behavior
No response
Identity provider
Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)
Regression
No response
Solution and workarounds
No response