Take the AutoFlow namespace from the token-exchange JWT

See commits 🕵️

This answers @ash2k's thread on gitlab-org/gitlab!267945 (merged) that we should take the namespace from the token rather than let the caller specify it. The token-exchange listener now requires namespace_id to be the token's organization (gitlab.origin_id) and returns PermissionDenied otherwise. It is likely thrown away once IAM delegation (gitlab-org/primitives/trigger!10) lands.

The namespace is still in the request: namespace_id is required by its protovalidate rule, which runs before the handler, so falling back to the token's organization when it's empty would need a protos change first. On GetWorkflow, CancelWorkflow and SendToWorkflowChannel the workflow token still decides which workflow is addressed - there the check only keeps a caller in its own rate-limit bucket. On StartWorkflow it stops one organization from starting workflows (and taking idempotency keys) in another's namespace.

Refs gitlab-org/gitlab!267945 (comment 4168912332)

Edited by Timo Furrer

Merge request reports

Loading
Loading