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

Update Rust crate tower-sessions to ~0.13.0 #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 4, 2023

This PR contains the following updates:

Package Type Update Change
tower-sessions workspace.dependencies minor ~0.7.0 -> ~0.13.0

Release Notes

maxcountryman/tower-sessions (tower-sessions)

v0.13.0

Compare Source

  • Add option to always save session. #​216

v0.12.3

Compare Source

  • Ensure continuously_delete_expired waits for initial run. #​208

v0.12.2

Compare Source

  • Ensure set_expiry mutates Max-Age. #​191

This addresses a bug where using set_expiry on a session with no initial expiry time would not add the Max-age attribute to the cookie leading to an inconsitency between the cookie and the database.

v0.12.1

Compare Source

Important Security Update

  • Ensure ID cycling invokes create. #​188

Because cycling the session ID involves creating a new ID, this must follow the same semantics as normal session creation. Therefore prior to this fix session ID collision could occur through this vector.

v0.12.0

Compare Source

Important Security Update

This release introduces a new method, create, to the SessionStore trait to distinguish between creating a new session and updating an existing one. This distinction is crucial for mitigating the potential for session ID collisions.

Although the probability of session ID collisions is statistically low, given that IDs are composed of securely-random i128 values, such collisions pose a significant security risk. A store that does not differentiate between session creation and updates could inadvertently allow an existing session to be accessed, leading to potential session takeovers.

Session store authors are strongly encouraged to update and implement create such that potential ID collisions are handled, either by generating a new ID or returning an error.

As a transitional measure, we have provided a default implementation of create that wraps the existing save method. However, this default is not immune to the original issue. Therefore, it is imperative that stores override the create method with an implementation that adheres to the required uniqueness semantics, thereby effectively mitigating the risk of session ID collisions.

v0.11.1

Compare Source

  • Ensure session.set_expiry updates record. #​175
  • Provide signed and private features, enabling signing and encryption respectively. #​157

v0.11.0

Compare Source

  • Uses slices when encoding and decoding Id. #​159

Breaking Changes

  • Removes IdError type in favor of using base64::DecodeSliceError. #​159
  • Provides the same changes as 0.10.4, without breaking SemVer.
  • Updates base64 to 0.22.0.

v0.10.4

Compare Source

  • Revert introduction of lifetime parameter; use static lifetime directly

This ensures that the changes introduced in 0.10.3 do not break SemVer.

Please note that 0.10.3 has been yanked in accordance with cargo guidelines.

v0.10.3

Compare Source

  • Improve session config allocation footprint #​158

v0.10.2

Compare Source

  • Ensure "Path" and "Domain" are set on removal cookie #​154

v0.10.1

Compare Source

v0.10.0

Compare Source

Breaking Changes

Session IDs are now represetned as base64-encoded i128s, boast 128 bits of entropy, and are shorter, saving network bandwidth and improving the secure nature of sessions.

We no longer bundle session stores via feature flags and as such applications must be updated to require the stores directly. For example, applications that use the tower-sessions-sqlx-store should update their Cargo.toml like so:

tower-sessions = "0.10.0"
tower-sessions-sqlx-store = { version = "0.10.0", features = ["sqlite"] }

Assuming a SQLite store, as an example.

Furthermore, imports will also need to be updated accordingly. For example:

use std::net::SocketAddr;

use axum::{response::IntoResponse, routing::get, Router};
use serde::{Deserialize, Serialize};
use time::Duration;
use tower_sessions::{session_store::ExpiredDeletion, Expiry, Session, SessionManagerLayer};
use tower_sessions_sqlx_store::{sqlx::SqlitePool, SqliteStore};

const COUNTER_KEY: &str = "counter";

#[derive(Serialize, Deserialize, Default)]
struct Counter(usize);

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let pool = SqlitePool::connect("sqlite::memory:").await?;
    let session_store = SqliteStore::new(pool);
    session_store.migrate().await?;

    let deletion_task = tokio::task::spawn(
        session_store
            .clone()
            .continuously_delete_expired(tokio::time::Duration::from_secs(60)),
    );

    let session_layer = SessionManagerLayer::new(session_store)
        .with_secure(false)
        .with_expiry(Expiry::OnInactivity(Duration::seconds(10)));

    let app = Router::new().route("/", get(handler)).layer(session_layer);

    let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
    let listener = tokio::net::TcpListener::bind(&addr).await?;
    axum::serve(listener, app.into_make_service()).await?;

    deletion_task.await??;

    Ok(())
}

async fn handler(session: Session) -> impl IntoResponse {
    let counter: Counter = session.get(COUNTER_KEY).await.unwrap().unwrap_or_default();
    session.insert(COUNTER_KEY, counter.0 + 1).await.unwrap();
    format!("Current count: {}", counter.0)
}

Finally, the service itself has been moved out of the core crate, which makes this crate smaller as well as establishes better boundaries between code.

Thank you for bearing with us: we are approaching longer term stability and aim to minimize churn going forward as we begin to move toward a 1.0 release.

v0.9.1

Compare Source

  • Ensure clear works before record loading. #​134

v0.9.0

Compare Source

Breakiung Changes

This updates the service such that it always returns a response directly. In practice this means that e.g. axum applications no longer need the HandleErrorLayer and instead can use the layer directly. Note that if you use other fallible tower middleware, you will still need to use HandleErrorLayer.

As such we've also remove the MissingCookies and MissingId variants from the session error enum.

v0.8.2

Compare Source

  • Derive PartialEq for Record. #​125

