Repository navigation
fix(controlplane): apply workflow-scoped credentials to attestation state RPCs - #3872
Conversation
PR validation — ✅ 3 passing
AI Session Checks — 🟢 90% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| created | ai | app/controlplane/internal/service/attestationstate_integration_test.go |
+259 / -0 |
| modified | ai | app/controlplane/internal/service/attestationstate.go |
+16 / -20 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-0a5f11 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-0a5f11 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-0a5f11 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-0a5f11 |
- |
Security Checks — ✅ 6 passing
✅ AI Security Analysis
Reviewed this change against the project's security context (2 concerns hunted) — no introduced risk found.
View in Chainloop ↗ · How this works ↗
✅ Secret Scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ SAST Scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
Scans not applied (3)
| Scan | Reason |
|---|---|
| Vulnerability Scan | no manifest/lockfile changed |
| GitHub Actions Scan | no workflow files changed |
| IaC Scan | no IaC files changed |
Powered by Chainloop and Chainloop Trace
…tate RPCs A workflow-scoped API token could read, overwrite or reset the remote attestation state of a run that belongs to another workflow in the same project. AttestationStateService (Initialized, Save, Read, Reset) resolved the workflow from the run ID and checked only project RBAC, so the token's workflow scope was never applied. Call the shared caller workflow scope check from these handlers. The attestation state service now always resolves the workflow from the run, so it no longer needs the workflow use case. Fixes SEC-3114 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 0a5f115f-a0cb-4013-b6a2-1635aaeb3aa4
2756a04 to
0088063
Compare
A workflow-scoped API token could act on the remote attestation state of a run that belongs to another workflow in the same project. Through
AttestationStateServiceInitialized,Save,ReadandReset, the caller could check whether another workflow's run has remote state, overwrite it (which breaks the owner's attestation, because the owner can no longer decrypt it) or delete it.These handlers got the workflow from the run ID and checked only project RBAC. Both workflows are in the same project, so that check passed, and the token's workflow scope was never applied.
This change calls the shared caller workflow scope check (from #3871) from these handlers. The check covers workflow-scoped API tokens and legacy robot accounts. The attestation state service now always gets the workflow from the run, so it no longer needs the workflow use case.
Fixes SEC-3114.
This PR was written with AI assistance (Claude Code).
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri