fix(audit): protect AuditService._ensure_session() with threading.Lock #1224

Closed
brent.edwards wants to merge 4 commits from bugfix/m7-audit-session-race into master

4 Commits

Author SHA1 Message Date
CleverAgents Bot af12cab9a0 ci: stop master workflow on PR updates
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / security (pull_request) Has been cancelled
CI / quality (pull_request) Has been cancelled
CI / unit_tests (pull_request) Has been cancelled
CI / integration_tests (pull_request) Has been cancelled
CI / e2e_tests (pull_request) Has been cancelled
CI / coverage (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / helm (pull_request) Has been cancelled
CI / push-validation (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
Remove the stale pull_request trigger from master.yml so PR branch commits do not launch the master workflow.

Maintenance patch for PR #1224.
2026-06-10 20:25:07 -04:00
controller-ci-rerun f4dc0746f9 chore: re-trigger CI [controller]
CI / lint (pull_request) Successful in 35s
CI / build (pull_request) Successful in 34s
CI / benchmark-publish (pull_request) Has been skipped
CI / typecheck (pull_request) Successful in 1m4s
CI / quality (pull_request) Successful in 1m6s
CI / helm (pull_request) Successful in 23s
CI / security (pull_request) Successful in 1m14s
CI / push-validation (pull_request) Successful in 39s
CI / e2e_tests (pull_request) Successful in 3m52s
CI / unit_tests (pull_request) Failing after 6m8s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 17m37s
CI / status-check (pull_request) Has been cancelled
2026-05-29 14:21:47 -04:00
HAL9000 290e964f46 fix(audit): protect AuditService._ensure_session() with threading.Lock
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 37s
CI / helm (pull_request) Successful in 45s
CI / build (pull_request) Successful in 1m13s
CI / lint (pull_request) Successful in 1m22s
CI / quality (pull_request) Successful in 1m44s
CI / typecheck (pull_request) Successful in 2m9s
CI / security (pull_request) Successful in 2m15s
CI / integration_tests (pull_request) Successful in 5m1s
CI / e2e_tests (pull_request) Successful in 5m59s
CI / unit_tests (pull_request) Failing after 7m32s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
Document pre-existing type: ignore suppressions in _row_to_entry() with
reference to follow-up tracking issue #10854.

ISSUES CLOSED: #991
2026-04-29 21:26:34 +00:00
HAL9000 9a3ad6da66 fix(audit): protect AuditService._ensure_session() with threading.Lock
Rebased onto current master and re-applied the threading.Lock fix to the
updated version of _ensure_session() introduced by the async write-behind
refactor (#1279). The fix is now more critical because the background
audit-writer thread calls _ensure_session() via _write_payload(), making
the TOCTOU race actively exploitable rather than theoretical.

Changes:
- Added self._session_lock = threading.Lock() to __init__()
- Wrapped _ensure_session() session creation with double-checked locking
- Updated step file to use audit_async=False to avoid background thread
  interference with the race test
- Resolved import conflict (kept both import queue and import threading)

ISSUES CLOSED: #991
2026-04-29 21:26:34 +00:00