Browse Source
A security review of this branch (finding F1) pointed out that the 'Access Import/Export' permission, which this branch added and which opens GET /organizations/<id>/export via AccessImportExportHeaders, decided *whether* a member may export but not *what* they get: the handler always dumped Cipher::find_by_org(), and CipherSyncType:: Organization deliberately skips the per-cipher access restrictions. A confirmed Custom member holding only accessImportExport - assigned to no collection at all - therefore received every cipher of the organization, including collections they were explicitly excluded from. Every confirmed member holds the organization key, so the exported blobs are decryptable by the caller. The export is now built from the caller's own assignments unless they already reach every collection anyway (Admin/Owner, or a Custom member with 'Edit any collection'), which is what Bitwarden's export controller does. Group-based access is covered: both scoped queries honour group assignments and group access_all. * new helper may_export_entire_organization() names the decision and keeps it unit-testable * get_org_details_impl() split into ciphers_to_org_json() so the export can serialize an already-authorized cipher list; the serializer's doc comment states that requirement * new regression test access_import_export_alone_does_not_widen_the_export Verified: cargo check, cargo clippy --features sqlite (clean), cargo test --features sqlite (48 passed), cargo fmt --all -- --check.pull/7397/head
1 changed files with 70 additions and 6 deletions
Loading…
Reference in new issue