verify_cert: enforce maximum number of signatures.#152
Merged
cpu merged 1 commit intorustls:mainfrom Aug 21, 2023
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #152 +/- ##
==========================================
+ Coverage 96.46% 96.54% +0.08%
==========================================
Files 15 15
Lines 4304 4376 +72
==========================================
+ Hits 4152 4225 +73
+ Misses 152 151 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
981dc5b to
b852857
Compare
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.
b852857 to
abbb05f
Compare
djc
approved these changes
Aug 21, 2023
This was referenced Aug 31, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Without the limit in place, the
test_too_many_signaturesunit test has very long runtime and quickly pegs my local CPU. With the limit in place the test returns the expected error quickly.