-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update rustls to 0.23 #70
Conversation
I think I tried this and it won't work on macOS... |
This is difficult to test without CI working by default. |
@Ralith I added you with the |
Android CI failing:
Not sure how to interpret that. There aren't any panics that I can see. "An unexpected packet was received" sounds like a rustls-side issue. There seems to be some sort of test result artifact that might have details, but it doesn't look human-readable. |
It seems to be the same issue as reported here #68. |
I think these lines are unrelated noise. The same output has been happening on passing builds in the past. "ddmlib" looks like it's specific to the Android emulator<->Host debug bridge and so I think likely to be inconsequential to the Rustls tests.
Yes, it is. |
If the only CI failure is #68, can we consider this unblocked? |
b2cb2ec
to
8c11739
Compare
I don't know how @complexspaces feels but I think we wouldn't want to cut a release until I've made some progress and think I have a fix. Will update #68 shortly |
ca3f7b2
to
9f58145
Compare
macos is hitting:
which is from the |
That is extraordinarily strange. I tried comparing the output of |
Perhaps it's a test case ordering/global state issue. rustls tests suggest that I'll try setting defaults explicitly. |
088f716
to
273b8a3
Compare
It looks like its back to the Android failures 🎉 If you rebase on |
@@ -438,7 +441,9 @@ impl Verifier { | |||
pub(crate) fn new_with_fake_root(root: &[u8]) -> Self { | |||
Self { | |||
test_only_root_ca_override: Some(root.into()), | |||
default_provider: rustls::crypto::ring::default_provider(), | |||
default_provider: rustls::crypto::CryptoProvider::get_default() |
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.
All these constructors should probably document that they're relying on the process-global crypto provider set via rustls?
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.
I think proceeding with this design would be user-hostile, as a typical use is likely to panic at runtime for users who haven't explicitly installed a default, which isn't normally required by rustls. I think a better solution would be for rustls to expose CryptoProvider::get_default_or_install_from_crate_features
, which would let us Just Work as well as rustls itself does (although I have mixed feelings about how that breaks if multiple providers are enabled).
We could also reimplement the implicit default logic with local features in this crate, but that would put users at higher risk of accidentally enabling multiple providers (and potentially breaking any part of their code that relies on implicit defaults) if they don't take care to match features on rustls and this crate.
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.
I think this crate should probably just take an Arc as an argument.
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.
That works, though it undermines the convenience of rustls's implicit defaults if an idiomatic user has to go and deal with explicit provider handling for the verifier anyway.
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.
I think it might be cleaner if this operates at the level of a "parent" Arc<dyn ServerCertVerifier>
rather than a CryptoProvider
. But unfortunately right now WebPkiServerVerifier::builder()
does require a non-empty set of roots, which makes it annoying to reuse for this purpose.
My other thought on this is: perhaps we should aim for windows.rs to use CryptVerifyMessageSignature
(or similar) and for apple.rs to use SecKeyVerifySignature
? That would minimise the chance that a certificate is accepted by the platform verifier, but the handshake can't complete because it the certificate is outside the subset that the rustls-webpki crate can parse.
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.
My other thought on this is: perhaps we should aim for windows.rs to use CryptVerifyMessageSignature (or similar) and for apple.rs to use SecKeyVerifySignature?
I have thought about this before, but I'm still not sure I like the idea. It adds another "split" in the library's functionality set, especially on Windows where registry controls can influence what cryptographic operations the OS prefers/will use. This would make debugging harder, for example. So far I have only seen one cryptographic issue come in via bug report at work. Everything else has been missing trust roots, malformed X.509, etc.
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.
I think this crate should probably just take an Arc as an argument.
On review, this feels really awkward on *nix which doesn't actually need it.
It adds another "split" in the library's functionality set
Isn't exposing platform-specific behavior the whole point of this lib?
I think it might be cleaner if this operates at the level of a "parent" Arc rather than a CryptoProvider.
This makes a lot of sense to me.
But unfortunately right now WebPkiServerVerifier::builder() does require a non-empty set of roots, which makes it annoying to reuse for this purpose.
Could we relax this, or introduce an alternative verifier in rustls that has an empty root set but implements the other methods? Practically speaking this amounts to creatively delegating to rustls's get_default_or_install_from_crate_features
, which I think is the best user experience.
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.
Reviewing the diff I don't have any feedback above what djc has already flagged. Thanks again for picking this up Ralith 🎉
I've added a commit that makes calls to Long-term, I think it would be better for rustls to expose |
Allows rustls's implicit defaults to be applied in e.g. `ClientConfig::builder`, even if the verifier is constructed beforehand. This allows the library to Just Work as in earlier versions without breaking the API or baking in a particular provider.
This comment was marked as spam.
This comment was marked as spam.
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.
Sorry for the delay, LGTM.
Required for Quinn to update past rustls 0.21, so a release soon after would be appreciated. Also relaxes default feature requirements on rustls.