[PR #36] [MERGED] Better check for cipher access #20790

Closed
opened 2026-04-30 07:19:26 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/36
Author: @mprasil
Created: 5/31/2018
Status: Merged
Merged: 6/1/2018
Merged by: @dani-garcia

Base: masterHead: cipher_access


📝 Commits (2)

  • e2b4f3b Bettech check for cipher access
  • ac2ca58 Remove unused UserOrganization

📊 Changes

1 file changed (+48 additions, -20 deletions)

View changed files

📝 src/db/models/cipher.rs (+48 -20)

📄 Description

This checks out two TODOs:

  1. Extends Cipher::is_write_accessible_to_user with a check for any collection that might give R/W access to cipher.
  2. Implements Cipher::is_accessible_to_user with 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?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/36 **Author:** [@mprasil](https://github.com/mprasil) **Created:** 5/31/2018 **Status:** ✅ Merged **Merged:** 6/1/2018 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `master` ← **Head:** `cipher_access` --- ### 📝 Commits (2) - [`e2b4f3b`](https://github.com/dani-garcia/vaultwarden/commit/e2b4f3b13f2be9ccbde0c1915a213a319eb5c13f) Bettech check for cipher access - [`ac2ca58`](https://github.com/dani-garcia/vaultwarden/commit/ac2ca5812ba0385f3e09351c9a3b9773a0285665) Remove unused UserOrganization ### 📊 Changes **1 file changed** (+48 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/db/models/cipher.rs` (+48 -20) </details> ### 📄 Description This checks out two TODOs: 1. Extends `Cipher::is_write_accessible_to_user` with a check for any collection that might give R/W access to cipher. 2. Implements `Cipher::is_accessible_to_user` with 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? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 07:19:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#20790