Skip to content

Add REST API endpoint to enqueue the background job to enable SPP for all projects in group

Overview

After introducing the background job to toggle project-level setting of Secret Push Protection for all projects nested in a group in #502826 (closed), we have to allow security teams to enqueue this background job via some API interface. For this reason, we should introduce a new REST API endpoint that will take a group ID to run this background job.

Proposal

  • Create a new REST API endpoint to enqueue the background job from #502826 (closed) for all projects nested in a group.

Requirements

  • The endpoint should accept a group ID to run the background job.
  • The endpoint should be idempotent (i.e., it should not enqueue another job while one is already running).
  • The endpoint should only be accessible for group members with maintainer or higher roles.

Implementation plan

  • Create a new API in this location ee/lib/api/group_security_settings.rb.
  • Create a new POST function in the new API that will be with arguments of:
  • group_ids --> requierd
  • enabled --> requierd
  • projects_to_exclude --> optional
  • Connect the new API in ee/lib/ee/api/api.rb as mount
  • Connect the new API function to the worker from #502826 (closed)
  • Add unit test for the new API
  • Add documentation for the new API with examples
Edited by Miki Amos