Skip to content

Commit

Permalink
chore(deps): update cookie requirement from 0.17 to 0.18 (#448)
Browse files Browse the repository at this point in the history
* 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](rwf2/cookie-rs@0.17.0...0.17.0)

---
updated-dependencies:
- dependency-name: cookie
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chrislearn Young <[email protected]>
  • Loading branch information
dependabot[bot] and chrislearn authored Oct 10, 2023
1 parent 5a95482 commit cfff25d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions crates/csrf/src/cookie_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
8 changes: 4 additions & 4 deletions crates/flash/src/cookie_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
}
}
4 changes: 2 additions & 2 deletions crates/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit cfff25d

Please sign in to comment.