-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Cert Auth: Cache validation for expired certs #31456
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
Conversation
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.
Is there an issue about why this change is being made? If not, at to PR description.
Also, is it possible to add a unit test of this behavior?
.SetSize(1).SetSlidingExpiration(_options.CacheEntryExpiration).SetAbsoluteExpiration(certificate.NotAfter)); | ||
{ | ||
// Cache expired certs for little while too | ||
var absExpiration = (certificate.NotAfter < DateTime.Now) ? DateTime.Now + _options.CacheEntryExpiration : certificate.NotAfter; |
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.
Is NotAfter
a UTC or local time? Change to DateTime.UtcNow
if it is UTC, or add a comment that it is local and that DateTime.Now
usage is intentional.
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.
NotAfter is local time, so I'll add a comment, will look to see if its easy to add a unit test
This PR doesn't have anything to do with the tests failures, its just a performance fix in one scenario, it won't have any functional impact its just follow up to some perf issues we saw from the benchmarks when we had an expired cert |
@HaoK should this be closed give it's almost a year old? |
No I will get this in during 7.0, i just need to add some tests |
Actually looks like this fix was already contained in d5a337c |
We saw massive performance hits in the benchmark when we were using an expired cert, due to the validation cache not storing expired certs at all.
Cache expired certs for 2 minutes by default should mitigate this