Skip to content

security: revalidate every unlock invariant immediately before SIGTERM #9

Closed

Description

@abruption

Problem

unlockThread() performs a strong initial inspection, but the final check before SIGTERM only verifies the owner PID/start time, the held lock, and the current opener. While the transcript is hashed and process evidence is collected, the owner can start new work, become a shared service, or acquire another thread lock.

The post-termination transcript hash detects some races only after the process has already been signaled.

Security impact

A session that was safe during the initial stability window can become active or otherwise unsafe before termination. The tool could then interrupt work despite its fail-closed contract.

Required behavior

Immediately before SIGTERM, revalidate every mutable safety invariant used to authorize termination:

  • same PID, process start time, UID, Codex identity, and non-shared-service status
  • same lock inode and actual held advisory lock
  • exactly one stable opener
  • owner still holds only the intended native thread lock
  • transcript remains the same stable file and still ends in event_msg/task_complete

Any changed or unavailable evidence must return refused with a structured reason. The remaining syscall-level race should be documented as requiring an upstream cooperative handoff for complete elimination.

Tests

Use real advisory locks and cover:

  • a new transcript record arriving during revalidation
  • the owner acquiring another thread lock
  • process identity or arguments changing
  • the lock inode or owner changing before signal
  • no SIGTERM when any invariant changes

Activity

  1. added
    bug
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions