Allow callers to ignore selected critical extensions#485
Allow callers to ignore selected critical extensions#485xyzzyz wants to merge 1 commit intorustls:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
==========================================
+ Coverage 96.97% 97.03% +0.05%
==========================================
Files 20 20
Lines 3936 4007 +71
==========================================
+ Hits 3817 3888 +71
Misses 119 119 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add ExtensionId and an opt-in EndEntityCert constructor that accepts a DER OID allowlist for unsupported critical extensions on the leaf certificate. Existing TryFrom parsing remains strict by default. Add verify_for_usage_with_ignored_critical_extensions so callers can explicitly apply an allowlist when path building parses intermediate certificates. Existing verify_for_usage remains strict for intermediates. Supported extensions are still parsed and validated normally; the allowlist only suppresses UnsupportedCriticalExtension for exact OID matches. Add integration tests for leaf and intermediate allowlisting, exact-match behavior, and supported-extension parsing.
1667c76 to
88fc6de
Compare
An earlier discussion on this: #232 (comment) |
|
Thanks for linking this, I have not seen this. I think my approach matches the spirit of this comment moderately well:
In my approach, the user still needs to explicitly declare which critical extensions are to be ignored, and is free to do any processing before or after. The user will need to reparse the certificate to extract the extensions, but I think this is unavoidable in any case: rustls-webpki cannot offer much help in parsing the extensions it does not recognize. At best, I guess what rustls-webpki could offer is an additional method on that just iterates over the DER bytes of extensions. We could actually go one step further, and introduce a public API for extension that just matches the RFC 5280 definition: and have the |
I'm working with a system that uses private critical extensions on X.509 certificate. They don't play a role during building a path, but are then used to enforce constraints on the objects being authenticated. Therefore, I'd like to be able to make
rustls-webpkiignore these extensions when building a path, and verify these later separately.I don't like how I had to add a new method to make sure that API is backwards-compatible. I think that
verify_for_usagealready has too many arguments as it is. I'd suggest adding a new API that's extensible by design: it should take anOptionssort of an object as argument, the fields of which should be private; this way new functionality can be added by adding new public methods on theOptionsobject.I could do it in a separate PR, and then once it's merged, rebase this one on top of the other one. Thoughts?