Skip to content

Commit a9b889d

Browse files
authored
[Auth] Add 'kSecUseDataProtectionKeychain' flag to keychain access (#10759)
* [Auth] Add 'kSecUseDataProtectionKeychain' flag to keychain access * Add CHANGELOG entry * [skip ci] Update CHANGELOG * [skip ci] Update CHANGELOG (1)
1 parent 0f060e1 commit a9b889d

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

FirebaseAuth.podspec

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ supports email and password accounts, as well as several 3rd party authenticatio
9898
unit_tests.requires_app_host = true
9999
unit_tests.dependency 'OCMock'
100100
unit_tests.dependency 'HeartbeatLoggingTestUtils'
101+
102+
# This pre-processor directive is used to selectively disable keychain
103+
# related code that blocks unit testing on macOS.
104+
s.osx.pod_target_xcconfig = {
105+
'GCC_PREPROCESSOR_DEFINITIONS' => 'FIREBASE_AUTH_MACOS_TESTING=1'
106+
}
107+
101108
end
102109
end
103110
end

FirebaseAuth/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 10.5.0
2+
- [fixed] Prevent keychain pop-up when accessing Auth keychain in a Mac
3+
app. Note that using Firebase Auth in a Mac app requires that the app
4+
is signed with a provisioning profile that has the Keychain Sharing
5+
capability enabled (see Firebase 9.6.0 release notes). (#10582)
6+
17
# 10.4.0
28
- [fixed] Fix secure coding bugs in MFA. (#10632)
39
- [fixed] Added handling of error returned from a blocking cloud function. (#10628)

FirebaseAuth/Sources/Storage/FIRAuthKeychainServices.m

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,28 @@ - (void)deleteLegacyItemWithKey:(NSString *)key {
226226
@param key The key for the value being manipulated, used as the account field in the query.
227227
*/
228228
- (NSDictionary *)genericPasswordQueryWithKey:(NSString *)key {
229-
return @{
229+
NSMutableDictionary *query = @{
230230
(__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword,
231231
(__bridge id)kSecAttrAccount : [kAccountPrefix stringByAppendingString:key],
232232
(__bridge id)kSecAttrService : _service,
233-
};
233+
}
234+
.mutableCopy;
235+
236+
// TODO(ncooke3): Refactor Auth to provide a user defaults based
237+
// implementation for unit testing purposes on macOS.
238+
#ifndef FIREBASE_AUTH_MACOS_TESTING
239+
// The below key prevents keychain popups from appearing on the client. It
240+
// requires a configured provisioing profile to function properly–– which
241+
// cannot be checked into the repo. Rather than disable most of the Auth
242+
// testing suite on macOS, the key is omitted. Paired with the
243+
// `scripts/configure_test_keychain.sh` script, the popups do not block CI.
244+
// See go/firebase-macos-keychain-popups for more details.
245+
if (@available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 6.0, *)) {
246+
query[(__bridge id)kSecUseDataProtectionKeychain] = (__bridge id)kCFBooleanTrue;
247+
}
248+
#endif // FIREBASE_AUTH_MACOS_TESTING
249+
250+
return [query copy];
234251
}
235252

236253
/** @fn legacyGenericPasswordQueryWithKey:

0 commit comments

Comments
 (0)