-
Notifications
You must be signed in to change notification settings - Fork 781
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
Make ChannelCredentials.Create work with allowing insecure credentials #1802
Make ChannelCredentials.Create work with allowing insecure credentials #1802
Conversation
@apolcyn Thoughts? |
@apolcyn ping. What do you think about this? |
In the core library, when someone composes a call credentials with an insecure channel creds, the call creds are just silently dropped. The motivation for that was security: call creds typically add sensitive headers. So they wanted to make it hard for people to accidentally send them on unencrypted connections. Personally, I think throwing an error achieves the same original goal in a more user friendly way. So the original behavior actually seems right to me. But I'm saying all this without full background here - have we considered that security motivation here? |
The goal is to not throw an error if the unsecured channel is configured to allow sending call credentials.
|
Even though it's not really breaking anything for Also, I'm kind of assuming that this will simply cause headers to be silently dropped in If we were to go with this, I'd probably be on the side of changing the configurator in Grpc.Core, too. |
As far as I know Grpc.Core isn't being updated except for security issues. I don't think we should block improving grpc-dotnet for Grpc.Core in this case as the only change is not throwing an exception. And there is already the silent behavior if credentials are specified for a gRPC call using |
This fix need for workaround for macos. Please merge! |
I think this PR has potential to break things for the Grpc.Core when the new modified Grpc.Core.Api is used (and that's something we really don't want), so I think we'll need to do some extra verification to avoid potential problems.
If things are still behaving fine when tested against Grpc.Core, we can consider this change (even though I'd really like to see a solution that doesn't involve modifying Grpc.Core.Api behavior - I'll try to think of one). Also, just FTR, C core has special kind of credentials that are "Insecure", but allow the metadata call credentials to be used with them. We call them "local" credentials: https://github.com/grpc/grpc/blob/2badafbc4d246d5165546a61eeb36aa017987d30/include/grpc/grpc_security.h#L689 |
c849aea
to
9c97783
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but let's wait until test failures in grpc/grpc#31376 are resolved and the PR is merged.
I'd also like @captainsafia to approve.
if (isSecure) | ||
{ | ||
// Act && Assert | ||
CreateInvoker(httpClient, isSecure, callCredentials); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it meaningful to add an assertion that uses the constructed invoker to issue a call and checks the token?
@jtattermusch When is Grpc.Core going to get a new release with the changes there? We should make sure the change in Grpc.Core.Api isn't publically available before Grpc.Core is. I don't think there is urgency to merge this PR. No need to create a Grpc.Core release just for this. |
We are not planning a Grpc.Core patch release from the 1.46.x branch at the moment, but if we don't happen to need one within the next month or so, I can make one. |
9c97783
to
a5c99d3
Compare
a5c99d3
to
e81d7cf
Compare
@JamesNK Not applied in version 2.51.0? |
💀 can't test my app on local network without messing with certificates |
@JamesNK sorry to bug you, but is there a chance to create a release with this feature soonish? |
This is in 2.52.0-pre1, which is on NuGet now. Non-preview release will be in a week, or maybe two. |
Thanks for the info @JamesNK ! |
Fixes #1800
Note that this change means Grpc.Core using a newer version of Grpc.Core.Api no longer throws an error when calling
ChannelCredentials.Create(ChannelCredentials.Insecure, callCredentials)
. That could be remedied by updating Grpc.Core to throw an error inside the configurator like Grpc.Net.Client does, but Grpc.Core is in maintenance. IMO not worth it.I think this is safe to change because new behavior goes from error to non-error, and I don't see a situation where anyone would ever depend on the error.
@jtattermusch Thoughts?