aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Remote/FSTStream.mm
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-03-09 11:48:07 -0500
committerGravatar GitHub <noreply@github.com>2018-03-09 11:48:07 -0500
commite41f4b1857e13c223d8a639329cc784d603ac66e (patch)
treec92e39372d3df18fc637b3dcc7d8a89c3cbbda93 /Firestore/Source/Remote/FSTStream.mm
parent2ae36f1e9671b40723dd06462b4a416e4baa5a57 (diff)
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
Diffstat (limited to 'Firestore/Source/Remote/FSTStream.mm')
-rw-r--r--Firestore/Source/Remote/FSTStream.mm11
1 files changed, 6 insertions, 5 deletions
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];
}