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

iOS 13 simulator test bundle entitlements requirements #508

Open
keith opened this issue Jul 25, 2019 · 6 comments
Open

iOS 13 simulator test bundle entitlements requirements #508

keith opened this issue Jul 25, 2019 · 6 comments
Labels
P2 We should fix this this quarter type: bug Something isn't working

Comments

@keith
Copy link
Member

keith commented Jul 25, 2019

When using some API such as the shared keychain API you need entitlements in your app's binary that define the shared keychain groups you could access. If you hit this code in tests, previously with iOS <13 they would be fine and wouldn't cause an error. When running on an iOS 13 simulator you get the kErrSecMissingEntitlement error but on iOS 12.2 we get a errSecItemNotFound status instead (which makes sense for our clean simulator use case).

This seems to be because the test bundle has no entitlements. When running with xcodebuild, it produces a test bundle that contains the __TEXT,__entitlements section that has the keychain groups setup correctly (I have no idea where it gets this configuration from)

I've filed FB6799645 about this but this might be an intentional change, in which case we might have to support entitlements for test bundles. The alternative is using a test host app which has the correct entitlements.

@thomasvl
Copy link
Member

How does stock Xcode configure the entitlements on the test bundle? Do they just set the file in the settings like they do for apps? Do they also sign the bundle or just insert the entitlements segment without signing?

@keith
Copy link
Member Author

keith commented Jul 25, 2019

They insert the entitlements segment without signing

@keith
Copy link
Member Author

keith commented Aug 20, 2019

Here's a sample project demonstrating the issue KeychainTestBundle.zip

If you run the tests of this project on an iOS 12 simulator, they pass, and if you run them on an iOS 13 simulator they hit the assert statement about the error. I've gotten a response on my feedback but it's still unclear to me if this behavior change is intentional so I've uploaded this project there as well.

@sergiocampama sergiocampama added P2 We should fix this this quarter type: bug Something isn't working labels Aug 20, 2019
@keith
Copy link
Member Author

keith commented Sep 5, 2019

This was just confirmed in my feedback that this is an intentional change in the iOS 13 simulator such that entitlements / a test host is required. Since a test host is a viable solution here we might just want to close this and have that be the recommendation.

@sergiocampama
Copy link
Contributor

That defeats the purpose of logic tests, so we should be looking at that in the following weeks. I'll file an internal issue to track this more closely, but that work around might be good enough until we have a better solution.

@keith
Copy link
Member Author

keith commented Sep 5, 2019

Well this is only a problem if you're hitting one of these codepaths that seems to be affected by this, which I assume means only things that rely on entitlements. I'm not sure how much you'll hit that in logic tests (probably ideally never)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We should fix this this quarter type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants