-
Notifications
You must be signed in to change notification settings - Fork 165
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
Enforce maximum signature count #273
Conversation
[`git cherry-pick f0259b9`, merged by Brian Smith.] Crate-internal consumers of `build_chain` always pass `0` as the sub CA count, only the `verify_cert.rs` internal recursion changes this parameter. This commit separates the external interface from the internal recursion to remove one extra parameter from an already complicated interface.
Codecov Report
@@ Coverage Diff @@
## main #273 +/- ##
==========================================
- Coverage 57.13% 50.62% -6.52%
==========================================
Files 18 18
Lines 2326 3751 +1425
==========================================
+ Hits 1329 1899 +570
- Misses 997 1852 +855
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
This looks good to me. Thank you!
The change to the error handling you called out seems like a sensible way to address the needs of the fix without breaking the Error
compatibility guarantees in this release stream.
a6ba358
to
432b933
Compare
Cherry-picked from e473ee1 and modified by Brian Smith. The main modifications were: 1. Maintain API compatibility with webpki 0.22.0. 2. (In `build_chain_inner`), stop immediately on fatal error, without considering any more paths. The point of having such fatal errors is to fail ASAP and avoid unneeded work in the failure case. 3. The test uses rcgen which requires Rust 1.67.0 or later. (I don't think the non-test MSRV of webpki changes though.) The original commit message is below: Pathbuilding complexity can be quadratic, particularly when the set of intermediates all have subjects matching a trust anchor. In these cases we need to bound the number of expensive signature validation operations that are performed to avoid a DoS on CPU usage. This commit implements a simple maximum signature check limit inspired by the approach taken in the Golang x509 package. No more than 100 signatures will be evaluated while pathbuilding. This limit works in practice for Go when processing real world certificate chains and so should be appropriate for our use case as well.
432b933
to
5512b6e
Compare
See the individual commit messages.