Fix get_groups_data

This commit is contained in:
Daniel García
2026-07-24 15:17:21 +02:00
parent 5a02e80a5a
commit 94a798e9dd
2 changed files with 12 additions and 2 deletions
+10 -2
View File
@@ -1871,6 +1871,8 @@ async fn post_org_import(
for mut cipher_data in data.ciphers { for mut cipher_data in data.ciphers {
// Always clear folder_id's via an organization import // Always clear folder_id's via an organization import
cipher_data.folder_id = None; cipher_data.folder_id = None;
// Replace the client-provided, unvalidated organizationId with the real target org
cipher_data.organization_id = Some(org_id.clone());
let mut cipher = Cipher::new(cipher_data.r#type, cipher_data.name.clone()); let mut cipher = Cipher::new(cipher_data.r#type, cipher_data.name.clone());
update_cipher_from_data( update_cipher_from_data(
&mut cipher, &mut cipher,
@@ -2461,8 +2463,14 @@ async fn get_groups_data(
err!("Organization not found", "Organization id's do not match"); err!("Organization not found", "Organization id's do not match");
} }
if !headers.membership.has_full_access() { // For now, both the group list and the details view require full access to the organization
err_code!("Resource not found.", "User does not have full access", rocket::http::Status::NotFound.code); // (directly or via a group). Bitwarden also lets a manager of a specific collection read the
// plain list (to assign groups); handling that case is left for a follow-up.
let has_full_access = headers.membership.has_full_access()
|| (CONFIG.org_groups_enabled()
&& GroupUser::has_full_access_by_member(&org_id, &headers.membership.uuid, &conn).await);
if !has_full_access {
err_code!("Resource not found.", "User does not have access", rocket::http::Status::NotFound.code);
} }
let groups: Vec<Value> = if CONFIG.org_groups_enabled() { let groups: Vec<Value> = if CONFIG.org_groups_enabled() {
+2
View File
@@ -1104,6 +1104,8 @@ impl<'r> FromRequest<'r> for ClientIp {
}) })
} else { } else {
if CONFIG._ip_header_enabled() && req.headers().get_one(&CONFIG.ip_header()).is_some() { if CONFIG._ip_header_enabled() && req.headers().get_one(&CONFIG.ip_header()).is_some() {
// Log the canonical IP, which is what the user filter will need to match against
let remote = remote.map(|ip| ip.to_canonical());
debug!("Ignoring the '{}' header, {remote:?} is not a trusted proxy", CONFIG.ip_header()); debug!("Ignoring the '{}' header, {remote:?} is not a trusted proxy", CONFIG.ip_header());
} }
None None