fix(ios): decode provisioning profiles without touching the keychain - #1036
Merged
Merged
Conversation
security cms -D imports the certificates embedded in a profile into the login keychain. openssl smime decodes the same plist without that side effect. Fixes #1035.
janicduplessis
marked this pull request as ready for review
September 24, 2026 18:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
readEmbeddedProfiledecodedembedded.mobileprovisionwithsecurity cms -D, which imports every certificate embedded in the CMS message into the login keychain. That runs on everyios --deviceinstall, so real installs add the profile's developer certs to the user's keychain.The compat test made it pile up: each run adds 3 fixed-name fixture certs (
Jane Fixture (TEAMID5678)). One dev Mac had 1526 of them, withtrustd --agentnear 100% CPU.Solution
Decode with
/usr/bin/openssl smime -verify -noverify -inform DERinstead. It ships with every macOS and doesn't touch the keychain; the absolute path keeps a Homebrew, conda or nixopensslon PATH from turning a broken install into a misleading "corrupt profile" refusal.security cmshas no way to skip the import (-kwith a missing keychain just fails).-noverifyskips chain trust, which the gate never relied on since it only reads the plist.The
STIM_NO_PROFILEreason and guide entry now nameopenssl smime.Test plan
security cms -D,/usr/bin/openssl(LibreSSL 3.3.6) and Homebrew OpenSSL 3.6.3 produce byte-identical plists.readEmbeddedProfilecompat test now asserts the signer's SHA-1 is absent fromsecurity find-certificate -a -Zafter decoding.engine-ios-signing.compat.test.ts: 13/13 pass; the fixture cert count stayed at 1526 (it grew by 3 per run before).Fixes #1035