Conversation
9398fb9 to
a8153e0
Compare
cpu
left a comment
There was a problem hiding this comment.
Is the idea here that rustls, webpki, webpki-roots and rustls-pemfile will all share a dependency on this crate for interoperable types? Could you update the PR description with a bit of the higher-level rationale? (I think some of it was discussed in another issue/PR but I can't find it off-hand)
I left a couple comments about clippy settings, but otherwise the code in here seems reasonable for my understanding of what we're trying to achieve with the separate repo.
|
Would also like feedback on this from @jsha (concerning FFIability) and @complexspaces (regarding usability within rustls-platform-verifier). |
|
I think this is looking good so far -- my main comment is that we should be making clear somewhere that these are relatively behaviour-less newtypes, so nobody should end up with an expectation that (for example) |
|
For convenient reference I've pushed docs from this PR to https://rustdoc.crud.net/jsha/pki-types/rustls_pki_types/. One thing I'm wondering: are these newtypes even necessary? Can we pass primitive slices like The Also to make sure I understand correctly: The Cow-alike implementation here (DerInner::Slice and DerInner::Vec) is not a performance optimization, it's to allow operation in a Assuming all the above is correct, I feel like I've talked myself into understanding why these are necessary, but I'll still include the ruminating since it may be useful to have it written out (and I could be wrong). From an FFI standpoint I think this should be fine. We currently expose the That's a simple struct that has one accessor, to get a pointer and length to the contained data. It would probably keep the same interface. It's returned from The other place I would expect to see the rustls-ffi doesn't current expose TrustAnchor at all. Instead it exposes RootCertStore as rustls_root_cert_store, and offers rustls_root_cert_store_add_pem, which calls add_parseable_certificates. One slight reservation I have on the FFI front is: will there ever be a case when we want non-Rust code to be able to generate the Slice / borrowed variant of Oh and one thing to be aware of on the FFI front: So, overall after chewing it over for a bit: 👍🏻 |
|
Thanks for the thorough review!
Yes, it would return a
I think there are two goals:
For the latter, I'm thinking of scenarios where a
So one potential future direction that I think might be interesting is removing the |
Ah, nice. I think the case of embedding a The TrustAnchor case is of course sensible and we have a current example of embedding a list of TrustAnchors in a library (webpki-roots). I increasingly worry about the reliability hazard posed by applications that bake in a list of TrustAnchors and don't get updated, but that's not really an issue for this thread (and hopefully we'll solve it by promoting rustls-platform-verifier as the best way). |
Yup, I'm still on board with promoting rustls-platform-verifier as the better verifier, but I also think there are use cases where webpki-roots are quite nice. In general, I would argue rustls-platform-verifier is especially useful on Windows and macOS as (a) on Linux it falls back to the rustls-native-certs approach anyway which (b) depends on distribution trust store management, which might well be less reliable than the Mozilla roots. Obviously that still depends on timely upgrades of webpki-roots and regular build + deployments, but I think that scenario still covers a lot of ground in SaaS applications. |
1a66c47 to
fbbcdf0
Compare
|
Update:
Of course the |
8e5d2ef to
f65659f
Compare
ctz
left a comment
There was a problem hiding this comment.
This is looking good to me.
One of the things I took from the rustls no-std RFC was whether a unix timestamp newtype would be good, to hoist up that type from webpki into here. Do you think that's useful? I suppose don't need to make that decision now in any case.
Yes, that's definitely something that I think would make sense, but trying to deal with the initial push here first, which is complicated enough when working across 6 different repos. |
cpu
left a comment
There was a problem hiding this comment.
This looks good to me.
Would you be willing to take some of the context you added to the PR description and using it to create a README.md? I think it would be useful to capture the purpose of the crate there.
Otherwise my only feedback was related to comments you were porting as-is from existing code. If you don't want to adjust those as part of this work that's fine with me. Re-reading the comments in this branch prompted some thoughts for potential updates but I don't think they need to be blocking.
841dedb to
963fb11
Compare
|
Addressed a bunch of documentation issues, added a README and crate root documentation, added |
5890321 to
c7100fc
Compare
The idea here is to share a long-term stable (as in, no semver-breaking updates) collection of types that can be used as shared context between rustls, webpki, webpki-roots, rustls-native-certs and rustls-pemfile. Right now, there are a number of pain points where the conversion from rustls-native-certs to rustls
OwnedTrustAnchoris pretty manual.Some of these crates (like rustls-native-certs) previously had a dependency on rustls to share its basic
CertificateandPrivateKeydependencies, however rustls evolves much more quickly than rustls-native-certs so that also generated some unwanted churn.The API here is optimized for long-term stability and doesn't need
stdso it can be used with webpki inno_stdmode. Its dependency onallocis optional. We also use an innerCow-like type to abstract over slices andVecs with a lifetime, so that aTrustAnchorusing&'static [u8]field values could be used directly in a rustls verifier.There has been some discussion of this in rustls issues/PRs but I can't find it now. At the time, Brian was not a fan of this idea.
Related PRs: