From e41f4b1857e13c223d8a639329cc784d603ac66e Mon Sep 17 00:00:00 2001 From: zxu Date: Fri, 9 Mar 2018 11:48:07 -0500 Subject: Merge Release 4.10.1 into Master (#896) * Version bumps for Firebase 4.10.1 (#891) * Minimal fix for b/74357976 (#890) Fixes b/74357976 which caused unauthenticated users to be unable to reach the Firestore backend and updates the changelog. * Copy all C++ strings to NSString where they're not obviously safe (#893) This fixes a known instances of memory corruption where in FSTLevelDBMutationQueue, the NSString view was retained for later, and the incorrect user was used, causing b/74381054. gRPC does not necessarily copy its string argumnets and if our hostname were configured to a non-default one it's possible that we could corrupt the host cache too. All remaining usages of util::WrapNSStringNoCopy are obviously safe: passed into logging or other known transient usages. * fix lint --- Example/Podfile | 2 +- Firebase/Core/FIROptions.m | 2 +- FirebaseCore.podspec | 2 +- FirebaseFirestore.podspec | 2 +- Firestore/CHANGELOG.md | 7 +++++++ Firestore/Example/Podfile | 2 +- Firestore/Source/Local/FSTLevelDBMutationQueue.mm | 4 ++-- Firestore/Source/Remote/FSTDatastore.mm | 5 +++-- Firestore/Source/Remote/FSTSerializerBeta.mm | 4 ++-- Firestore/Source/Remote/FSTStream.mm | 11 ++++++----- 10 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Example/Podfile b/Example/Podfile index 0a3b784..f216308 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -8,7 +8,7 @@ target 'Core_Example_iOS' do # The next line is the forcing function for the Firebase pod. The Firebase # version's subspecs should depend on the component versions in their # corresponding podspec's. - pod 'Firebase/Core', '4.10.0' + pod 'Firebase/Core', '4.10.1' target 'Core_Tests_iOS' do inherit! :search_paths diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m index bbfe5c0..384ef21 100644 --- a/Firebase/Core/FIROptions.m +++ b/Firebase/Core/FIROptions.m @@ -43,7 +43,7 @@ NSString *const kFIRIsSignInEnabled = @"IS_SIGNIN_ENABLED"; NSString *const kFIRLibraryVersionID = @"4" // Major version (one or more digits) @"00" // Minor version (exactly 2 digits) - @"16" // Build number (exactly 2 digits) + @"17" // Build number (exactly 2 digits) @"000"; // Fixed "000" // Plist file name. NSString *const kServiceInfoFileName = @"GoogleService-Info"; diff --git a/FirebaseCore.podspec b/FirebaseCore.podspec index 3c6fe59..eec8605 100644 --- a/FirebaseCore.podspec +++ b/FirebaseCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseCore' - s.version = '4.0.16' + s.version = '4.0.17' s.summary = 'Firebase Core for iOS' s.description = <<-DESC diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index e7d1c85..896dcfb 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'FirebaseFirestore' - s.version = '0.10.2' + s.version = '0.10.3' s.summary = 'Google Cloud Firestore for iOS' s.description = <<-DESC diff --git a/Firestore/CHANGELOG.md b/Firestore/CHANGELOG.md index 9b35ea3..71b61ef 100644 --- a/Firestore/CHANGELOG.md +++ b/Firestore/CHANGELOG.md @@ -4,6 +4,13 @@ "offline", causing getDocument() calls to resolve with cached results, rather than continuing to wait. +# v0.10.3 +- [fixed] Fixed a regression in the 4.10.0 Firebase iOS SDK release that + prevented the SDK from communicating with the backend before successfully + authenticating via Firebase Authentication or after unauthenticating and + re-authenticating. Reads and writes would silently be executed locally + but not sent to the backend. + # v0.10.2 - [changed] When you delete a FirebaseApp, the associated Firestore instances are now also deleted (#683). diff --git a/Firestore/Example/Podfile b/Firestore/Example/Podfile index bae5576..71afc2b 100644 --- a/Firestore/Example/Podfile +++ b/Firestore/Example/Podfile @@ -1,7 +1,7 @@ # The next line is the forcing function for the Firebase pod. The Firebase # version's subspecs should depend on the component versions in their # corresponding podspec's. -pod 'Firebase/Core', '4.10.0' +pod 'Firebase/Core', '4.10.1' use_frameworks! platform :ios, '8.0' diff --git a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm index 1f6484d..575e98d 100644 --- a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm +++ b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm @@ -94,7 +94,7 @@ static ReadOptions StandardReadOptions() { + (instancetype)mutationQueueWithUser:(const User &)user db:(std::shared_ptr)db serializer:(FSTLocalSerializer *)serializer { - NSString *userID = user.is_authenticated() ? util::WrapNSStringNoCopy(user.uid()) : @""; + NSString *userID = user.is_authenticated() ? util::WrapNSString(user.uid()) : @""; return [[FSTLevelDBMutationQueue alloc] initWithUserID:userID db:db serializer:serializer]; } @@ -103,7 +103,7 @@ static ReadOptions StandardReadOptions() { db:(std::shared_ptr)db serializer:(FSTLocalSerializer *)serializer { if (self = [super init]) { - _userID = userID; + _userID = [userID copy]; _db = db; _serializer = serializer; } diff --git a/Firestore/Source/Remote/FSTDatastore.mm b/Firestore/Source/Remote/FSTDatastore.mm index cb4516e..3b536ab 100644 --- a/Firestore/Source/Remote/FSTDatastore.mm +++ b/Firestore/Source/Remote/FSTDatastore.mm @@ -97,7 +97,7 @@ typedef GRPCProtoCall * (^RPCFactory)(void); credentials:(CredentialsProvider *)credentials { if (self = [super init]) { _databaseInfo = databaseInfo; - NSString *host = util::WrapNSStringNoCopy(databaseInfo->host()); + NSString *host = util::WrapNSString(databaseInfo->host()); if (!databaseInfo->ssl_enabled()) { GRPCHost *hostConfig = [GRPCHost hostWithAddress:host]; hostConfig.secure = NO; @@ -319,7 +319,8 @@ typedef GRPCProtoCall * (^RPCFactory)(void); [FSTDatastore prepareHeadersForRPC:rpc databaseID:&self.databaseInfo->database_id() - token:(result.is_valid() ? result.token() : absl::string_view())]; + token:(result.user().is_authenticated() ? result.token() + : absl::string_view())]; [rpc start]; } }]; diff --git a/Firestore/Source/Remote/FSTSerializerBeta.mm b/Firestore/Source/Remote/FSTSerializerBeta.mm index 0fd7d33..00391ec 100644 --- a/Firestore/Source/Remote/FSTSerializerBeta.mm +++ b/Firestore/Source/Remote/FSTSerializerBeta.mm @@ -152,8 +152,8 @@ NS_ASSUME_NONNULL_BEGIN - (FSTResourcePath *)encodedResourcePathForDatabaseID:(const DatabaseId *)databaseID { return [FSTResourcePath pathWithSegments:@[ - @"projects", util::WrapNSStringNoCopy(databaseID->project_id()), @"databases", - util::WrapNSStringNoCopy(databaseID->database_id()) + @"projects", util::WrapNSString(databaseID->project_id()), @"databases", + util::WrapNSString(databaseID->database_id()) ]]; } diff --git a/Firestore/Source/Remote/FSTStream.mm b/Firestore/Source/Remote/FSTStream.mm index 6735df1..44e3ef0 100644 --- a/Firestore/Source/Remote/FSTStream.mm +++ b/Firestore/Source/Remote/FSTStream.mm @@ -297,9 +297,10 @@ static const NSTimeInterval kIdleTimeout = 60.0; _rpc = [self createRPCWithRequestsWriter:self.requestsWriter]; [_rpc setResponseDispatchQueue:self.workerDispatchQueue.queue]; - [FSTDatastore prepareHeadersForRPC:_rpc - databaseID:&self.databaseInfo->database_id() - token:(token.is_valid() ? token.token() : absl::string_view())]; + [FSTDatastore + prepareHeadersForRPC:_rpc + databaseID:&self.databaseInfo->database_id() + token:(token.user().is_authenticated() ? token.token() : absl::string_view())]; FSTAssert(_callbackFilter == nil, @"GRX Filter must be nil"); _callbackFilter = [[FSTCallbackFilter alloc] initWithStream:self]; [_rpc startWithWriteable:_callbackFilter]; @@ -631,7 +632,7 @@ static const NSTimeInterval kIdleTimeout = 60.0; } - (GRPCCall *)createRPCWithRequestsWriter:(GRXWriter *)requestsWriter { - return [[GRPCCall alloc] initWithHost:util::WrapNSStringNoCopy(self.databaseInfo->host()) + return [[GRPCCall alloc] initWithHost:util::WrapNSString(self.databaseInfo->host()) path:@"/google.firestore.v1beta1.Firestore/Listen" requestsWriter:requestsWriter]; } @@ -716,7 +717,7 @@ static const NSTimeInterval kIdleTimeout = 60.0; } - (GRPCCall *)createRPCWithRequestsWriter:(GRXWriter *)requestsWriter { - return [[GRPCCall alloc] initWithHost:util::WrapNSStringNoCopy(self.databaseInfo->host()) + return [[GRPCCall alloc] initWithHost:util::WrapNSString(self.databaseInfo->host()) path:@"/google.firestore.v1beta1.Firestore/Write" requestsWriter:requestsWriter]; } -- cgit v1.2.3