bitwarden / bitwarden/clients

`bw get item example_name --organizationid <UUID>` ignores the `organizationid` filter

Open
#2,736 6 comments 0 reactions 0 assignees View on GitHub
bug cli
Dominant language
TypeScript
Stars
13.8k
Forks
2k
Avg merge
3d 6h
Merged PRs (30d)
340

Description

## Describe the Bug

If `bw get item` command is used along with `organizationid` filter, the filter is ignored and all items from all organizations are looked up.

EDIT: I tried other `bw get` commands after creating this issue, the organization ID seems to be ignored in all of them.

## Steps To Reproduce

- Create two orgs
- Add `example_item` in the Org-1
- Run `bw sync` to sync all the new records
- Try to get the item using `bw get item example_item --organizationid `

## Expected Result

The result must be an error stating that Item was not found.

## Actual Result

Returns the item from Org-1

```bash
$ bw get item example_item --organizationid fd4707ab-7524-41b7-975f-9c34e31a6038
{"object":"item","id":"03a39315-5af9-41c3-82a0-923fb1bd9a45","organizationId":"da095672-7875-40fc-82c4-be77ebcfec96","folderId":null,"type":2,"name":"example_item","notes":null,"favorite":false,"fields":[],"secureNote":{"type":0},"collectionIds":["79769155-412b-4991-82fa-6f0a464a8e3b"],"revisionDate":"2021-06-10T02:01:40.064Z"}

```

Returns the collection from Org-1

```bash
$ bw get collection example_collection --organizationid fd4707ab-7524-41b7-975f-9c34e31a6038
{"object":"collection","id":"79769155-412b-4991-82fa-6f0a464a8e3b","organizationId":"da095672-7875-40fc-82c4-be77ebcfec96","name":"example_collection","externalId":null}

```

## Environment

- Operating system: macOS Catalina
- Shell: zsh
- Build Version (run `bw --version`): 1.16.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `bw get item` and `bw get collection` commands with an organization ID from the issue, then trace the CLI handling of the `organizationid` option for these commands. Done means records from another organization are excluded and a missing item produces the expected not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.