You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(web): make session and OAuth token lifetimes configurable (#1162)
* chore(web): make session and OAuth token lifetimes configurable
- Auth.js JWT browser sessions now respect `AUTH_SESSION_MAX_AGE_SECONDS`
and `AUTH_SESSION_UPDATE_AGE_SECONDS` (defaults: 30 days / 1 day,
matching Auth.js's own defaults).
- OAuth flow TTLs (authorization code, access token, refresh token) now
respect `OAUTH_AUTHORIZATION_CODE_TTL_SECONDS`,
`OAUTH_ACCESS_TOKEN_TTL_SECONDS`, and `OAUTH_REFRESH_TOKEN_TTL_SECONDS`
(defaults: 10 minutes / 1 hour / 90 days, matching the previously
hard-coded values).
Defaults preserve today's behavior; operators who want shorter sessions
can lower these values without code changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: add CHANGELOG entry for #1162
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: mock env in oauth server tests
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
19
### Changed
20
20
- Added `/api/avatar` to resolve user profile pictures. [#1159](https://github.com/sourcebot-dev/sourcebot/pull/1159)
21
21
- Hardened post-auth redirects with an explicit same-origin `redirect` callback in the NextAuth config, and switched the legacy `/~/...` URL rewrite from a 308 to a 301. [#1161](https://github.com/sourcebot-dev/sourcebot/pull/1161)
22
+
- Made the Auth.js JWT session lifetime and OAuth token TTLs configurable via `AUTH_SESSION_MAX_AGE_SECONDS`, `AUTH_SESSION_UPDATE_AGE_SECONDS`, `OAUTH_AUTHORIZATION_CODE_TTL_SECONDS`, `OAUTH_ACCESS_TOKEN_TTL_SECONDS`, and `OAUTH_REFRESH_TOKEN_TTL_SECONDS`. Defaults preserve existing behavior. [#1162](https://github.com/sourcebot-dev/sourcebot/pull/1162)
22
23
23
24
### Fixed
24
25
- Bumped `postcss` to `8.5.10`. [#1155](https://github.com/sourcebot-dev/sourcebot/pull/1155)
Copy file name to clipboardExpand all lines: docs/docs/configuration/environment-variables.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,11 @@ The following environment variables allow you to configure your Sourcebot deploy
13
13
|`AUTH_CREDENTIALS_LOGIN_ENABLED`|`true`| <p>Enables/disables authentication with basic credentials. Username and passwords are stored encrypted at rest within the postgres database. Checkout the [auth docs](/docs/configuration/auth/overview) for more info</p> |
14
14
|`AUTH_EMAIL_CODE_LOGIN_ENABLED`|`false`| <p>Enables/disables authentication with a login code that's sent to a users email. `SMTP_CONNECTION_URL` and `EMAIL_FROM_ADDRESS` must also be set. Checkout the [auth docs](/docs/configuration/auth/overview) for more info </p> |
15
15
|`AUTH_SECRET`| Automatically generated at startup if no value is provided. Generated using `openssl rand -base64 33`| <p>Used to validate login session cookies</p> |
16
+
|`AUTH_SESSION_MAX_AGE_SECONDS`|`2592000` (30 days) | <p>Relative time from now in seconds when to expire the session.</p> |
17
+
|`AUTH_SESSION_UPDATE_AGE_SECONDS`|`86400` (1 day) | <p>How often the session should be updated in seconds. If set to `0`, session is updated every time.</p> |
18
+
|`OAUTH_AUTHORIZATION_CODE_TTL_SECONDS`|`600` (10 minutes) | <p>Lifetime of an OAuth authorization code, in seconds.</p> |
19
+
|`OAUTH_ACCESS_TOKEN_TTL_SECONDS`|`3600` (1 hour) | <p>Lifetime of an OAuth access token, in seconds.</p> |
20
+
|`OAUTH_REFRESH_TOKEN_TTL_SECONDS`|`7776000` (90 days) | <p>Lifetime of an OAuth refresh token, in seconds.</p> |
16
21
|`AUTH_URL`| - | <p>URL of your Sourcebot deployment, e.g., `https://example.com` or `http://localhost:3000`.</p> |
17
22
|`CONFIG_PATH`|`-`| <p>The container relative path to the declarative configuration file. See [this doc](/docs/configuration/declarative-config) for more info.</p> |
18
23
|`DATA_CACHE_DIR`|`$DATA_DIR/.sourcebot`| <p>The root data directory in which all data written to disk by Sourcebot will be located.</p> |
0 commit comments