mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-10-24 02:06:40 +03:00
Fix revoked org members retaining access to org ciphers (#7554)
The cipher access restriction queries (direct collection access, group collection access, and full access via groups) never checked the organization membership status. Since users_collections and groups_users rows are kept when a membership is revoked, revoked (and not yet confirmed) members kept read, write, delete, attachment and collection-move access to org ciphers via the direct-by-UUID endpoints. Require a confirmed membership in the cipher's organization in all three queries, matching the behavior of the sync queries. Co-authored-by: Daniel García <dani-garcia@users.noreply.github.com>
This commit is contained in:
1 parent
cc67d644f6
commit
d2660324e6
2 files changed
+19
-2
No files matched your search
@@ -13,7 +13,7 @@ use crate::{
|
||||
};
|
||||
use macros::UuidFromParam;
|
||||
|
||||
use super::{CollectionId, Membership, MembershipId, OrganizationId, User, UserId};
|
||||
use super::{CollectionId, Membership, MembershipId, MembershipStatus, OrganizationId, User, UserId};
|
||||
|
||||
#[derive(Identifiable, Queryable, Insertable, AsChangeset)]
|
||||
#[diesel(table_name = groups)]
|
||||
@@ -268,6 +268,9 @@ impl Group {
|
||||
.and(users_organizations::org_uuid.eq(groups::organizations_uuid))),
|
||||
)
|
||||
.filter(users_organizations::user_uuid.eq(user_uuid))
|
||||
// Only allow full access via a confirmed membership, since
|
||||
// groups_users rows are kept when a membership is revoked.
|
||||
.filter(users_organizations::status.eq(MembershipStatus::Confirmed as i32))
|
||||
.filter(groups::organizations_uuid.eq(org_uuid))
|
||||
.filter(groups::access_all.eq(true))
|
||||
.select(groups::access_all)
|
||||
|
||||
Reference in new issue
Block a user