Skip to content

Add maximum file upload size limit for the package registry

Steve Abrams requested to merge 218017-nuget-size-limits-db into master

What does this MR do?

This adds new application limits:

nuget_max_file_size
pypi_max_file_size
conan_max_file_size
npm_max_file_size
maven_max_file_size

The default is 52428800 (50 megabytes in binary bytes) to match the existing hardcoded limit already in place.

This limit is used to prevent files that are too large from being uploaded using any of the available package APIs. They can be configured to a higher limit on self-managed instances (see docs update).

Database

Up Migration
== 20200818171229 AddPackageMaxFileSizeToPlanLimits: migrating ================
-- add_column(:plan_limits, :conan_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0021s
-- add_column(:plan_limits, :maven_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0008s
-- add_column(:plan_limits, :npm_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0007s
-- add_column(:plan_limits, :nuget_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0006s
-- add_column(:plan_limits, :pypi_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0007s
== 20200818171229 AddPackageMaxFileSizeToPlanLimits: migrated (0.0051s) =======
Down Migration
== 20200818171229 AddPackageMaxFileSizeToPlanLimits: reverting ================
-- remove_column(:plan_limits, :pypi_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0016s
-- remove_column(:plan_limits, :nuget_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0004s
-- remove_column(:plan_limits, :npm_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0004s
-- remove_column(:plan_limits, :maven_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0003s
-- remove_column(:plan_limits, :conan_max_file_size, :bigint, {:default=>52428800, :null=>false})
   -> 0.0004s
== 20200818171229 AddPackageMaxFileSizeToPlanLimits: reverted (0.0056s) =======

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 #218017 (closed), #218014 (closed), #218015 (closed), #218016 (closed), #218018 (closed)

Edited by Steve Abrams

Merge request reports