Originally created by @ambrozticar on GitHub (Jul 21, 2023).
<!--
# ###
NOTE: Please update to the latest version of vaultwarden before reporting an issue!
This saves you and us a lot of time and troubleshooting.
See:
* https://github.com/dani-garcia/vaultwarden/issues/1180
* https://github.com/dani-garcia/vaultwarden/wiki/Updating-the-vaultwarden-image
# ###
-->
<!--
Please fill out the following template to make solving your problem easier and faster for us.
This is only a guideline. If you think that parts are unnecessary for your issue, feel free to remove them.
Remember to hide/redact personal or confidential information,
such as passwords, IP addresses, and DNS names as appropriate.
-->
### Subject of the issue
<!-- Describe your issue here. -->
Unable to create attachments via the Bitwarden CLI
### Deployment environment
<!--
=========================================================================================
Preferably, use the `Generate Support String` button on the admin page's Diagnostics tab.
That will auto-generate most of the info requested in this section.
=========================================================================================
-->
<!-- The version number, obtained from the logs (at startup) or the admin diagnostics page -->
<!-- This is NOT the version number shown on the web vault, which is versioned separately from vaultwarden -->
<!-- Remember to check if your issue exists on the latest version first! -->
* vaultwarden version: 1.29.0-3dbfc484
<!-- How the server was installed: Docker image, OS package, built from source, etc. -->
* Install method: docker
* Clients used: BitWarden CLI 2023.7.0<!-- web vault, desktop, Android, iOS, etc. (if applicable) -->
* Reverse proxy and version: /<!-- if applicable -->
* MySQL/MariaDB or PostgreSQL version: /<!-- if applicable -->
* Other relevant details: tried multiple CLI install methods on both Windows and Ubuntu
### Steps to reproduce
<!-- Tell us how to reproduce this issue. What parameters did you set (differently from the defaults)
and how did you start vaultwarden? -->
bw create attachment --file test.txt --itemid [ITEMID] --session '[SESSIONID]'
### Expected behaviour
<!-- Tell us what you expected to happen -->
An attachment should be created on the specified item
### Actual behaviour
<!-- Tell us what actually happened -->
The following error is returned by the CLI:
<body align="center">
<div role="main" align="center">
<h1>400: Bad Request</h1>
<p>The request could not be understood by the server due to malformed syntax.</p>
<hr />
</div>
<div role="contentinfo" align="center">
<small>Rocket</small>
</div>
</body>
</html>
### Troubleshooting data
<!-- Share any log files, screenshots, or other relevant troubleshooting data -->
Output from docker logs (trace level):
[2023-07-21 20:17:02.288][request][INFO] POST /api/ciphers/5a578fe6-e212-4d52-aa02-2b16a1d6f1ce/attachment/v2
[2023-07-21 20:17:02.346][response][INFO] (post_attachment_v2) POST /api/ciphers/<uuid>/attachment/v2 => 200 OK
[2023-07-21 20:17:02.346][tracing::span][TRACE] encode_headers;
[2023-07-21 20:17:02.346][tracing::span::active][TRACE] -> encode_headers;
[2023-07-21 20:17:02.346][tracing::span::active][TRACE] <- encode_headers;
[2023-07-21 20:17:02.346][tracing::span][TRACE] -- encode_headers;
[2023-07-21 20:17:02.438][tracing::span][TRACE] parse_headers;
[2023-07-21 20:17:02.438][tracing::span::active][TRACE] -> parse_headers;
[2023-07-21 20:17:02.438][tracing::span::active][TRACE] <- parse_headers;
[2023-07-21 20:17:02.438][tracing::span][TRACE] -- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] -> parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] <- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] -- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] -> parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] <- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] -- parse_headers;
[2023-07-21 20:17:02.478][request][INFO] POST /api/ciphers/5a578fe6-e212-4d52-aa02-2b16a1d6f1ce/attachment/474f2023242c83b77194
[2023-07-21 20:17:02.479][rocket::form::parser::_][TRACE] multipart field: Field { state: Mutex { data: MultipartState { buffer: StreamBuffer, boundary: "--------------------------008683523461881203688262", stage: ReadingFieldData, next_field_idx: 1, curr_field_name: Some("data"), curr_field_size_limit: 18446744073709551615, curr_field_size_counter: 0, constraints: Constraints { size_limit: SizeLimit { whole_stream: 18446744073709551615, per_field: 18446744073709551615, field_map: {} }, allowed_fields: None } }}, done: false, headers: {"content-disposition": "form-data; name=\"data\"; filename=\"2.06l17qYisTYV9HU8allwTw==|Uq+dR9R7aS7LcovQcSx5hw==|n02O8g0frqYUvynjw77xlnkLQpmL45DsQHWRiJbUku8=\"", "content-type": "application/octet-stream"}, content_disposition: ContentDisposition { field_name: Some("data"), file_name: Some("2.06l17qYisTYV9HU8allwTw==|Uq+dR9R7aS7LcovQcSx5hw==|n02O8g0frqYUvynjw77xlnkLQpmL45DsQHWRiJbUku8=") }, content_type: Some("application/octet-stream"), idx: 0 }
[2023-07-21 20:17:02.479][multer::buffer][TRACE] finding next field: Some("data")
[2023-07-21 20:17:02.479][multer::buffer][TRACE] no new field found: EOF. terminating
[2023-07-21 20:17:02.479][multer::buffer][TRACE] finding next field: Some("data")
[2023-07-21 20:17:02.479][multer::buffer][TRACE] no new field found: EOF. terminating
[2023-07-21 20:17:02.479][vaultwarden::api::core::ciphers::_][WARN] Data guard `Form < UploadData < '_ > >` failed: Errors([Error { name: Some("data"), value: None, kind: Io(Custom { kind: Other, error: field "data" received with incomplete data }), entity: Form }]).
[2023-07-21 20:17:02.479][rocket::server::_][WARN] No 400 catcher registered. Using Rocket default.
[2023-07-21 20:17:02.479][response][INFO] (post_attachment_v2_data) POST /api/ciphers/<uuid>/attachment/<attachment_id> multipart/form-data => 400 Bad Request
Wireshark packet capture:
[create_attachment.zip](https://github.com/dani-garcia/vaultwarden/files/12134460/create_attachment.zip)
@BlackDex commented on GitHub (Jul 22, 2023):
Bitwarden updated to Node v18 which introduced this issue.
I reported it to Bitwarden https://github.com/bitwarden/clients/issues/5876
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @ambrozticar on GitHub (Jul 21, 2023).
Subject of the issue
Unable to create attachments via the Bitwarden CLI
Deployment environment
Install method: docker
Clients used: BitWarden CLI 2023.7.0
Reverse proxy and version: /
MySQL/MariaDB or PostgreSQL version: /
Other relevant details: tried multiple CLI install methods on both Windows and Ubuntu
Steps to reproduce
bw create attachment --file test.txt --itemid [ITEMID] --session '[SESSIONID]'
Expected behaviour
An attachment should be created on the specified item
Actual behaviour
The following error is returned by the CLI:
400: Bad Request
The request could not be understood by the server due to malformed syntax.
Troubleshooting data
Output from docker logs (trace level):
[2023-07-21 20:17:02.288][request][INFO] POST /api/ciphers/5a578fe6-e212-4d52-aa02-2b16a1d6f1ce/attachment/v2
[2023-07-21 20:17:02.346][response][INFO] (post_attachment_v2) POST /api/ciphers//attachment/v2 => 200 OK
[2023-07-21 20:17:02.346][tracing::span][TRACE] encode_headers;
[2023-07-21 20:17:02.346][tracing::span::active][TRACE] -> encode_headers;
[2023-07-21 20:17:02.346][tracing::span::active][TRACE] <- encode_headers;
[2023-07-21 20:17:02.346][tracing::span][TRACE] -- encode_headers;
[2023-07-21 20:17:02.438][tracing::span][TRACE] parse_headers;
[2023-07-21 20:17:02.438][tracing::span::active][TRACE] -> parse_headers;
[2023-07-21 20:17:02.438][tracing::span::active][TRACE] <- parse_headers;
[2023-07-21 20:17:02.438][tracing::span][TRACE] -- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] -> parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] <- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] -- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] -> parse_headers;
[2023-07-21 20:17:02.478][tracing::span::active][TRACE] <- parse_headers;
[2023-07-21 20:17:02.478][tracing::span][TRACE] -- parse_headers;
[2023-07-21 20:17:02.478][request][INFO] POST /api/ciphers/5a578fe6-e212-4d52-aa02-2b16a1d6f1ce/attachment/474f2023242c83b77194
[2023-07-21 20:17:02.479][rocket::form::parser::][TRACE] multipart field: Field { state: Mutex { data: MultipartState { buffer: StreamBuffer, boundary: "--------------------------008683523461881203688262", stage: ReadingFieldData, next_field_idx: 1, curr_field_name: Some("data"), curr_field_size_limit: 18446744073709551615, curr_field_size_counter: 0, constraints: Constraints { size_limit: SizeLimit { whole_stream: 18446744073709551615, per_field: 18446744073709551615, field_map: {} }, allowed_fields: None } }}, done: false, headers: {"content-disposition": "form-data; name="data"; filename="2.06l17qYisTYV9HU8allwTw==|Uq+dR9R7aS7LcovQcSx5hw==|n02O8g0frqYUvynjw77xlnkLQpmL45DsQHWRiJbUku8="", "content-type": "application/octet-stream"}, content_disposition: ContentDisposition { field_name: Some("data"), file_name: Some("2.06l17qYisTYV9HU8allwTw==|Uq+dR9R7aS7LcovQcSx5hw==|n02O8g0frqYUvynjw77xlnkLQpmL45DsQHWRiJbUku8=") }, content_type: Some("application/octet-stream"), idx: 0 }
[2023-07-21 20:17:02.479][multer::buffer][TRACE] finding next field: Some("data")
[2023-07-21 20:17:02.479][multer::buffer][TRACE] no new field found: EOF. terminating
[2023-07-21 20:17:02.479][multer::buffer][TRACE] finding next field: Some("data")
[2023-07-21 20:17:02.479][multer::buffer][TRACE] no new field found: EOF. terminating
[2023-07-21 20:17:02.479][vaultwarden::api::core::ciphers::][WARN] Data guard
Form < UploadData < '_ > >failed: Errors([Error { name: Some("data"), value: None, kind: Io(Custom { kind: Other, error: field "data" received with incomplete data }), entity: Form }]).[2023-07-21 20:17:02.479][rocket::server::_][WARN] No 400 catcher registered. Using Rocket default.
[2023-07-21 20:17:02.479][response][INFO] (post_attachment_v2_data) POST /api/ciphers//attachment/<attachment_id> multipart/form-data => 400 Bad Request
Wireshark packet capture:
create_attachment.zip
@ambrozticar commented on GitHub (Jul 21, 2023):
The attachment upload works with BitWarden CLI version 2023.4.0
@BlackDex commented on GitHub (Jul 22, 2023):
Bitwarden updated to Node v18 which introduced this issue.
I reported it to Bitwarden https://github.com/bitwarden/clients/issues/5876