Skip to content

Commit c175efb

Browse files
authored
fix(controlplane): allow workflow-scoped API tokens in find-or-create (#3123)
1 parent 239ba82 commit c175efb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/controlplane/internal/service/attestation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ func (s *AttestationService) FindOrCreateWorkflow(ctx context.Context, req *cpAP
757757
return nil, errors.NotFound("not found", "neither robot account nor API token found")
758758
}
759759

760-
// Workflow-scoped API tokens cannot create or look up other workflows.
761-
if token := entities.CurrentAPIToken(ctx); token != nil && token.WorkflowID != nil {
760+
// Workflow-scoped API tokens may only target their own workflow.
761+
if token := entities.CurrentAPIToken(ctx); token != nil && token.WorkflowName != nil && *token.WorkflowName != req.GetWorkflowName() {
762762
return nil, errors.Forbidden("forbidden", "API token is workflow-scoped and cannot create or look up other workflows")
763763
}
764764

0 commit comments

Comments
 (0)