Skip to content

Rework gRPC certificate loading one last time #2606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 21, 2019
Merged

Rework gRPC certificate loading one last time #2606

merged 5 commits into from
Mar 21, 2019

Conversation

wilhuff
Copy link
Contributor

@wilhuff wilhuff commented Mar 21, 2019

The prior implementation happened to work but only because it made implicit assumptions about the structure of the bundles we load.

In particular, by looking for @"gRPCCertificates.bundle/roots" the code was assuming the iOS bundle layout for the app was in effect, but this doesn't work on macOS, in which app/framework bundles have an additional Contents/Resources in the path.

This change gets rid of the implicit mapping of the bundle structure onto the directory structure and instead opens the nested gRPCCertificates.bundle itself as a resource, making this code portable without having to understand the bundle layout under the covers.

Fixes #2604. Should also remove the need for the workaround in #2177.

@@ -84,10 +84,15 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: are changes to this file intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. They happen any time you manipulate the macOS project. I can put this in a separate PR if you prefer.

@@ -35,7 +35,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

// do the timestamp fix
FIRFirestoreSettings *settings = db.settings;
settings.timestampsInSnapshotsEnabled = true;
db.settings = settings;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unrelated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows up as a deprecation warning while building the macOS_example, which was the primary means by which I verified this change was correct.

I can move this into a separate cleanup grab-bag PR if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think that would be overkill (applies to other changes of that kind in this PR). As long as this is done on purpose, I'm fine with it being the part of the same PR.

@@ -561,7 +561,7 @@
B9C261C26C5D311E1E3C0CB9 /* query_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = query_test.cc; sourceTree = "<group>"; };
BB92EB03E3F92485023F64ED /* Pods_Firestore_Example_iOS_Firestore_SwiftTests_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Firestore_Example_iOS_Firestore_SwiftTests_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: are changes to this file intended as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, these are changes that are happening whenever you touch the project.

#include <string>

#import "Firestore/Source/Core/FSTFirestoreClient.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: I'm not sure this import is necessary, maybe try just deleting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I think we had this before in order to find a class to load the FirebaseFirestore framework's bundle, but doing this reflectively seems cleaner from a layering perspective.

/**
* Finds the path to the roots.pem certificates file, wherever it may be.
*
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultranit: extra empty line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultradone.

@var-const var-const assigned wilhuff and unassigned var-const Mar 21, 2019
@wilhuff wilhuff assigned var-const and unassigned wilhuff Mar 21, 2019
@wilhuff
Copy link
Contributor Author

wilhuff commented Mar 21, 2019

Several of the things you pointed out were unrelated to the core change here though I've included them for convenience. If you prefer I can split these into a separate PR.

@var-const var-const assigned wilhuff and unassigned var-const Mar 21, 2019
@var-const
Copy link
Contributor

I'm okay with these changes being in this PR, was just making sure they were intentional.

@wilhuff wilhuff merged commit c4527b1 into master Mar 21, 2019
@wilhuff wilhuff deleted the wilhuff/certs branch March 21, 2019 22:25
@firebase firebase locked and limited conversation to collaborators Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firestore fails to find certificates on macOS
3 participants