Skip to content
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

Switch from chrono to time #66

Merged
merged 1 commit into from
Feb 2, 2022
Merged

Switch from chrono to time #66

merged 1 commit into from
Feb 2, 2022

Conversation

connec
Copy link

@connec connec commented Nov 1, 2021

⚠️ This currently includes yasna.rs as a git dependency, because there's no release with qnighy/yasna.rs#61 yet. I wanted to open the PR anyway to indicate the changes, and perhaps motivate a release for yasna.rs.


Since qnighy/yasna.rs#61 is merged, I wanted to make the corresponding updates here as well, to hopefully resolve #65.

The changes are very mechanically once again, and again the main limitation is that time cannot represent leap seconds. This affects some of the logic and removes a test case.

I've checked the output from main.rs and the examples with openssl x509 -in certs/cert.pem -noout -text and it's as I'd expect. I've also tried it with a library using QUIC w/ self-signed certs and that also works as expected.

Copy link
Member

@est31 est31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I'll merge this after the next yasna release.

@Ralith
Copy link

Ralith commented Nov 21, 2021

Opened qnighy/yasna.rs#63 since that seems to be taking a while.

@est31
Copy link
Member

est31 commented Jan 29, 2022

Could you rebase this? I drew this out hoping that maybe chrono would fix the issue, but I think now it's time time (pun intended).

@connec
Copy link
Author

connec commented Feb 1, 2022

I've rebased, but it still depends on an unreleased change in yasna.rs: qnighy/yasna.rs#61

@est31
Copy link
Member

est31 commented Feb 2, 2022

There is a yasna release now: qnighy/yasna.rs#64

There is unsoundness in `chrono`
(https://rustsec.org/advisories/RUSTSEC-2020-0159), and although we
don't use the affected APIs, the advisory still fires. `time` ≥3 does
not have this unsoundness, and supports almost‡ all the necessary APIs,
so we can quite simply swap it out.

Since the `chrono` types are used in some APIs, those signatures have
had to change, making this a breaking change. The yasna.rs dependency
has also been upgraded to a version based on `time` rather than
`chrono`.

‡ `time` does not support leap seconds in their representation or
parsing. In this commit, we simply ignore leap seconds, which also
constitutes a breaking change since values with leap seconds will parse
differently (they parse to the previous second).
@connec
Copy link
Author

connec commented Feb 2, 2022

@est31 est31 merged commit cf17b3d into rustls:master Feb 2, 2022
@connec connec deleted the chrono-to-time branch February 2, 2022 18:27
matze added a commit to matze/rcgen that referenced this pull request Feb 21, 2022
Despite rustls#66, chrono is still pulled in transitively via x509-parser
0.12. x509-parser 0.13 switched to time as well, so using rcgen with an
updated version on't cause `cargo audit` issues.
@matze matze mentioned this pull request Feb 21, 2022
est31 pushed a commit that referenced this pull request Feb 21, 2022
Despite #66, chrono is still pulled in transitively via x509-parser
0.12. x509-parser 0.13 switched to time as well, so using rcgen with an
updated version on't cause `cargo audit` issues.
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.

Dealing with unsoundness in chrono
3 participants