mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-10 01:10:09 +03:00
[PR #36] Better check for cipher access #3905
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?
Original Pull Request: https://github.com/dani-garcia/vaultwarden/pull/36
State: closed
Merged: Yes
This checks out two TODOs:
Cipher::is_write_accessible_to_userwith a check for any collection that might give R/W access to cipher.Cipher::is_accessible_to_userwith a proper check for any RO access.The current solution works quite well, but I don't like the code repetition. Any input would be greatly appreciated how to solve this in some reasonable manner. I was thinking about using
into_boxed()at some stage to promote some code reuse, but I just don't know enough about diesel to pull this off successfully.Other approach would be to split it into multiple sub-checks and aggregate those but that would lead to 5x the amount of queries, which I'd like to avoid.
Any ideas?