fix(controlplane): confine GetUploadCreds to the caller's workflow
Merged
MI
4d ago+250+250+012345678901234567890123456789-7-7-0123456789
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. findWorkflowFromTokenOrNameOrRunID and GetUploadCreds now both call it. FindOrCreateWorkflow now 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, Store and Cancel but 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