-
Notifications
You must be signed in to change notification settings - Fork 2
Update the Session on Reads #184
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice find/fix! Just one requested change inline.
web/src/lib.rs
Outdated
.with_secure(app_state.config.is_production()) | ||
.with_same_site(tower_sessions::cookie::SameSite::Lax) // Assists in CSRF protection | ||
.with_expiry(Expiry::OnInactivity(Duration::days(1))); | ||
.with_expiry(Expiry::OnInactivity(Duration::days(1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add this as a new AppState Config variable that we could set on the command line or env var? The default should still be 1 day which means we won't need to change our entrypoint.sh flags when it starts up refactor_platform_rs, nor set an env var in GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Feel free to merge and deploy after fixing the cargo fmt
issue.
# API version to use between frontend and backend | ||
BACKEND_API_VERSION=${{ vars.BACKEND_API_VERSION }} | ||
# Session expiry duration in seconds (default: 24 hours = 86400 seconds) | ||
BACKEND_SESSION_EXPIRY_SECONDS=${{ vars.BACKEND_SESSION_EXPIRY_SECONDS }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this, going above and beyond!
- Add backend_session_expiry_seconds field to Config with default 86400 seconds (24 hours) - Update session layer to use config value instead of hardcoded Duration::days(1) - Add BACKEND_SESSION_EXPIRY_SECONDS environment variable to deployment pipeline - Update docker-compose.yaml and entrypoint.sh to pass session expiry parameter - Update .env.local with default session expiry configuration This allows flexible session timeout configuration for different environments while maintaining backward compatibility with 24-hour default. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
7a8bb3e
to
a9e91ac
Compare
Description
This PR updates our Session configuration to use
with_always_save(true)
From the docs
GitHub Issue: [Fixes] #179
Changes
with_always_save(true)
Testing Strategy
I tested this locally by changing the expiry to 1 minute and:
Concerns
It's not clear why
with_always_save(true)
works andsave()
didn't. I didn't look too deeply. My guess issave()
bypasses updating the relevant internals of the session data structure.