Add option to limit legacy uploads size
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
For https://gitlab.com/gitlab-org/gitlab/-/issues/31178 we want to limit the size of design uploads. These go through Workhorse so we need to add a setting there.
Improvements
- On Rails side update autorize_upload endpoint to return also
maximum_size
(related to discussion #324874 (comment 1129778943)):- this should be generous enough value it works for any uploads which use this generic endpoint
- ideally this should be rolled-out carefully (behind a feature flag)
- this maximum_size value should be configurable (so admins can update this instead of waiting for patch release in case we would set this limit too low)
- Enforce this limit when handling legacy uploads. Uploads that are too large should be rejected with a
413 Request Entity Too Large
error.- assuming that we return maximum_size value in
autorize_upload
response, this should work automatically out-of-the box (same as for direct uploads)
- assuming that we return maximum_size value in
Risks
Involved components
-
HandleFileUploads
ininternal/upload/uploads.go
- There's an existing check which returns
filestore.ErrEntityTooLarge
, we can reuse the same error in our check.
- There's an existing check which returns
- Configuration file handling is in
internal/config/config.go
Optional: Intended side effects
Optional: Missing test coverage
Edited by 🤖 GitLab Bot 🤖