Skip to content

Make Casework review audit tables tamper-evident #1208

Description

@jeremi

Casework's review audit tables are append-only by convention only, with no database-enforced tamper evidence. As of PR #1189, casework_review_history, casework_review_accountability, and casework_review_terminal_events are defined in crates/registry-casework/migrations/0015_unified_reviews.sql (around lines 234, 278, and 292 respectively) with no REVOKE, no row-level security policy, and no BEFORE UPDATE/BEFORE DELETE trigger refusing mutation. Separately, casework_review_accountability has a foreign key only to casework_review_requests(request_id); despite carrying a task_id column, it has no foreign key to casework_review_tasks or to any decisions table.

Failure scenario: any code path with a database connection at sufficient privilege (an operational script, a future migration, a bug in a bulk-repair tool) can silently UPDATE or DELETE a row in these tables, and nothing at the schema level would refuse it or record that it happened, undermining the tables' purpose as an accountability trail for who decided what and when.

Suggested fix:

  • Add a role-level REVOKE UPDATE, DELETE (or row-level security) on these tables for the application role, with an explicit escape hatch for the retention sweep's own erasure path.
  • Add the missing (task_id, request_id) foreign key from casework_review_accountability to casework_review_tasks.

Filed from the review of #1189; not merge-blocking.

Activity

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

    area:caseworkRegistry Casework runtime, tooling, and clientsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions