Skip to content

Create audit event for container repository creation

Aaron Huntsman requested to merge 362290-audit-container-repository-created into master

What does this MR do and why?

Adds an audit event for a container repository being created in Gitlab via registry authentication.

Details

Adds a new option to ContainerRepository#find_or_create_by_path! that returns whether the upserted repo path is a new record or not. This is required since the Rails upsert method does not return this info with the result, and only new records should be audited.

Verification

  1. Start environment with container registry running
  2. Choose a project with a Dockerfile (or create one)
  3. Clone the project, build and push a container image - https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html
  4. Verify the repo was created under the project in the Deploy > Container Registry side menu
  5. Verify an audit event was created in the project's Secure > Audit Events

Screenshot_2024-10-07_at_11.00.12_AM

Related to #362290 (closed)

Edited by Aaron Huntsman

Merge request reports

Loading