Skip the final store path for Maven checksum uploads

What does this MR do and why?

Maven clients upload a .sha1 and a .md5 file next to each package file. GitLab does not store these files: the upload endpoint returns early for them, because the checksums are already columns on the package file.

The authorize request for these files still asks Workhorse to upload to a final store path. That path adds an entry to the pending direct uploads list and tells Workhorse to keep the object. Only a stored file removes the entry, so for checksum files the entry and the uploaded object stay until the stale upload cleanup reaches them.

This MR authorizes .sha1 and .md5 files to a temporary path instead. No pending entry is added, and Workhorse deletes the object after the request. Clients see no change: these files were never stored.

The change is behind the maven_checksum_upload_skip_final_store_path feature flag (gitlab_com_derisk, disabled by default).

References

Screenshots or screen recordings

Not applicable: no UI change.

How to set up and validate locally

  1. Enable direct upload for packages in config/gitlab.yml (packages.object_store.direct_upload: true), with object storage enabled (for example, the GDK MinIO setup).

  2. In the Rails console, enable the feature flag:

    Feature.enable(:maven_checksum_upload_skip_final_store_path)
  3. Note the current count:

    ObjectStorage::PendingDirectUpload.count
  4. Deploy a Maven package to a project in the GDK, for example with mvn deploy.

  5. Check the count again. It is the same as before the deploy. With the flag disabled, each .sha1 and .md5 file adds one entry that stays.

  6. Check that the deploy succeeded and the package files are listed in Deploy > Package registry.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Moaz Khalifa

Merge request reports

Loading
Loading