The skills-door token was minted with a 24 h TTL and nothing revoked it sooner, so a mission that finished in twenty minutes left a live credential in its container for the rest of the day. auth_sessions gains mission_id (ON DELETE CASCADE, so a purge revokes too); mint_scoped_for_mission records it; revoke_mission_sessions deletes it. Revocation runs on both terminal paths — the runner's close (RETURNING the closed ids) and the operator's stop — and says how many it cleared. Granularity is the mission, not the phase: the container and its door are installed once per mission and serve every phase. Lingering Authority (arXiv 2606.22504) is the reference. Tests: a minted token authenticates for its scope and not as a full session, is dead after revoke, and another mission's token is untouched; the harness gatepolicy scenario now runs on the index arm and asserts the server revoked ≥1, no row carries the mission, and the door answers 401 to the token. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WZb5A2kfVfjpdwSochkuHz
21 lines
1002 B
SQL
21 lines
1002 B
SQL
-- Which mission a scoped session was minted for, so it can be revoked when
|
|
-- the mission ends.
|
|
--
|
|
-- The skills-door token is minted once per mission with a 24 h TTL — long
|
|
-- enough to outlive the longest mission — and nothing revoked it sooner. A
|
|
-- mission that finished in twenty minutes left a live credential in its
|
|
-- container for the other twenty-three hours: Lingering Authority (arXiv
|
|
-- 2606.22504) is the paper on exactly this, and its fix is a capability
|
|
-- bound to the task that ends with it.
|
|
--
|
|
-- ON DELETE CASCADE, so purging a mission revokes its sessions with it.
|
|
ALTER TABLE auth_sessions
|
|
ADD COLUMN IF NOT EXISTS mission_id UUID REFERENCES missions (id) ON DELETE CASCADE;
|
|
|
|
CREATE INDEX IF NOT EXISTS auth_sessions_mission_idx
|
|
ON auth_sessions (mission_id)
|
|
WHERE mission_id IS NOT NULL;
|
|
|
|
COMMENT ON COLUMN auth_sessions.mission_id IS
|
|
'The mission this session was minted for; revoked when it reaches a terminal status. NULL for user and service sessions.';
|