Ability to view and manage all collection items using CLI as an admin

Request:
Bitwarden CLI to support allowing Admins manage collections similar to the experience on the Admin Console. This will mightily help the administration of org-collections via automation.

Context:
As an admin, I am able to view all collection items via the Admin Console but I am unable to do the same using the CLI. With the CLI, I’m only able to view the collection items that my user has been granted access.

How to reproduce:

Experience via Bitwarden Admin console
Say there are 2 users - test-user and test-admin

  • As test-user, create a collection “test-collection”, and a couple of items under it. Then edit the access config ensuring that test-admin is not granted any permission.
  • As test-admin, go to the Bitwarden Admin console to view the “test-collection” and its items.
  • Outcome: test-admin can view items of “test-collection” via the Admin console

Experience via Bitwarden CLI:
On the terminal,

  • Log in as test-admin
  • Confirm that test-admin can list org-collections, and the output includes “test-collection”
  • Fetch “test-collection” collection id and attempt to list items under this collection e.g. by running the command below:
❯ ./tmp/bw list items --collectionid "$(./tmp/bw list org-collections --organizationid "$ORG_ID" | jq -r '.[] | select(.name == "test-collection") | .id')"  | jq

[]
  • Outcome: An empty list is returned

I suspect the CLI only gives the password-manager console view of collections. But it seems the lack of support for admin tasks via cli is a huge hole yet to be addressed.

@Ogonna_Iwunze I just changed the title of your Feature Request to the actual request you have. (before, the title was “Not able to view all collection items using CLI as an admin”) I hope, you are okay with that change.

+1, with a concrete use case. We manage our vault declaratively from Salt through bw serve, using a dedicated service account. That account can’t assign items to collections it isn’t a member of, so it can’t file things where they belong without being granted access to every collection in the org.

The server side already exists. The web vault’s Admin Console uses the admin cipher endpoints (saveCollectionsWithServerAdmin, /ciphers/{id}/admin) in the shared libraries, but nothing under apps/cli calls them. bw edit item-collections goes through saveCollectionsWithServer, which applies the user’s own collection access. bw edit org-collection already uses the admin collection endpoint, so there’s precedent for admin operations in the CLI.

Something like an --admin flag on bw edit item-collections (and ideally bw get/bw list/bw edit item) that switches to the admin endpoints would cover it, gated on the “Owners and admins can manage all collections and items” org setting, as the Admin Console is. Exposing the same through bw serve would follow naturally, since its routes call the same commands.

Related: