Skip to content

Time point parsing bounds#7648

Draft
eddyashton wants to merge 5 commits intomicrosoft:mainfrom
eddyashton:time_point_parsing_bounds
Draft

Time point parsing bounds#7648
eddyashton wants to merge 5 commits intomicrosoft:mainfrom
eddyashton:time_point_parsing_bounds

Conversation

@eddyashton
Copy link
Member

Spotted some wraparound issues with our time-point parsing code. We use std::system_clock, which uses int64 to store nanoseconds from 1970. As such, the range of representable time points is surprisingly perceivable:

Duration min: 1677-09-21 00:12:43.145224192
Duration max: 2262-04-11 23:47:16.854775807

This specifically causes problems for certs with Not-Before or Not-After timestamps a few hundred years away - if they're after 2262, they wrap around and we get bugs.

This includes some new tests, in both crypto unit test and e2e cert auth, that exhibit these bugs.

There's also a proposed fix, shifting to tracking seconds rather than std::system_clock::time_points. This has a little more churn on the implementation than I'd like, so I'll also explore just defining our own clock type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant