Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
psugne opened this issue Aug 9, 2022 · 20 comments · Fixed by #3315
Closed
Labels
bug cli CLI Application

Comments

@psugne
Copy link

psugne commented Aug 9, 2022

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 psugne added bug cli CLI Application labels Aug 9, 2022
@sbourdette
Copy link

Same for me

@sbourdette
Copy link

Workaround ubuntu :

sudo snap revert bw

to revert to 2022.6.2

@jberkenbilt
Copy link

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

@psugne
Copy link
Author

psugne commented Aug 11, 2022

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.

@JWBWork
Copy link

JWBWork commented Aug 11, 2022

I've seen this as well on Win10

@macejiko
Copy link

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

@ignaciomedina
Copy link

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

@arcadellama
Copy link

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

@htammen
Copy link

htammen commented Aug 16, 2022

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

@Depado
Copy link

Depado commented Aug 16, 2022

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

Version: 2022.8.0
Manjaro 5.18.17-1

@dbosompem
Copy link

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!

@MGibson1
Copy link
Member

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.

@djedlajn
Copy link

djedlajn commented Aug 18, 2022

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.

@LeSnake04
Copy link

LeSnake04 commented Aug 26, 2022

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.

@r3k2
Copy link

r3k2 commented Aug 26, 2022

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

@taylorb-syd
Copy link

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

@makkes
Copy link

makkes commented Sep 6, 2022

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

@Coo-ops
Copy link

Coo-ops commented Sep 9, 2022

Fix ASAP please, huge problem.

@danlamanna
Copy link

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?

@djsmith85
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli CLI Application
Projects
None yet
Development

Successfully merging a pull request may close this issue.