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

Replace chrono with httpdate internally #361

Merged
merged 2 commits into from
Nov 8, 2021

Conversation

sagebind
Copy link
Owner

@sagebind sagebind commented Nov 8, 2021

Remove chrono as a dependency to avoid any connection to the transitive CVE-2020-26235 in time 0.2. This also requires removing chrono from the public API of CookieBuilder (added in #349), which is probably for the best anyway before it is released so that we aren't tied to it. Expose SystemTime types instead, which both chrono and time are compatible with, should the consumer of the API choose to use either of those crates.

Replace formatting and parsing of HTTP date formats with the aptly-named httpdate crate, which implements exactly those two operations and no more. As a side benefit this reduces our total transitive dependency count by 3 when the cookies feature is enabled.

This has been the only thing holding back a 1.6.0 release with #349 in it, since CVE-2020-26235 was brought to wider attention shortly after its merge and I've been thinking on how to best address that concern before the API is released and can't be changed without a BC break.

Remove chrono as a dependency to avoid any connection to the transitive [CVE-2020-26235 in `time` 0.2](https://github.com/rustsec/advisory-db/blob/9e93a3df4a54e70f2539a2ecdc3d70beef64c856/crates/time/RUSTSEC-2020-0071.md). This also requires removing chrono from the public API of `CookieBuilder`, which is probably for the best anyway before it is released so that we aren't tied to it. Expose `SystemTime` types instead, which both chrono and `time` are compatible with, should the consumer of the API choose to use either of those crates.

Replace formatting and parsing of HTTP date formats with the aptly-named    `httpdate` crate, which implements exactly those two operations and no more. As a side benefit this reduces our total transitive dependency count by 3 when the `cookies` feature is enabled.
@sagebind sagebind added dependencies Pull requests that update a dependency file security A security concern or vulnerability labels Nov 8, 2021
@sagebind sagebind added this to the 1.6.0 milestone Nov 8, 2021
@codecov
Copy link

codecov bot commented Nov 8, 2021

Codecov Report

Merging #361 (535bbb0) into master (9cde92d) will increase coverage by 0.14%.
The diff coverage is 91.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #361      +/-   ##
==========================================
+ Coverage   79.24%   79.38%   +0.14%     
==========================================
  Files          51       51              
  Lines        3045     3061      +16     
==========================================
+ Hits         2413     2430      +17     
+ Misses        632      631       -1     
Impacted Files Coverage Δ
src/cookies/psl/mod.rs 85.00% <62.50%> (-1.85%) ⬇️
src/cookies/cookie.rs 97.22% <100.00%> (+0.23%) ⬆️
src/handler.rs 80.84% <0.00%> (+0.46%) ⬆️
src/trailer.rs 60.71% <0.00%> (+1.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cde92d...535bbb0. Read the comment docs.

@sagebind sagebind merged commit 46a6593 into master Nov 8, 2021
@sagebind sagebind deleted the replace-chrono-with-httpdate branch November 8, 2021 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file security A security concern or vulnerability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant