Add option to limit legacy uploads size
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Work on this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=324874) - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=324874) </details> <!--IssueSummary end--> ## Summary <!-- Please briefly describe what part of the code base needs to be refactored. --> 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 <!-- Explain the benefits of refactoring this code. See also https://about.gitlab.com/handbook/values/index.html#say-why-not-just-what --> - On Rails side update autorize_upload endpoint to return also `maximum_size` (related to discussion https://gitlab.com/gitlab-org/gitlab/-/issues/324874#note_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) ## Risks <!-- Please list features that can break because of this refactoring and how you intend to solve that. --> ## Involved components <!-- List files or directories that will be changed by the refactoring. --> - `HandleFileUploads` in `internal/upload/uploads.go` - There's an existing check which returns `filestore.ErrEntityTooLarge`, we can reuse the same error in our check. - Configuration file handling is in `internal/config/config.go` ## Optional: Intended side effects <!-- If the refactoring involves changes apart from the main improvements (such as a better UI), list them here. It may be a good idea to create separate issues and link them here. --> ## Optional: Missing test coverage <!-- If you are aware of tests that need to be written or adjusted apart from unit tests for the changed components, please list them here. -->
issue