FS#74929 - [bitwarden-cli] Uploading attachments fails
Attached to Project:
Community Packages
Opened by Mathijs van Veluw (BlackDex) - Wednesday, 01 June 2022, 11:59 GMT
Last edited by Alexander Epaneshnikov (alex19EP) - Friday, 15 July 2022, 22:06 GMT
Opened by Mathijs van Veluw (BlackDex) - Wednesday, 01 June 2022, 11:59 GMT
Last edited by Alexander Epaneshnikov (alex19EP) - Friday, 15 July 2022, 22:06 GMT
|
Details
Description:
When using Vaultwarden or Bitwarden it self for that matter this specific archlinux build is broken when it comes to uploading attachments. For some strange reason it breaks the `multipart/form-data`. If i use the binary pre-build from the Bitwarden release page on github it works fine. Additional info: * 1.22.1 (1.22.1-2) Steps to reproduce: 1. Login to a bitwarden or vaultwarden server using the CLI. 2. Try to upload an attachment to a cipher/item like this `bw create attachment --file /path/to/file.png --itemid some-uuid-of-cipher` 3. See the error message. If you try the same with the binary from github, there is no issue. If i check the HTTP headers sent, i see the following: Arch-Linux pre-build binary: ``` Content-Type: multipart/form-data;boundary=--------------------------097815959179582168041088 Bitwarden-Client-Name: cli Bitwarden-Client-Version: 1.22.1 Accept: */* Accept-Encoding: gzip,deflate ----------------------------097815959179582168041088 Content-Disposition: form-data; name="data"; filename="ezs0PgE9QxMs0pu1huQ5jSNLoiuyUVb+jPGuNq+0=" Content-Type: application/octet-stream ----------------------------097815959179582168041088 Content-Disposition: form-data; name="data"; filename="2.k/CTD+VT1ISkJntV2KKVHQ==|Tv3h2/AJFHGrg8IwyFlbivj6gW1PzLzOzv/ojEbv20zS6zaayTSYONyK6T8Lxv6p1nQcNcRE06oDTFjJntaYAg==|6B/ezs0PgE9QxMs0pu1huQ5jSNLoiuyUVb+jPGuNq+0=" Content-Type: application/octet-stream ``` With the Bitwarden Github binary: ``` Content-Type: multipart/form-data;boundary=--------------------------760331512150555356594257 Bitwarden-Client-Name: cli Bitwarden-Client-Version: 1.22.1 Accept: */* Accept-Encoding: gzip,deflate ----------------------------760331512150555356594257 Content-Disposition: form-data; name="data"; filename="2.qNTA6oxfxk4cngKkjMD7aQ==|MW4cgGlFwpqxWC3O6Bhn+st/r397GOEbK7cRNKa7R0x+qQXmieaH5o5f0Q+B0b4v7u0R31NNYcya8vtYOFBohw==|j6Fv84GtCLqMxI6Rg3kyTMfVIJmBfLKPkFEGLjdUEq4=" Content-Type: application/octet-stream ``` |
This task depends upon
Closed by Alexander Epaneshnikov (alex19EP)
Friday, 15 July 2022, 22:06 GMT
Reason for closing: Fixed
Additional comments about closing: bitwarden-cli-2022.6.2-2
Friday, 15 July 2022, 22:06 GMT
Reason for closing: Fixed
Additional comments about closing: bitwarden-cli-2022.6.2-2
I see that the current PKGBUILD is still doing some stuff for jslib, which is totally not needed anymore.
Removing that didn't fixed the build though.
Then i checked the version of nodejs which is used, and that seems to be an issue. It looks like the bitwarden-cli needs to be build with nodejs 16.x.
If i install and change `nodejs` to `nodejs-lts-gallium`, that seems to fix the build.
Also, the 'binary' produced is very big, since the PKGBUILD calls `npm build`, while probably running `npm run dist:lin` would be much better.
Now, i didn't checked if running `npm build` and an older version of nodejs alone fixes this issue, but using an older nodejs version and changing the build command worked for me.
> I see that the current PKGBUILD is still doing some stuff for jslib, which is totally not needed anymore.
we just load a submodule... nothing else.
> Then i checked the version of nodejs which is used, and that seems to be an issue. It looks like the bitwarden-cli needs to be build with nodejs 16.x.
If i install and change `nodejs` to `nodejs-lts-gallium`, that seems to fix the build.
indeed downgrading nodejs version fixes this issue...
i can lock nodejs version in bitwarden-cli, however then it will not be possible to install another nodejs version while bitwarden-cli is installed.
But there are no submodules anymore, so no need to load them.
Regarding the nodejs version. Maybe nvm is an option?
That way multiple versions can be used. Not sure how that works in combination with the main nodejs package though.