8e78a3b Replace organization_uuid unwrap with proper error handling
📊 Changes
1 file changed (+12 additions, -4 deletions)
View changed files
📝src/api/core/ciphers.rs (+12 -4)
📄 Description
Summary
The collection update endpoints (post_collections_update and post_collections_admin) call .unwrap() on cipher.organization_uuid in four places. If a cipher without an organization UUID reaches these code paths, the server panics instead of returning an error.
Root cause
cipher.organization_uuid is Option<OrganizationId>. While the earlier is_in_editable_collection_by_user guard should prevent user-owned ciphers from reaching this code, the .unwrap() calls create a hard dependency on that guard — any future changes to the guard logic could silently introduce a panic path.
Fix
Extract organization_uuid early in each function using let Some(ref org_uuid) = ... else { err!(...) }, then reuse the binding throughout. This replaces four .unwrap() calls with a single, clear error return per function.
Test plan
Assign a cipher to a collection as a normal org user — should work as before
Update collections via admin endpoint — should work as before
Attempt to update collections on a cipher with no organization (if reachable) — should return error instead of panicking
🔄 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/6936
**Author:** [@xjohnyknox](https://github.com/xjohnyknox)
**Created:** 3/13/2026
**Status:** 🔄 Open
**Base:** `main` ← **Head:** `fix/remove-unwrap-organization-uuid`
---
### 📝 Commits (1)
- [`8e78a3b`](https://github.com/dani-garcia/vaultwarden/commit/8e78a3bfd778cfff4c86ddfb71ea0e67fd60d5ad) Replace organization_uuid unwrap with proper error handling
### 📊 Changes
**1 file changed** (+12 additions, -4 deletions)
<details>
<summary>View changed files</summary>
📝 `src/api/core/ciphers.rs` (+12 -4)
</details>
### 📄 Description
## Summary
The collection update endpoints (`post_collections_update` and `post_collections_admin`) call `.unwrap()` on `cipher.organization_uuid` in four places. If a cipher without an organization UUID reaches these code paths, the server panics instead of returning an error.
### Root cause
`cipher.organization_uuid` is `Option<OrganizationId>`. While the earlier `is_in_editable_collection_by_user` guard should prevent user-owned ciphers from reaching this code, the `.unwrap()` calls create a hard dependency on that guard — any future changes to the guard logic could silently introduce a panic path.
### Fix
Extract `organization_uuid` early in each function using `let Some(ref org_uuid) = ... else { err!(...) }`, then reuse the binding throughout. This replaces four `.unwrap()` calls with a single, clear error return per function.
## Test plan
- [ ] Assign a cipher to a collection as a normal org user — should work as before
- [ ] Update collections via admin endpoint — should work as before
- [ ] Attempt to update collections on a cipher with no organization (if reachable) — should return error instead of panicking
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/6936
Author: @xjohnyknox
Created: 3/13/2026
Status: 🔄 Open
Base:
main← Head:fix/remove-unwrap-organization-uuid📝 Commits (1)
8e78a3bReplace organization_uuid unwrap with proper error handling📊 Changes
1 file changed (+12 additions, -4 deletions)
View changed files
📝
src/api/core/ciphers.rs(+12 -4)📄 Description
Summary
The collection update endpoints (
post_collections_updateandpost_collections_admin) call.unwrap()oncipher.organization_uuidin four places. If a cipher without an organization UUID reaches these code paths, the server panics instead of returning an error.Root cause
cipher.organization_uuidisOption<OrganizationId>. While the earlieris_in_editable_collection_by_userguard should prevent user-owned ciphers from reaching this code, the.unwrap()calls create a hard dependency on that guard — any future changes to the guard logic could silently introduce a panic path.Fix
Extract
organization_uuidearly in each function usinglet Some(ref org_uuid) = ... else { err!(...) }, then reuse the binding throughout. This replaces four.unwrap()calls with a single, clear error return per function.Test plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.