Skip to content

fix: case registry duplicate Case Nos and override proof bypass - #104

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-issues-8af4
Draft

fix: case registry duplicate Case Nos and override proof bypass#104
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-issues-8af4

Conversation

@cursor

@cursor cursor Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two critical correctness bugs found in recent litigation/executive changes.

Bug 1: Duplicate / stale Case Nos (litigation/run.py)

Impact: Every transcript saved without an existing courtroom/case-registry.yaml received the same Case No (YYYY-DEL-001-001). Concurrent saves could also corrupt the registry or assign duplicate numbers via unlocked read-modify-write.

Root cause: allocate_case_no() returned a hardcoded number when the registry was missing and wrote updates without file locking.

Fix: Create the registry on first use, use fcntl exclusive locking with fsync, and reset per-category counters on calendar year rollover.

Bug 2: Executive override auth bypass (executive/watchdog.py)

Impact: Override actions bypassed judicial approval checks if action_type contained "override" or any non-empty override_proof was present — no HMAC verification was performed. An attacker could log rogue overrides with a fake proof string.

Root cause: Watchdog only checked for presence of proof, never called OverrideProof.verify().

Fix: Override actions now require a valid HMAC proof; unapproved non-override actions still alert as before.

Validation

  • python3 -m pytest tests/ — 66 passed
  • New tests cover missing registry creation, concurrency uniqueness, year rollover, override-without-proof, and invalid override proof
Open in Web View Automation 

- allocate_case_no: create registry when missing instead of returning a
  fixed DEL-001; add fcntl exclusive lock and fsync to prevent duplicate
  Case Nos under concurrent transcript saves; reset counters on year rollover
- watchdog: require OverrideProof.verify() for override actions instead of
  accepting any non-empty proof string or action_type containing 'override'
- Add regression tests for missing registry, concurrency, year rollover,
  invalid override proofs

Co-authored-by: Jack J Burleson // LJM <Exios66@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant