Repository navigation
fix(controlplane): confine GetUploadCreds to the caller's workflow - #3871
Conversation
GetUploadCreds resolved the workflow run directly and only checked project-level RBAC, so a workflow-scoped API token could get CAS uploader credentials for runs of other workflows in its project, and a legacy robot account for runs of any workflow in its organization. Apply the same workflow-scope check the other attestation handlers use. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 4ecc43f0-f57e-4f64-a240-ef1697c0a6b0
PR validation — ✅ 3 passing
AI Session Checks — 🟢 89% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/controlplane/internal/service/attestation_integration_test.go |
+209 / -4 |
| modified | ai | app/controlplane/internal/service/attestation.go |
+41 / -3 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-4ecc43 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-4ecc43 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-4ecc43 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-4ecc43 |
- |
Security Checks — ✅ 6 passing
✅ AI Security Analysis
Reviewed this change against the project's security context (35 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
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
A legacy robot account skips project-level RBAC, so FindOrCreateWorkflow let it update the contract of any workflow in its organization or create new workflows. Bind it to its own workflow, like the other attestation handlers. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 4ecc43f0-f57e-4f64-a240-ef1697c0a6b0
|
Are legacy robot accounts still supported? it could be a good moment to drop them. |
|
Merged by eng-autopilot: approved by jiparis; no change request; CI passed (16 check runs, 3 workflow runs); GitHub merge state clean; no Greptile review. 🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri, using the eng-autopilot skill |
Two attestation handlers did not confine callers that are pinned to a single workflow.
AttestationService.GetUploadCredsresolved the workflow run straight from the request and only applied project-level RBAC. It never ran the workflow-scope check that the other handlers get throughfindWorkflowFromTokenOrNameOrRunID. A workflow-scoped API token could get CAS uploader credentials for runs of other workflows in its project. A legacy robot account, which skips project RBAC, could get them for runs of any workflow in its organization.AttestationService.FindOrCreateWorkflowchecked the workflow scope of API tokens but not of legacy robot accounts. A robot account could update the contract of any workflow in its organization, or create new workflows.This change moves the workflow-scope check into
checkCallerWorkflowScope.findWorkflowFromTokenOrNameOrRunIDandGetUploadCredsnow both call it.FindOrCreateWorkflownow lets a legacy robot account reach only its bound workflow, and never create one. Org-scoped API tokens and federated credentials are unchanged.This completes #3464, which confined legacy robot accounts for
Init,StoreandCancelbut not for these two handlers.AI disclosure: this change was made with the assistance of Claude Code.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri