Fix PlayChain key data return semantics - #239
Merged
Merged
Conversation
Kaua463
force-pushed
the
fix-youtube-playchain-v3
branch
from
September 29, 2026 17:02
851754b to
13c4fd6
Compare
Member
|
@ohaiibuzzle you are the inventor of PlayChain, could you review this PR please? |
Member
|
Looks good. To be completely honest PlayChain makes a lot of assumptions when it was made, so these changes are to be expected. |
TheMoonThatRises
approved these changes
Sep 30, 2026
Depal1
approved these changes
Sep 30, 2026
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.
Summary
Fixes PlayChain handling of keychain return semantics, particularly for
kSecClassKeyitems requested withkSecReturnData.Problem
PlayChain previously treated matched
kSecClassKeyitems asSecKeyRefobjects even when the caller explicitly requestedkSecReturnData.Google apps, including YouTube, perform queries such as:
In this case PlayChain attempted to reconstruct a
SecKeyusing key metadata such askSecAttrKeyTypeandkSecAttrKeyClass.Some persisted key entries do not contain those attributes, which could lead to a crash in
PlayKeychain.copyMatching.PlayChain also attempted to construct return values during
SecItemAddcalls where the caller did not request a result.Changes
kSecReturnDatafor key-class items and return the stored data instead of constructing aSecKey.SecItemAddwhen no return value was requested.kSecMatchLimitAllqueries.kSecReturn*flags as existence checks.kSecReturnRefbehavior.Testing
Tested with YouTube iOS 21.38.3 under PlayCover on Apple Silicon.
Runtime instrumentation confirmed calls including:
With the final uninstrumented build:
Related: