Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<CustomEntitlement> with keychain-access-groups does not work on iOS Simulator #19903

Closed
aritchie opened this issue Jan 24, 2024 · 3 comments
Closed
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@aritchie
Copy link

aritchie commented Jan 24, 2024

Steps to Reproduce

  1. Add the following to the MAUI csproj
<ItemGroup>
   <!--MSBuild will replace app identifier prefix with empty-->
   <CustomEntitlements Include="keychain-access-groups" Type="StringArray" Value="$(AppIdentifierPrefix)org.shiny.customentitlementissue" />
   <!--OR-->
<CustomEntitlements Include="keychain-access-groups" Type="StringArray" Value="%24(AppIdentifierPrefix)org.shiny.customentitlementissue" />
   <!--OR-->
<CustomEntitlements Include="keychain-access-groups" Type="StringArray" Value="HARDCODED_TEAMID.org.shiny.customentitlementissue" />
</ItemGroup>
  1. Try to configure MSAL or use SecureStorage within any iOS simulator - see exception

Expected Behavior

That calls like SecureStorage.Default.SetAsync work because the appropriate keychain-access-groups has made it to the simulator

Actual Behavior

Calling something like an MSAL build operation or SecureStorage.Default.SetAsync will result in exception of "System.Exception: Error adding record: MissingEntitlement"

Note that the above works with an actual iOS device with the hardcoded teamID, but fails on an iOS simulator

Environment

Visual Studio Enterprise 2022 for Mac
Version 17.6.8 (build 400)
Installation UUID: f2975260-2132-4e33-bc85-24df5e044537

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/8.0.100/Sdks
SDK Versions:
8.0.100
7.0.312
7.0.311
7.0.310
7.0.203
7.0.103
6.0.418
6.0.417
6.0.416
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
8.0.0
7.0.15
7.0.14
7.0.13
6.0.26
6.0.25
6.0.24

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode: 15.2 22503
Build: 15C500b

Xamarin.Mac
Version: 9.3.0.23 Visual Studio Enterprise
Hash: 9defd91
Branch: xcode14.3
Build date: 2023-10-23 16:14:59-0400

Xamarin.iOS
Version: 16.4.0.23 Visual Studio Enterprise
Hash: 9defd91
Branch: xcode14.3
Build date: 2023-10-23 16:15:00-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2024-01-03 23:07:21 UTC

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Enterprise)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/allanritchie/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.1 (API level 32)
12.0 (API level 31)
8.1 (API level 27)
13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.3
SDK Build Tools Version: 33.0.0

Build Information:
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2024-01-03 23:07:29 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2024-01-03 23:07:29 UTC

Build Information
Release ID: 1706080400
Git revision: dfc3b79e7cc0dbc2710b239472a704042f66dad0
Build date: 2024-01-03 23:05:33+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.3.0
Darwin 23.3.0 Darwin Kernel Version 23.3.0
Wed Dec 20 21:33:31 PST 2023
root:xnu-10002.81.5~7/RELEASE_ARM64_T8112 arm64

Enabled user installed extensions
Meadow for VS2022 1.5.0

Build Logs

Example Project (If Possible)

https://github.com/aritchie/CustomEntitlementIssue

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Jan 25, 2024
…ctSigningIdentity.

Take the CustomEntitlements item group into account in DetectSigningIdentity
when determining whether the app has entitlements (and would thus require a
provisioning profile).

Partial fix for xamarin#19903.
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Jan 25, 2024
…nts.

Otherwise custom entitlements won't end up in the archived entitlements (as
they should, just as if they were provided in an Entitlements.plist file).

Partial fix for xamarin#19903.
@rolfbjarne
Copy link
Member

I can reproduce, and I have fixes in progress.

@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Jan 25, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Jan 25, 2024
rolfbjarne added a commit that referenced this issue Jan 26, 2024
…ctSigningIdentity. (#19919)

Take the CustomEntitlements item group into account in DetectSigningIdentity
when determining whether the app has entitlements (and would thus require a
provisioning profile).

Partial fix for #19903.
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Jan 26, 2024
…ctSigningIdentity.

Take the CustomEntitlements item group into account in DetectSigningIdentity
when determining whether the app has entitlements (and would thus require a
provisioning profile).

Partial fix for xamarin#19903.
dalexsoto pushed a commit that referenced this issue Jan 27, 2024
…m group into account in DetectSigningIdentity. (#19930)

Take the CustomEntitlements item group into account in
DetectSigningIdentity
when determining whether the app has entitlements (and would thus
require a
provisioning profile).

Partial fix for #19903.


Backport of #19919

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
rolfbjarne added a commit that referenced this issue Jan 29, 2024
…nts. (#19920)

Otherwise custom entitlements won't end up in the archived entitlements
(as they should, just as if they were provided in an Entitlements.plist file).

Partial fix for #19903.
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Jan 29, 2024
…ments.plist file.

We need to process custom entitlements just like if they came from an
Entitlements.plist file - which means replacing terms such as
$(AppIdentifierPrefix) and $(TeamIdentifierPrefix) with their correct value
depending on the provisioning profile.

Partial fix for xamarin#19903.
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Jan 29, 2024
…nts.

Otherwise custom entitlements won't end up in the archived entitlements (as
they should, just as if they were provided in an Entitlements.plist file).

Partial fix for xamarin#19903.
dalexsoto pushed a commit that referenced this issue Jan 29, 2024
…ts to the archived entitlements. (#19943)

Otherwise custom entitlements won't end up in the archived entitlements
(as
they should, just as if they were provided in an Entitlements.plist
file).

Partial fix for #19903.


Backport of #19920

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Jan 29, 2024
…ments.plist file.

We need to process custom entitlements just like if they came from an
Entitlements.plist file - which means replacing terms such as
$(AppIdentifierPrefix) and $(TeamIdentifierPrefix) with their correct value
depending on the provisioning profile.

Partial fix for xamarin#19903.
rolfbjarne added a commit that referenced this issue Jan 30, 2024
…ments.plist file. (#19942)

We need to process custom entitlements just like if they came from an
Entitlements.plist file - which means replacing terms such as
`$(AppIdentifierPrefix)` and `$(TeamIdentifierPrefix)` with their
correct value
depending on the provisioning profile.

Partial fix for #19903.
rolfbjarne pushed a commit that referenced this issue Jan 30, 2024
…if they came from an Entitlements.plist file. (#19955)

We need to process custom entitlements just like if they came from an
Entitlements.plist file - which means replacing terms such as
`$(AppIdentifierPrefix)` and `$(TeamIdentifierPrefix)` with their correct value
depending on the provisioning profile.

Partial fix for #19903.

Backport of #19942
@rolfbjarne
Copy link
Member

This is now fixed. We're trying to get the fix in the next servicing release, but no promises.

@aritchie
Copy link
Author

Thanks @rolfbjarne - much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

No branches or pull requests

2 participants