v0.8.1

Compare Source

  • Allow constructing RedisStore from RedisPool. #​122

v0.8.0

Compare Source

Breaking Changes

Among other things, session methods are now entirely async, meaning applications must be updated to await these methods in order to migrate.

Separately, SessionStore has been updated to use a Record intermediary. As such, SessionStore implementations must be updated accordingly.

Session stores now use a concrete error type that must be used in implementations of SessionStore.

The secure cookie attribute now defaults to true.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.4.1 Update Rust crate tower-sessions to ~0.4.1 - autoclosed Nov 4, 2023
@renovate renovate bot closed this Nov 4, 2023
@renovate renovate bot deleted the renovate/tower-sessions-0.x branch November 4, 2023 21:06
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.4.1 - autoclosed Update Rust crate tower-sessions to ~0.4.1 Nov 11, 2023
@renovate renovate bot reopened this Nov 11, 2023
@renovate renovate bot restored the renovate/tower-sessions-0.x branch November 11, 2023 00:04
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.4.1 Update Rust crate tower-sessions to ~0.4.2 Nov 11, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from d6b9aad to fe5df90 Compare November 11, 2023 00:05
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.4.2 Update Rust crate tower-sessions to ~0.4.3 Nov 11, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from fe5df90 to 107a6b5 Compare November 11, 2023 18:52
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.4.3 Update Rust crate tower-sessions to ~0.5.0 Nov 12, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 107a6b5 to 8f5094c Compare November 12, 2023 22:46
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.5.0 Update Rust crate tower-sessions to ~0.5.1 Nov 15, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 8f5094c to c79ed10 Compare November 15, 2023 19:13
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.5.1 Update Rust crate tower-sessions to ~0.6.0 Nov 18, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from c79ed10 to 8a499aa Compare November 18, 2023 00:15
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.6.0 Update Rust crate tower-sessions to ~0.7.0 Nov 27, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 8a499aa to 54a9986 Compare November 27, 2023 18:32
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.7.0 Update Rust crate tower-sessions to ~0.7.0 - autoclosed Dec 16, 2023
@renovate renovate bot closed this Dec 16, 2023
@renovate renovate bot deleted the renovate/tower-sessions-0.x branch December 16, 2023 18:39
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.7.0 - autoclosed Update Rust crate tower-sessions to ~0.7.0 Dec 21, 2023
@renovate renovate bot restored the renovate/tower-sessions-0.x branch December 21, 2023 16:48
@renovate renovate bot reopened this Dec 21, 2023
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.7.0 Update Rust crate tower-sessions to ~0.8.0 Dec 21, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch 2 times, most recently from 9cc2ee5 to daf8256 Compare December 23, 2023 16:14
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.8.0 Update Rust crate tower-sessions to ~0.8.1 Dec 23, 2023
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from daf8256 to ab4d856 Compare December 24, 2023 04:34
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.8.1 Update Rust crate tower-sessions to ~0.8.2 Dec 24, 2023
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.8.2 Update Rust crate tower-sessions to ~0.9.0 Jan 1, 2024
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.9.0 Update Rust crate tower-sessions to ~0.9.1 Jan 4, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from f9ad1ae to 47e04b1 Compare January 4, 2024 16:11
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 47e04b1 to 3d5c47c Compare January 23, 2024 04:05
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.9.1 Update Rust crate tower-sessions to ~0.10.0 Jan 23, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 3d5c47c to 5480ee7 Compare January 27, 2024 18:22
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.10.0 Update Rust crate tower-sessions to ~0.10.1 Jan 27, 2024
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.10.1 Update Rust crate tower-sessions to ~0.10.2 Feb 6, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 5480ee7 to fd67a8c Compare February 6, 2024 18:37
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from fd67a8c to 8e7903b Compare February 23, 2024 19:57
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.10.2 Update Rust crate tower-sessions to ~0.10.3 Feb 23, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 8e7903b to 8ef0001 Compare February 24, 2024 15:18
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.10.3 Update Rust crate tower-sessions to ~0.10.2 Feb 24, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 8ef0001 to aae8a91 Compare February 24, 2024 19:22
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.10.2 Update Rust crate tower-sessions to ~0.10.4 Feb 24, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from aae8a91 to 916b319 Compare March 5, 2024 04:34
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.10.4 Update Rust crate tower-sessions to ~0.11.0 Mar 5, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 916b319 to 17668e6 Compare March 17, 2024 16:07
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.11.0 Update Rust crate tower-sessions to ~0.11.1 Mar 17, 2024
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.11.1 Update Rust crate tower-sessions to ~0.12.0 Mar 19, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 17668e6 to 6c3d9ff Compare March 19, 2024 22:38
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 6c3d9ff to b2a833e Compare April 1, 2024 01:29
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.12.0 Update Rust crate tower-sessions to ~0.12.1 Apr 1, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from b2a833e to 145200c Compare April 14, 2024 18:31
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.12.1 Update Rust crate tower-sessions to ~0.12.2 Apr 14, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from 145200c to f910b85 Compare May 5, 2024 10:07
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.12.2 Update Rust crate tower-sessions to ~0.12.0 May 5, 2024
@renovate renovate bot force-pushed the renovate/tower-sessions-0.x branch from f910b85 to eda8ace Compare September 3, 2024 19:50
@renovate renovate bot changed the title Update Rust crate tower-sessions to ~0.12.0 Update Rust crate tower-sessions to ~0.13.0 Sep 3, 2024
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.

0 participants