Attachments downloading as 4 byte files (contains the word 'null') #688

Closed
opened 2026-02-04 22:13:59 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @jph on GitHub (Apr 18, 2020).

Subject of the issue

When attempting to download an attachment, I instead get a 4 byte file that contains the word 'null'.

Your environment

  • Bitwarden_rs version: Version: 1.14.2-5a390a97
  • Install method: Docker image
  • Clients used: Browser
  • Reverse proxy and version: Caddy*
  • Version of mysql/postgresql:
  • Other relevant information:

Steps to reproduce

Nothing configured away from the default - it's docker & caddy for SSL. Admin panel is enabled.
Steps: Attempt to download an attachment.

Expected behaviour

I should receive a decrypted attachment

Actual behaviour

I get a 4 byte file with 'null' as the content.

Relevant logs

Bitwarden logs don't seem to indicate an issue:

[2020-04-17 23:15:46][request][INFO] GET /attachments/8befdbdf-1eeb-4533-acee-47662ea50579/9caf8bda3da6a35d1316
[2020-04-17 23:15:46][response][INFO] GET /attachments/<uuid>/<file..> (attachments) => 200 OK

Update: grabbed the Caddy (proxy) logs too, and found something interesting.

[IP ADDRESS] - - [18/Apr/2020:23:20:07 +0000] "GET /attachments/8befdbdf-1eeb-4533-acee-47662ea50579/9caf8bda3da6a35d1316 HTTP/2.0" 200 1181

The Caddy logs indicate the body size is 1181 bytes - almost exactly matching the filesize I've attempted to download. Further testing indicates this is indeed the case - below you can find a log of a 5mb attachment download.

[IP ADDRESS] - - [18/Apr/2020:23:22:02 +0000] "GET /attachments/8befdbdf-1eeb-4533-acee-47662ea50579/165361be8425bd69e867 HTTP/2.0" 200 5982060

But as you can see below, downloaded file size differs from the reported file size in Bitwarden.

image
image

Originally created by @jph on GitHub (Apr 18, 2020). <!-- 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 unneccessary for your issue, feel free to remove them. Remember to hide/obfuscate personal and confidential information, such as names, global IP/DNS adresses and especially passwords, if neccessary. --> ### Subject of the issue When attempting to download an attachment, I instead get a 4 byte file that contains the word 'null'. ### Your environment <!-- The version number, obtained from the logs or the admin page --> * Bitwarden_rs version: Version: 1.14.2-5a390a97 <!-- How the server was installed: Docker image / package / built from source --> * Install method: Docker image * Clients used: <!-- if applicable --> Browser * Reverse proxy and version: <!-- if applicable --> Caddy* * Version of mysql/postgresql: <!-- if applicable --> * Other relevant information: ### Steps to reproduce <!-- Tell us how to reproduce this issue. What parameters did you set (differently from the defaults) and how did you start bitwarden_rs? --> Nothing configured away from the default - it's docker & caddy for SSL. Admin panel is enabled. Steps: Attempt to download an attachment. ### Expected behaviour I should receive a decrypted attachment ### Actual behaviour I get a 4 byte file with 'null' as the content. ### Relevant logs Bitwarden logs don't seem to indicate an issue: ``` [2020-04-17 23:15:46][request][INFO] GET /attachments/8befdbdf-1eeb-4533-acee-47662ea50579/9caf8bda3da6a35d1316 [2020-04-17 23:15:46][response][INFO] GET /attachments/<uuid>/<file..> (attachments) => 200 OK ``` Update: grabbed the Caddy (proxy) logs too, and found something interesting. ``` [IP ADDRESS] - - [18/Apr/2020:23:20:07 +0000] "GET /attachments/8befdbdf-1eeb-4533-acee-47662ea50579/9caf8bda3da6a35d1316 HTTP/2.0" 200 1181 ``` The Caddy logs indicate the body size is 1181 bytes - almost exactly matching the filesize I've attempted to download. Further testing indicates this is indeed the case - below you can find a log of a 5mb attachment download. ``` [IP ADDRESS] - - [18/Apr/2020:23:22:02 +0000] "GET /attachments/8befdbdf-1eeb-4533-acee-47662ea50579/165361be8425bd69e867 HTTP/2.0" 200 5982060 ``` But as you can see below, downloaded file size differs from the reported file size in Bitwarden. <!-- Share some logfiles, screenshots or output of relevant programs with us. --> ![image](https://user-images.githubusercontent.com/155770/79620871-ccb6f600-8154-11ea-87de-bb0905b66277.png) ![image](https://user-images.githubusercontent.com/155770/79620880-d5a7c780-8154-11ea-9112-9451b1ede811.png)
Author
Owner

@dani-garcia commented on GitHub (Apr 18, 2020):

Other user had this problem when enabling caddy gzip compression so check if you have it enabled and disable it if that’s the case.

https://bitwardenrs.discourse.group/t/downloading-attachment-in-firefox/62/14

@dani-garcia commented on GitHub (Apr 18, 2020): Other user had this problem when enabling caddy gzip compression so check if you have it enabled and disable it if that’s the case. https://bitwardenrs.discourse.group/t/downloading-attachment-in-firefox/62/14
Author
Owner

@jph commented on GitHub (Apr 18, 2020):

It's as simple as that. My mistake, I didn't actually search the Discourse group. At least it's here now if anybody searches for it.

Thank you @dani-garcia for the quick reply. :)

@jph commented on GitHub (Apr 18, 2020): It's as simple as that. My mistake, I didn't actually search the Discourse group. At least it's here now if anybody searches for it. Thank you @dani-garcia for the quick reply. :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#688