fix(security): enforce checkpoint data integrity validation before rollback #8991

Open
opened 2026-04-14 04:35:41 +00:00 by HAL9000 · 1 comment
Owner

Background and Context

The v3.3.0 checkpoint system persists plan state snapshots to storage for later rollback via plan rollback. If checkpoint data is tampered with — either on disk or in the database — a malicious actor could craft a checkpoint that restores a plan to an attacker-controlled state, potentially injecting malicious actions, bypassing read-only enforcement, or restoring credentials that should have been revoked. Checkpoint data must be cryptographically validated before restoration to ensure integrity and authenticity.

Acceptance Criteria

  • Each checkpoint is signed with an HMAC (using a server-side secret) at creation time; the signature is stored alongside the checkpoint payload
  • plan rollback <checkpoint_id> verifies the HMAC signature before restoring any state; tampered checkpoints are rejected with a CheckpointIntegrityError
  • Checkpoint payloads are validated against a schema before restoration (required fields, type checks, no unexpected keys)
  • Authorization check ensures the user owns the plan associated with the checkpoint before rollback is permitted
  • Integrity validation failures are logged to the security audit log with checkpoint_id, user_id, and failure reason
  • Test coverage >= 97%

Subtasks

  • Add CheckpointSigner utility that generates and verifies HMAC-SHA256 signatures for checkpoint payloads
  • Update CheckpointService.create() to sign the checkpoint payload before persisting
  • Update CheckpointService.restore() to verify the HMAC signature before any state restoration
  • Add CheckpointPayloadValidator that validates checkpoint schema (required fields, type constraints) before restoration
  • Add CheckpointIntegrityError error type with checkpoint_id, failure_reason, and user_id fields
  • Add authorization check in CheckpointService.restore() verifying plan ownership
  • Add integrity failure logging to the security audit log
  • Add docs/reference/checkpoint_security.md documenting the signing and validation model
  • Tests (Behave): Add features/security_checkpoint_integrity.feature scenarios including tampered checkpoint scenarios
  • Tests (Robot): Add robot/security_checkpoint_integrity.robot integration tests
  • Tests (ASV): Add benchmarks/security_checkpoint_integrity_bench.py for signing/verification overhead
  • Verify coverage >= 97% via nox -s coverage_report; iterate until passing
  • Run nox (all default sessions including benchmark), fix any errors

Definition of Done

  • All acceptance criteria met
  • Tests written and passing (coverage >= 97%)
  • Code reviewed and approved
  • Documentation updated if needed
  • No regressions introduced

Metadata

  • Commit message: fix(security): enforce checkpoint data integrity validation before rollback
  • Branch name: fix/security-checkpoint-integrity

Automated by CleverAgents Bot
Supervisor: Epic Planning Pool | Agent: epic-planning-pool-supervisor

## Background and Context The v3.3.0 checkpoint system persists plan state snapshots to storage for later rollback via `plan rollback`. If checkpoint data is tampered with — either on disk or in the database — a malicious actor could craft a checkpoint that restores a plan to an attacker-controlled state, potentially injecting malicious actions, bypassing read-only enforcement, or restoring credentials that should have been revoked. Checkpoint data must be cryptographically validated before restoration to ensure integrity and authenticity. ## Acceptance Criteria - [ ] Each checkpoint is signed with an HMAC (using a server-side secret) at creation time; the signature is stored alongside the checkpoint payload - [ ] `plan rollback <checkpoint_id>` verifies the HMAC signature before restoring any state; tampered checkpoints are rejected with a `CheckpointIntegrityError` - [ ] Checkpoint payloads are validated against a schema before restoration (required fields, type checks, no unexpected keys) - [ ] Authorization check ensures the user owns the plan associated with the checkpoint before rollback is permitted - [ ] Integrity validation failures are logged to the security audit log with checkpoint_id, user_id, and failure reason - [ ] Test coverage >= 97% ## Subtasks - [ ] Add `CheckpointSigner` utility that generates and verifies HMAC-SHA256 signatures for checkpoint payloads - [ ] Update `CheckpointService.create()` to sign the checkpoint payload before persisting - [ ] Update `CheckpointService.restore()` to verify the HMAC signature before any state restoration - [ ] Add `CheckpointPayloadValidator` that validates checkpoint schema (required fields, type constraints) before restoration - [ ] Add `CheckpointIntegrityError` error type with checkpoint_id, failure_reason, and user_id fields - [ ] Add authorization check in `CheckpointService.restore()` verifying plan ownership - [ ] Add integrity failure logging to the security audit log - [ ] Add `docs/reference/checkpoint_security.md` documenting the signing and validation model - [ ] Tests (Behave): Add `features/security_checkpoint_integrity.feature` scenarios including tampered checkpoint scenarios - [ ] Tests (Robot): Add `robot/security_checkpoint_integrity.robot` integration tests - [ ] Tests (ASV): Add `benchmarks/security_checkpoint_integrity_bench.py` for signing/verification overhead - [ ] Verify coverage >= 97% via `nox -s coverage_report`; iterate until passing - [ ] Run `nox` (all default sessions including benchmark), fix any errors ## Definition of Done - [ ] All acceptance criteria met - [ ] Tests written and passing (coverage >= 97%) - [ ] Code reviewed and approved - [ ] Documentation updated if needed - [ ] No regressions introduced ## Metadata - **Commit message:** `fix(security): enforce checkpoint data integrity validation before rollback` - **Branch name:** `fix/security-checkpoint-integrity` --- **Automated by CleverAgents Bot** Supervisor: Epic Planning Pool | Agent: epic-planning-pool-supervisor
Author
Owner

Verified — Security fix: checkpoint data integrity validation before rollback is required to prevent corrupt state restoration. MoSCoW: Must-have. Priority: High — security and data integrity concern.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — Security fix: checkpoint data integrity validation before rollback is required to prevent corrupt state restoration. MoSCoW: Must-have. Priority: High — security and data integrity concern. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
HAL9000 added this to the v3.3.0 milestone 2026-04-14 05:31:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8991
No description provided.