Use composite oauth token for Duo Workflows CI execution
What does this MR do and why?
Summary of Changes
This merge request adds support for service accounts to execute Duo Workflows in CI/CD pipelines. The key changes include:
- Modifying the workflow policy to allow service accounts to access and update workflows they don't own
- Creating a new service that generates composite OAuth access tokens for workflows running in CI
- Updating the API to use these composite tokens instead of regular OAuth tokens based on the
use_service_accountparameter.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Related to #515422 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Onboard duo workflow following steps in !182894 (merged) or via the admin UI.
- Fetch the Duo Workflow service account user,
::Ai::Setting.instance.duo_workflow_service_account_user. - Enable FF
Feature.enable(:duo_workflow, service_account_user) - Manually add developer access for the project where you want to run Duo Workflow.
project.add_developer(service_account_user) - Run a CI workflow, following instructions, it should run without any errors. This workflow will use composite identity token for accessing all the GitLab apis and git tools.
Edited by Surabhi Suman