Skip to content

Include group authorized agents in allowed agents

Tiger Watson requested to merge 323708-enable-authorized-group-agents into master

What does this MR do?

Includes group-level authorized agents in the allowed_agents API response.

Currently an Agent can only be used by CI jobs that are running in the Agent's configuration project. However, an agent can be configured to allow access at the group level, and these groups are not currently considered when generating the list of allowed agents.

When an Agent is configured to allow access from a group, it becomes available to all projects within that group and subgroups. If a project would have access to the same Agent through multiple groups due to authorizations at multiple levels in the hierarchy, the authorization closest to the project (the lowest level) is used.

An Agent is only available if it shares a root ancestor with the requesting project (we must include this rule in the finder query in case a project/group has been moved since the agent was configured).

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Database review

Group authorized agents aren't in use yet so there are currently no agent_group_authorizations records. Each Agent can authorize a maximum of 100 groups (and would typically authorize <10 under normal use), so the total number of records searched will usually be low.

Example query for gitlab-org/gitlab:

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/6467/commands/22171

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #323708 (closed)

Edited by Tiger Watson

Merge request reports