Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new field in config, check upload size #756

Merged
merged 3 commits into from
Mar 14, 2023
Merged

Conversation

Repumba
Copy link
Contributor

@Repumba Repumba commented Mar 10, 2023

Your checklist for this pull request

  • I've read the contributing guideline.
  • I've tested my changes by building and running the project, and testing changed functionality (if applicable)
  • I've added automated tests for my change (if applicable, optional)
  • I've updated documentation to reflect my change (if applicable)

What is the current behaviour?

Users can upload as big file as they want and administrator doesn't have any tools (inside MWDB) to prevent that.

What is the new behaviour?

Administrator can configure limit for uploaded files
Checking file's size is not precise. In order to simplify the code, I check Content-Length field in request header. This value is bigger that actual file size by +/- 500B.
In my opinion this error margin is acceptable - in most scenarios the limit will be set to megabytes, so even if the other values in request were 1 kB, the margin of error would be less that 0.1%

Test plan

Change values of max_upload_size in config and try to upload a file.

Closing issues

closes #9

@Repumba
Copy link
Contributor Author

Repumba commented Mar 10, 2023

Questions to discuss:

  1. Should max upload size apply to configs and text blobs?
  2. Should we add a capability to omit the limit?

@Repumba Repumba marked this pull request as ready for review March 14, 2023 10:17
docs/setup-and-configuration.rst Outdated Show resolved Hide resolved
mwdb/core/config.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable maximum uploaded file size
2 participants