Skip to content

Reduce OAuth session TTLs to 5 minutes#1597

Merged
hiddeco merged 1 commit intomainfrom
fix/oauth-session-ttl-5min
Mar 16, 2026
Merged

Reduce OAuth session TTLs to 5 minutes#1597
hiddeco merged 1 commit intomainfrom
fix/oauth-session-ttl-5min

Conversation

@hiddeco
Copy link
Collaborator

@hiddeco hiddeco commented Mar 11, 2026

The init-session and redirect-session TTLs were 30 min and 24 h respectively — far longer than needed for an interactive OAuth flow. This tightens both to 5 minutes via each model's default_expires_at() static method, which flow_service.py now calls instead of computing inline timedelta values.

The test suite is strengthened with bracket assertions that pin the 5-minute window, covering both the model helpers and the service methods that consume them. The fake flow service is updated to match the new TTL.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@hiddeco hiddeco force-pushed the fix/oauth-session-ttl-5min branch from a01f5de to 7797147 Compare March 11, 2026 15:17
@hiddeco hiddeco force-pushed the fix/oauth-session-ttl-5min branch from 7797147 to 9dc40fb Compare March 11, 2026 15:56
@hiddeco hiddeco requested a review from orhanrauf March 11, 2026 21:00
@hiddeco hiddeco force-pushed the fix/oauth-session-ttl-5min branch from 9dc40fb to ec9aca1 Compare March 12, 2026 09:21
Comment on lines 324 to +354
@@ -333,8 +351,7 @@ async def create_proxy_url(
Returns:
(proxy_url, proxy_expires, redirect_session_id)
"""
proxy_ttl = 1440 # 24 hours
proxy_expires = datetime.now(timezone.utc) + timedelta(minutes=proxy_ttl)
proxy_expires = RedirectSession.default_expires_at()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

The init-session and redirect-session TTLs were 30 min and
24 h respectively — far longer than needed for an interactive
OAuth flow. This tightens both to 5 minutes via each model's
`default_expires_at()` static method, which `flow_service.py`
now calls instead of computing inline `timedelta` values.

The test suite is strengthened with bracket assertions that
pin the 5-minute window, covering both the model helpers and
the service methods that consume them. The fake flow service
is updated to match the new TTL.
@hiddeco hiddeco force-pushed the fix/oauth-session-ttl-5min branch from b2bbbf6 to 6b9ffa4 Compare March 16, 2026 10:04
@hiddeco hiddeco merged commit a5b5fc7 into main Mar 16, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Related to security, vulnerabilities, or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants