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

Fix JSON parsing: make field type optional #212

Closed

Conversation

soraxas
Copy link
Contributor

@soraxas soraxas commented Oct 28, 2024

I'm getting the following error on rbw sync:

rbw get: failed to sync database from server: failed to parse JSON: ciphers[21].fields[0]: missing field `Type` at line 1 column 45441

which is complaining about missing field Type.

After the changes from PR, I was able to inspect the actual raw JSON from bitwarden server, and the offending json objects are due to the optional "type" field

$ rbw get SSH-KEY_core --raw
{
  "id": "...",
  "folder": null,
  "name": "SSH-KEY_core",
  "data": null,
  "fields": [
    {
      "name": "custom-type",
      "value": "ssh-key",
      "type": null
    },
    {
      "name": "public-key",
      "value": "...",
      "type": null
    },
    {
      "name": "private-key",
      "value": "...",
      "type": "hidden"
    }
  ],
  "history": []
}

The json are set via API call as opposed to via GUI, hence it's possible to not specify the field "type".

Just FYI, both the web interface and chrome extension works with the missing fields, where it will displays as follows:

image

I.e., it will just display nothing (neither text value nor as hidden). So rbw should also accept the schema as it's accepted by the server.

@doy
Copy link
Owner

doy commented Dec 27, 2024

applied, thanks!

@doy doy closed this Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants