fix: constrain assessment evidence references - #24
Conversation
📝 WalkthroughWalkthroughThe PR tightens maintenance-plan schemas and evidence validation, adds deterministic evidence-state checks, and introduces a guarded protected-controls workflow exception for trusted watcher updates. Administrative evidence snapshots, repository settings, investigation guidance, and tests are updated accordingly. ChangesMaintenance evidence controls
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PullRequest
participant ProtectedControls
participant GitHubAPI
participant EvidenceState
PullRequest->>ProtectedControls: Submit evidence-state change
ProtectedControls->>GitHubAPI: Read commit, workflow run, and last-evidence.json
GitHubAPI-->>ProtectedControls: Return watcher metadata and evidence record
ProtectedControls->>EvidenceState: Validate deterministic record
EvidenceState-->>ProtectedControls: Return healthy validation result
ProtectedControls-->>PullRequest: Allow protected-controls approval
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/protected-controls.yml:
- Around line 85-112: The protected-controls evidence exception currently trusts
the shared github-actions[bot] identity rather than proving the watcher workflow
produced the record. In the protected-controls validation around evidence_run,
add watcher-exclusive GitHub App credential verification and a signed, run-bound
attestation tied to the expected workflow run before accepting the evidence PR;
retain schema and run checks. In docs/repository-settings.md lines 15-19, update
the exception description so it does not claim watcher-only provenance until
this verification is enforced.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 117101b5-4a45-4be0-b38d-61034b89d4bc
📒 Files selected for processing (9)
.github/codex/maintenance/investigation.md.github/workflows/protected-controls.ymldocs/admin-state/php-bin-after.jsondocs/maintenance-admin-evidence.jsondocs/repository-settings.mdmaintenance/control.pyschemas/maintenance-plan.schema.jsonscripts/validate-structured-output-schemastests/test_maintenance.py
Summary
Root causes
evidence[0].github-actions[bot]identity cannot prove which workflow produced a PR.Verification
./scripts/test.sh(15 tests)5cae3543e1f11450ddcf4c2ade2d6351efd19d27and mise-phpb0e3c11ca08ea82c47b87be57fdee56842d31586sha256:e95586e45786af918788b8cb658f4cbeff62e7cef64af0b7f0bcc938839f5d62Safety
Admission remains fail closed. The evidence-state exception requires a same-repository bot PR, an exact protected watcher run ID, an in-progress run on the exact main base SHA, a direct-parent commit changing only the deterministic state file, the reviewed seven healthy captures, and a verified GitHub OIDC/Sigstore attestation from the protected watcher workflow. All other protected changes still require exact-head owner approval.