Loading
Refactor security policy bot permissions to use YAML format
Summary
We want to enable security policy bot users to download artifacts. In order to do this, we need to implement these steps:
➡️ This MR: Refactor security bot user permissions to use YAML format so we can see all permissions in one place- Change security policy bot role from guest to minimal access
- Grant the
api_accesspermission
More details here: #577916 (closed)
What does this MR do?
-
Refactors bot permissions to YAML format — Moves the bot's project-scoped permissions from three hardcoded
DeclarativePolicyrules intoconfig/authz/roles/security_policy_bot.yml, following the pattern used byauditor.ymland other role files. -
Adds:read_buildpermission — Required for artifact downloads (reading build information). -
Adds
prevent :create_vulnerability_state_transitionto the~security_dashboard_enabledblock — Ensures this permission is correctly gated when the security dashboard feature is disabled.
There should be no user visible change.
Behavioral changes
- DAST scan permissions are now additionally gated by
project_allowed_for_job_token_by_scope— Previously gated only onon_demand_scans_enabled & security_policy_bot, now also requires job token scope when authenticating via CI job token. This is a slight tightening (more secure). The~on_demand_scans_enabledprevent rule still blocks DAST when the feature is disabled.
Permissions in YAML role file
| Permission | Purpose | Previously |
|---|---|---|
build_download_code |
Download build artifacts | Existing |
create_bot_pipeline |
Create bot-triggered pipelines | Existing |
create_on_demand_dast_scan |
Trigger on-demand DAST scans | Existing (moved) |
create_pipeline |
Create CI pipelines | Existing |
create_vulnerability_state_transition |
Transition vulnerability states | Existing (moved) |
read_build |
Read build/job information | New |
read_on_demand_dast_scan |
Read DAST scan results | Existing (moved) |
MR acceptance checklist
- Tests added for new behavior (
read_build, DAST permissions) - All pre-commit hooks pass (rubocop, yamllint, secrets-detection, permissions_docs)
- Follows existing patterns (
auditor.ymlfor YAML role)
Related to #577916 (closed)
Edited by Andy Schoenen