summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Melmuk <[email protected]>2024-07-30 11:50:05 +0200
committerGitHub <[email protected]>2024-07-30 11:50:05 +0200
commit7c8ba0c2324dec1159d2fc2ba2e15b498899eb40 (patch)
treead439eb2abf470c22e6403cea7d07856c0718850
parentd3351871728231485c16301cab8c6066d11ff933 (diff)
downloadvaultwarden-7c8ba0c2324dec1159d2fc2ba2e15b498899eb40.tar.gz
vaultwarden-7c8ba0c2324dec1159d2fc2ba2e15b498899eb40.zip
fix issue with adding ciphers to organizations on native ios app (#4800)
* add organizationID alias for native ios * add reverse sanity check
-rw-r--r--src/api/core/ciphers.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs
index 537a0c15..7907cd76 100644
--- a/src/api/core/ciphers.rs
+++ b/src/api/core/ciphers.rs
@@ -208,6 +208,7 @@ pub struct CipherData {
// Folder id is not included in import
folder_id: Option<String>,
// TODO: Some of these might appear all the time, no need for Option
+ #[serde(alias = "organizationID")]
pub organization_id: Option<String>,
key: Option<String>,
@@ -286,6 +287,10 @@ async fn post_ciphers_create(
if data.cipher.organization_id.is_some() && data.collection_ids.is_empty() {
err!("You must select at least one collection.");
}
+ // reverse sanity check to prevent corruptions
+ if !data.collection_ids.is_empty() && data.cipher.organization_id.is_none() {
+ err!("The client has not provided an organization id!");
+ }
// This check is usually only needed in update_cipher_from_data(), but we
// need it here as well to avoid creating an empty cipher in the call to