mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
Question: where to set the 1GB attachment limit? #560
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pdarcos on GitHub (Jan 7, 2020).
Hi guys,
Maybe a dumb question , but where in the code is this logic handled?
Is it possible to set limits per account/organization or is it a global setting for everyone?
Cheers
@dani-garcia commented on GitHub (Jan 8, 2020):
At the moment there isn't any attachment size limit.
@pdarcos commented on GitHub (Jan 8, 2020):
Ah ok. Thanks for the answer @dani-garcia
Are there plans to implement that? I don't want some of my users abusing it and uploading GBs of data.
Where in the code should I be looking to implement this? Either per user or globally
Thanks
@dani-garcia commented on GitHub (Jan 8, 2020):
At the moment there aren't any plans in progress but it's a welcome feature and it should be fairly easy to at least have a global limit.
This is where we save the file and we specifically set the size limit to None, then we save the file size in the attachments table.
baf7d1be4e/src/api/core/ciphers.rs (L677)To put a global user limit we'd have to add all the sizes of that users attachments and then set that
size_limittoLIMIT - (sum of all attachments sizes).If we set 1Gb limit per user and I have 3 100Mb files, then the limit for the next one would be 700Mb for example. Then when the limit is exceeded I assume we'd get a SaveResult::Partial or a SaveResult::Error and we'd be done.
To have different limits for users we'd need to add a column to the users table and a way to change them in the admin page, but I think most people would be happy with a global user limit for now.
@pdarcos commented on GitHub (Feb 4, 2020):
Thanks @dani-garcia !
Much appreciated
@dani-garcia commented on GitHub (Feb 18, 2020):
Okay so I've implemented the size limit functionality, with two limits, one for users and another for organizations, so depending where the cipher is located it can be one or the other, and setting it to zero disables uploading at all. The options are
USER_ATTACHMENT_LIMITandORG_ATTACHMENT_LIMITand they use KB.The commit:
325039c316