Session Management API¶
Auto-generated API documentation for web session management.
Terminology
This module manages workspace identification through browser cookies. Despite the module name "session", it primarily handles workspace IDs for data isolation rather than conversation sessions.
session ¶
Session management functions for PitLane AI web application.
Note: In this module, 'session_id' refers to the workspace identifier (UUID stored in browser cookie), which is distinct from the 'agent_session_id' (Claude SDK session ID for conversation resumption).
validate_session_safely(session) ¶
Validate session with constant-time checks to prevent timing attacks.
Performs validation checks in a consistent order regardless of where validation fails, making it harder for attackers to probe for valid session IDs.
| PARAMETER | DESCRIPTION |
|---|---|
session | Session ID from cookie (may be None) TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
bool | Tuple of (is_valid, session_id) |
str | None |
|
tuple[bool, str | None] |
|
Source code in packages/pitlane-web/src/pitlane_web/session.py
update_workspace_metadata_safe(session_id) ¶
Safely update workspace metadata with proper error logging.
| PARAMETER | DESCRIPTION |
|---|---|
session_id | Session ID to update TYPE: |