fix(controlplane): confine legacy robot accounts to their bound workflow

Merged
JI
2mo ago
+161-0

Legacy robot accounts are scoped to a single workflow, but the attestation handlers resolved the workflow from the request alone (project/workflow name, or run ID) and never compared it to the workflow encoded in the credential. Any robot account could therefore operate on every workflow in its organization through GetContract, Init, Store and Cancel. Attestation endpoints are skipped by the authz middleware and RBAC is disabled for robot accounts, so the handler is the only authorization point on this path.

This applies the binding in findWorkflowFromTokenOrNameOrRunID, mirroring the check already in place for workflow-scoped API tokens and the equivalent one in AttestationStateService.

usercontext.RobotAccount is a carrier shared with the API-token and federated middlewares, which populate it without a workflow. The binding is therefore conditional on a workflow being present, so those callers are unaffected.

Robot accounts can no longer be issued and there is no revoke path left in the product, so existing credentials have to be confined by the handler.


AI assistance: this change was produced with Claude Code.