Skip to content

Add authentication log entries to job token allowlist

What does this MR do and why?

Implements third part of #498125 (closed).

Dependent on !177785 (merged) and !177465 (merged).

Feature is developed under the authentication_logs_migration_for_allowlist feature flag. This adds the button for autopopulating the job token allowlist with entries from the authentication log.

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.

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

Before After
Screenshot_2025-01-22_at_00.07.46 Screen_Recording_2025-01-26_at_00.13.05
Error Screenshot_2025-01-26_at_00.48.39

How to set up and validate locally

  1. Enable the feature flag.

    Feature.enable(:authentication_logs_migration_for_allowlist)
  2. Create sample authorization log records in the rails console:

    project = Project.first
    project2 = Project.second
    project3 = Project.third
    
    Ci::JobToken::Authorization.create(accessed_project: project, origin_project: project2, last_authorized_at: 1.day.ago)
    Ci::JobToken::Authorization.create(accessed_project: project, origin_project: project3, last_authorized_at: 1.day.ago)
    Ci::JobToken::Authorization.all
    Ci::JobToken::ProjectScopeLink.where(source_project: project)
  3. Visit the Job token permissions section of the CI/CD settings. <path-to-project>/-/settings/ci_cd#js-token-access.

  4. In CI/CD job token allowlist click Add > All projects in authentication log.

  5. This will open the modal. Click on the Add entries button.

  6. A toast message will show up and the allowlist will refresh with the new entries included.

Edited by Mireya Andres

Merge request reports

Loading