clients icon indicating copy to clipboard operation
clients copied to clipboard

An error based on 2022.8.0 version - Cannot read properties of null (reading 'toLowerCase')

Open psugne opened this issue 3 years ago • 7 comments

Steps To Reproduce

I noticed it by using BW plugin for ansible on get_entry() call.

Expected Result

No error messages

Actual Result

An error comes:

failed: [odoonode] (item={'src': u'/home/test/workdir/tmpHdEDid/deployment_staging/templates/etc/odoo/odoo.conf', 'group': u'test', 'uid': 1000, 'state': 'file', 'gid': 1000, 'mode': '0644', 'mtime': 1660045875.8906062, 'owner': 'test', 'path': u'etc/odoo/odoo.conf', 'size': 9535, 'root': u'/home/test/workdir/tmpHdEDid/deployment_staging/templates/', 'ctime': 1660045875.8906062}) => {\"changed\": false, \"item\": {\"ctime\": 1660045875.8906062, \"gid\": 1000, \"group\": \"test\", \"mode\": \"0644\", \"mtime\": 1660045875.8906062, \"owner\": \"test\", \"path\": \"etc/odoo/odoo.conf\", \"root\": \"/home/test/workdir/tmpHdEDid/deployment_staging/templates/\", \"size\": 9535, \"src\": \"/home/test/workdir/tmpHdEDid/deployment_staging/templates/etc/odoo/odoo.conf\", \"state\": \"file\", \"uid\": 1000}, \"msg\": \"AnsibleError: An unhandled exception occurred while templating '{{ lookup('bitwarden', 'deeper_server_' + env, field='sentry_dsn', custom_field=true)}}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while running the lookup plugin 'bitwarden'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Unknown failure in 'bw' command: /snapshot/clients/apps/cli/build/bw.js:23363\
               c.login.uris.some((loginUri) => loginUri.uri.toLowerCase().indexOf(query) > -1)) {\
                                                            ^\
\
TypeError: Cannot read properties of null (reading 'toLowerCase')\
   at /snapshot/clients/apps/cli/build/bw.js:23363:62\
   at Array.some (<anonymous>)\
   at /snapshot/clients/apps/cli/build/bw.js:23363:30\
   at Array.filter (<anonymous>)\
   at SearchService.searchCiphersBasic (/snapshot/clients/apps/cli/build/bw.js:23348:24)\
   at GetCommand.<anonymous> (/snapshot/clients/apps/cli/build/bw.js:34454:46)\
   at Generator.next (<anonymous>)\
   at fulfilled (/snapshot/clients/apps/cli/build/bw.js:34356:58)\
\"}

Screenshots or Videos

No response

Additional Context

No response

Operating System

Linux

Operating System Version

Ubuntu 16.04.7 LTS

Shell

Bash

Build Version

2022.8.0

psugne avatar Aug 09 '22 16:08 psugne

Same for me

sbourdette avatar Aug 10 '22 11:08 sbourdette

Workaround ubuntu :

sudo snap revert bw

to revert to 2022.6.2

sbourdette avatar Aug 10 '22 12:08 sbourdette

I get this when I run bw get password on every password I've tried, if that helps with reproducing the issue.

jberkenbilt avatar Aug 10 '22 13:08 jberkenbilt

Workaround ubuntu :

sudo snap revert bw

to revert to 2022.6.2

I already did this. But it would be nice to have the latest version as well.

psugne avatar Aug 11 '22 09:08 psugne

I've seen this as well on Win10

JWBWork avatar Aug 11 '22 15:08 JWBWork

Get attachments doesn't work for linux cli in 2022.8.0 as well

macejiko avatar Aug 11 '22 17:08 macejiko

same error on Mac 12.5, bitwarden-cli installed using brew

ignaciomedina avatar Aug 12 '22 01:08 ignaciomedina

Same on Ubuntu 22.04. Reverting to release 1.22.0 fixes the issue.

arcadellama avatar Aug 13 '22 14:08 arcadellama

same here for bw list items --search ... and bw get item ... Ubuntu: 20.04.4 LTS

htammen avatar Aug 16 '22 08:08 htammen

Facing the same error when using bw get ....

Version: 2022.8.0 Manjaro 5.18.17-1

depado avatar Aug 16 '22 08:08 depado

Hi all, apologies for the inconveniences caused. The team is currently looking into this and will get it fixed soon. Thank you for your patience!

dbosompem avatar Aug 16 '22 11:08 dbosompem

This is due to missing out on some null checking on item URIs saved to your vault. I just opened a PR for a fix, but in the mean time, we can find the offending vault item and remove the unused URI value.

Please open up your data.json file (I can tell you where that is if you tell me your operating system: windows, mac, or linux). Don't change any values in there, but search for "uri": null and note down the ID of the offending item(s). They will look like this

"b60aaa5b-f88c-4cde-8beb-aedd01367ac4": {
  "id": "b60aaa5b-f88c-4cde-8beb-aedd01367ac4",
  "organizationId": null,
  "folderId": null,
  "edit": true,
  "viewPassword": true,
  "organizationUseTotp": false,
  "favorite": false,
  "revisionDate": "2022-08-16T11:33:27.6433333Z",
  "type": 1,
  "name": "2.8GPeSwM1EvYnDfgltjcEBQ==|/OqqqJ0YTec6nf4cNTW1VA==|zcySfvHLPJAZHhhaayYdYDVHCruFzZSSPYLTp/xWTAU=",
  "notes": null,
  "collectionIds": [],
  "deletedDate": null,
  "reprompt": 0,
  "login": {
    "username": "2.CUtAn57dgktcnFBSZwjD8g==|jLMoJx8I3NLcMCEV/5Gb7w==|A5Zt6VtCD+qaEe0EQyGN5cHaLKDpHAQA0nhMk5IGigA=",
    "password": "2.DUR1HIC57CUanx0NYfAeAQ==|FHDJmqozIdkaewqzg2OD3Q==|NMFF5o4VMOu2fHuSxksrqRDCcjv6ncV+Y67on5YiAWs=",
    "passwordRevisionDate": null,
    "totp": null,
    "autofillOnPageLoad": null,
    "uris": [
      {
        "match": null,
        "uri": null
      }
    ]
  }
}

The top value, b60aaa5b-f88c-4cde-8beb-aedd01367ac4, is the ID you can use to grab this item in the CLI. It should still work since this method short circuits the search that is failing. Once you have your decrypted item, update it to remove the URI in any client you would like.

After updating the items with a null URI and a fresh bw sync, your vault search should work fine.

To reiterate, this is definitely a bug, and is going to be fixed. This is a stop-gap to help you out in the mean time.

MGibson1 avatar Aug 16 '22 11:08 MGibson1

This is still a thing I think

❯ bw --version
2022.8.0
❯ bw get item ssh_config
/opt/homebrew/Cellar/bitwarden-cli/2022.8.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:23363
                c.login.uris.some((loginUri) => loginUri.uri.toLowerCase().indexOf(query) > -1)) {
                                                             ^

TypeError: Cannot read properties of null (reading 'toLowerCase')
    at /opt/homebrew/Cellar/bitwarden-cli/2022.8.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:23363:62
    at Array.some (<anonymous>)
    at /opt/homebrew/Cellar/bitwarden-cli/2022.8.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:23363:30
    at Array.filter (<anonymous>)
    at SearchService.searchCiphersBasic (/opt/homebrew/Cellar/bitwarden-cli/2022.8.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:23348:24)
    at GetCommand.<anonymous> (/opt/homebrew/Cellar/bitwarden-cli/2022.8.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:34454:46)
    at Generator.next (<anonymous>)
    at fulfilled (/opt/homebrew/Cellar/bitwarden-cli/2022.8.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:34356:58)

Edit: I see that no new version has been cut since this has been merged hence why upstream formulae was not updated.

djedlajn avatar Aug 18 '22 00:08 djedlajn

Can you consider making a hotfix with this fix instead of waiting until the next main release?

This basically breaks the enitre program and its already fixed so this fix should be realeased asap IMO.

LeSnake04 avatar Aug 26 '22 14:08 LeSnake04

please fix this is screwing my work flow, I use CLI for everything specially to pipe output to other programs

r3k2 avatar Aug 26 '22 19:08 r3k2

I have identified the items that appear to have the "null" properties as suggested, however, after doing so I cannot actually perform a perform a sync because I get the same error. Please release a hotfix for this ASAP. I will downgrade to the previous version.

image

taylorb-syd avatar Sep 04 '22 22:09 taylorb-syd

Anyone eager to get this fix before a release is cut can download the CI build from here.

makkes avatar Sep 06 '22 17:09 makkes

Fix ASAP please, huge problem.

Coo-ops avatar Sep 09 '22 13:09 Coo-ops

Bumping this. It's been a couple months now since this has been broken and fixed. Given that it's a 1 line patch, is there any way it can be cherry picked and released?

danlamanna avatar Oct 22 '22 03:10 danlamanna

@danlamanna This has been released and was included in 2022.9

You might want to update to the current latest (2022.10) or install freshly from here

djsmith85 avatar Oct 22 '22 07:10 djsmith85