Skip to content

fix: watchdog override verification and case registry allocation - #107

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

fix: watchdog override verification and case registry allocation#107
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-issues-5b31

Conversation

@cursor

@cursor cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Critical correctness fixes from the nightly bug-finding automation.

Bug 1: Executive watchdog auth bypass (security)

Impact: Unapproved executive actions could pass watchdog checks without valid cryptographic proof, violating executive/protocol.md.

Root cause: run_checks() skipped approval validation when action_type contained "override", and treated any non-empty override_proof as sufficient without calling OverrideProof.verify().

Fix: Require ruling_id on all actions; for unapproved rulings, verify HMAC proof via OverrideProof.verify() and alert on missing/invalid proof. Added regression tests for override-without-proof, fake proof, valid proof, and missing ruling_id.

Bug 2: Duplicate Case Nos from allocate_case_no (data integrity)

Impact: When courtroom/case-registry.yaml was missing, every litigation save received YYYY-DEL-001-001. Concurrent saves could also read-modify-write the registry non-atomically and assign duplicate Case Nos.

Root cause: Introduced in #66 — missing-registry fallback returned a static case number without persisting state; registry updates used non-atomic full-file overwrites.

Fix: Initialize the registry on first allocation; use fcntl exclusive file locking around read-modify-write. Added regression test for missing-registry initialization.

Validation

  • python3 -m pytest tests/ — 65 passed
Open in Web View Automation 

- Verify OverrideProof for unapproved executive actions instead of
  accepting any truthy proof or skipping checks when action_type
  contains 'override'
- Alert on actions missing ruling_id
- Initialize case-registry.yaml on first allocation and use file
  locking to prevent duplicate Case Nos under concurrent saves

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