| Target app | drive, without the broad internal-app:session scope so it cannot be used on general Drive, satellite, or account endpoints. Any origin_app: "cli" bearer is refused outside this scoped path and never falls through to browser Drive auth. |
| Parent session check | Issuance verifies the parent private.cli_sessions row is registered, unrevoked, and unexpired (401 if missing/revoked; 503 fail-closed if unavailable). |
| Workspace scope | Bound to a single normalized workspace UUID (workspace_id); using it on another or unresolvable workspace returns HTTP 403. |
| Operation scope | Bound to the requested subset of drive:storage:upload, drive:storage:list, and drive:storage:stat; out-of-scope operations return HTTP 403. |
| Lifetime | Default 5 minutes, hard ceiling 15 minutes (900 seconds), clamped to min(now + ttl, parent CLI exp) at issuance and enforced at verification. ttr drive upload mints a fresh short-lived session before finalize-upload so slow large uploads do not fail at finalization. |
| Permissions & limits | Issuance and every storage route require live manage_drive permission on the target workspace, check account suspension (fail-closed), enforce fail-closed per-user rate limits on issuance, upload, and read (list/stat) routes, and block private/reserved roots and finance transaction namespaces. |
| Token handling | Held in memory only for the command; never written to disk, never printed to stdout/stderr, and never sent to third-party storage provider URLs. |
| Audit | Records private.storage_access_events (sign on cli-session, upload on upload-url/finalize-upload, list on list/stat) and structured native console.info('[audit] drive.cli', ...) entries for both allowed and denied outcomes using distinct ops (session_issue, upload_intent, upload_finalized, list, stat) with actor, workspace, target app, path, verified size, and clientSha256 (client-reported; never tokens). |