From cfff25d0d11e6373b71330f946bc96416b27931e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 07:24:32 +0800 Subject: [PATCH] chore(deps): update cookie requirement from 0.17 to 0.18 (#448) * chore(deps): update cookie requirement from 0.17 to 0.18 Updates the requirements on [cookie](https://github.com/SergioBenitez/cookie-rs) to permit the latest version. - [Changelog](https://github.com/SergioBenitez/cookie-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/SergioBenitez/cookie-rs/compare/0.17.0...0.17.0) --- updated-dependencies: - dependency-name: cookie dependency-type: direct:production ... Signed-off-by: dependabot[bot] * fix --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Chrislearn Young --- Cargo.toml | 2 +- crates/csrf/src/cookie_store.rs | 6 +++--- crates/flash/src/cookie_store.rs | 8 ++++---- crates/session/src/lib.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a9e6240e1..cb4779207 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ base64 = "0.21" bson = "2" bytes = "1" bcrypt = "0.15" -cookie = "0.17" +cookie = "0.18" chacha20poly1305 = "0.10" chrono = "0.4" cruet = "0.13" diff --git a/crates/csrf/src/cookie_store.rs b/crates/csrf/src/cookie_store.rs index ea81d4aa2..b1bbca150 100644 --- a/crates/csrf/src/cookie_store.rs +++ b/crates/csrf/src/cookie_store.rs @@ -85,16 +85,16 @@ impl CsrfStore for CookieStore { ) -> Result<(), Self::Error> { let secure = req.uri().scheme() == Some(&Scheme::HTTPS); let expires = cookie::time::OffsetDateTime::now_utc() + self.ttl; - let cookie_builder = Cookie::build(self.name.clone(), format!("{token}.{proof}")) + let cookie_builder = Cookie::build((self.name.clone(), format!("{token}.{proof}"))) .http_only(true) .same_site(SameSite::Strict) .path(self.path.clone()) .secure(secure) .expires(Expiration::DateTime(expires)); let cookie = if let Some(domain) = &self.domain { - cookie_builder.domain(domain.clone()).finish() + cookie_builder.domain(domain.clone()).build() } else { - cookie_builder.finish() + cookie_builder.build() }; res.add_cookie(cookie); Ok(()) diff --git a/crates/flash/src/cookie_store.rs b/crates/flash/src/cookie_store.rs index 2d943dedd..818c4da76 100644 --- a/crates/flash/src/cookie_store.rs +++ b/crates/flash/src/cookie_store.rs @@ -88,22 +88,22 @@ impl FlashStore for CookieStore { } async fn save_flash(&self, _req: &mut Request, _depot: &mut Depot, res: &mut Response, flash: Flash) { res.add_cookie( - Cookie::build(self.name.clone(), serde_json::to_string(&flash).unwrap_or_default()) + Cookie::build((self.name.clone(), serde_json::to_string(&flash).unwrap_or_default())) .max_age(self.max_age) .path(self.path.clone()) .same_site(self.same_site) .http_only(self.http_only) - .finish(), + .build(), ); } async fn clear_flash(&self, _depot: &mut Depot, res: &mut Response) { res.add_cookie( - Cookie::build(self.name.clone(), "") + Cookie::build((self.name.clone(), "")) .max_age(Duration::seconds(0)) .same_site(self.same_site) .http_only(self.http_only) .path(self.path.clone()) - .finish(), + .build(), ); } } diff --git a/crates/session/src/lib.rs b/crates/session/src/lib.rs index 4e5e3d821..774003793 100644 --- a/crates/session/src/lib.rs +++ b/crates/session/src/lib.rs @@ -404,12 +404,12 @@ where } #[inline] fn build_cookie(&self, secure: bool, cookie_value: String) -> Cookie<'static> { - let mut cookie = Cookie::build(self.cookie_name.clone(), cookie_value) + let mut cookie = Cookie::build((self.cookie_name.clone(), cookie_value)) .http_only(true) .same_site(self.same_site_policy) .secure(secure) .path(self.cookie_path.clone()) - .finish(); + .build(); if let Some(ttl) = self.session_ttl { cookie.set_expires(Some((std::time::SystemTime::now() + ttl).into()));