Allow versionless maven-metadata.xml file duplicates
🏛 Context
#276882 (closed) Added new settings for the Maven package registry to allow users to control if they could upload duplicate packages or not. The problem is when we added the logic determining if an incoming package file was a duplicate, we failed to consider the versionless maven-metadata.xml
file.
Now you're probably wondering what a "versionless metadata" file is my-pkg-1.0.0
and my-pkg-2.0.0
), each one is uploaded as a separate package, however a common metadata file containing info about all of the versions is uploaded too. We store these files in a "dummy package" of the same name (my-pkg
) that has no version. So each time you upload a new version, that dummy package will seemingly be getting a duplicate file upload, but that is the behavior we want. We always want to have the most recent versionless metadata file.
So the bug is right now, we only allow one of each file type to be uploaded to a given package if the duplicate package settings (namespace_package_settings.maven_duplicates_allowed
) is set to false
. This causes trouble with the versionless package that expects many of the same file type.
🔎 What does this MR do?
When a Maven file is uploaded to a versionless package, it will allow the upload regardless of package duplicate settings. A condition is added to the logic dealing with the Maven duplicates to allow the error to be bypassed if the package has no version.
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] 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 #276882 (closed)