mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-04-26 09:46:00 +03:00
[GH-ISSUE #807] Question: where to set the 1GB attachment limit? #559
Labels
No labels
SSO
Third party
better for forum
bug
bug
documentation
duplicate
enhancement
future Vault
future Vault
future Vault
good first issue
help wanted
low priority
notes
pull-request
question
troubleshooting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vaultwarden#559
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/807
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 7, 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.
github.com/dani-garcia/bitwarden_rs@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 17, 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:
github.com/dani-garcia/bitwarden_rs@325039c316