Remember certificate policies extensions but do nothing further#211
Remember certificate policies extensions but do nothing further#211kikuomax wants to merge 2 commits intorustls:mainfrom
Conversation
- Introduces a new test case `win_hello_attest_tpm` that tests `verify_for_usage` with certificates including a critical non-any certificate policy extension. The test fixtures were taken from `core::tests::win_hello_attest_tpm` of `webauthn-rs`.
- `Cert` introduces a new field `certificate_policies` for an optional "Certificate Policies" extension (RFC 5280 4.2.1.4). - `remember_cert_extension` remembers the extension data in `Cert::certificate_policies`.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
==========================================
+ Coverage 97.21% 97.23% +0.02%
==========================================
Files 19 19
Lines 4266 4268 +2
==========================================
+ Hits 4147 4150 +3
+ Misses 119 118 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
This looks okay to me.
If the test depends on the newly introduced behavior (not clear to me if it does?), I suggest that we switch the order of commits such that all commits can pass tests (since we rebase). (I suppose we could also just squash these commits.)
|
I don't think we should do this. The default openssl behaviour is incorrect and drives a bus through the intended meaning of extension criticality. What do the BRs say about the cert policy extension? |
I understand your concern. Integrity should not be compromised for a very specific use case. Anyway, please reject this PR if it is not relevant. |
@djc The order of commits reflected my test-driven approach. I will reorder them if this PR would be accepted. |
|
What exactly is the use case for this? Why would someone want to ignore these invalid extensions? |
All of the locations in the server cert baseline requirements that describe this extension list it as non-critical:
|
@djc My use case is not client-server communication but server-side verification of signatures signed by authenticator devices in the context of Web Authentication. I commented in Issue #30: The certificate policies in the certificate chain I attached to the above comment are valid, but the end entity certificate contains a critical certificate policy extension: I did not mean to make it accept invalid extensions, however, I need more study to propose comprehensive validation. |
|
I think we should close this PR for now. I agree with ctz's earlier assessment. |
|
@cpu Sorry for a stale PR. I would like to come back to this issue later. |
Deal with certificate policies extensions so that
rustls-webpkiwon't fail when it faces a critical certificate policies extensions.This PR makes
rustls-webpkiremember the values of the certificate policies extensions it faces but do nothing further. This change letsrustls-webpkiaccept certificates with invalid critical certificate policies extensions, though, this should be at least equivalent to OpenSSL's default behavior.If one wants to verify the policy tree, can use
verify_pathoption to do so. You can find an example in my fork.