[GH-ISSUE #777] Web devices have longer device UUID that does not fit to MySQL/PostgreSQL devices.uuid field #536

Closed
opened 2026-03-03 01:30:18 +03:00 by kerem · 8 comments
Owner

Originally created by @flamechair on GitHub (Dec 22, 2019).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/777

Subject of the issue

Using sqlite the column devices.uuid is of length 40, but the column created in the mysql migration is only 36 characters long

Your environment

  • Bitwarden_rs version: Version 1.13.0-25454697
  • Install method: docker
  • Other relevant information: manually modifying the columns devices.uuid and devices.user_uuid to be char(40) solve this issue

Steps to reproduce

  1. create sqlite db
  2. migrate to mysql via the wiki instructions
  3. import sqlite dump into mysql database
  4. error

Expected behaviour

migration goes smoothly

Actual behaviour

ERROR 1406 (22001) at line 14: Data too long for column 'uuid' at row 1

Relevant logs

web-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee is 40 characters long, but the column in the mysql table is created as char(36)

Originally created by @flamechair on GitHub (Dec 22, 2019). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/777 ### Subject of the issue Using sqlite the column `devices.uuid` is of length 40, but the column created in the mysql migration is only 36 characters long ### Your environment <!-- The version number, obtained from the logs or the admin page --> * Bitwarden_rs version: Version 1.13.0-25454697 <!-- How the server was installed: Docker image / package / built from source --> * Install method: docker * Other relevant information: manually modifying the columns `devices.uuid` and `devices.user_uuid` to be `char(40)` solve this issue ### Steps to reproduce 1. create sqlite db 2. migrate to mysql via the wiki instructions 3. import sqlite dump into mysql database 4. error ### Expected behaviour migration goes smoothly ### Actual behaviour `ERROR 1406 (22001) at line 14: Data too long for column 'uuid' at row 1` ### Relevant logs `web-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee` is 40 characters long, but the column in the mysql table is created as `char(36)`
kerem 2026-03-03 01:30:18 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@mprasil commented on GitHub (Dec 23, 2019):

That's interesting, it seems like devices with name web have longer UUID for some reason. (the extra web- prefix) Makes me wonder why/if these clients actually work with MySQL backend. (SQLite has no length limit, so we probably haven't noticed that issue there) I'd assume it would also affect ProtgreSQL users.

I think this is an actual bug now and it must be problematic even outside of migration issues.

<!-- gh-comment-id:568447848 --> @mprasil commented on GitHub (Dec 23, 2019): That's interesting, it seems like devices with name `web` have longer UUID for some reason. (the extra `web-` prefix) Makes me wonder why/if these clients actually work with MySQL backend. (SQLite has no length limit, so we probably haven't noticed that issue there) I'd assume it would also affect ProtgreSQL users. I think this is an actual bug now and it must be problematic even outside of migration issues.
Author
Owner

@mprasil commented on GitHub (Dec 23, 2019):

Sample SQL data as fetched from sqlite:

sqlite> select uuid, name from devices;
86f23efe-8489-49c5-be6e-9b142ec8a20a|safari
web-c65ae106-b674-4f70-a2ef-a60de293769a|web
web-69caa3c7-729c-4bd8-9d73-73cb6d7e6a71|web
88100c74-493e-46b9-aaf0-2ce35fc78c9d|D5803
<!-- gh-comment-id:568504535 --> @mprasil commented on GitHub (Dec 23, 2019): Sample SQL data as fetched from sqlite: ``` sqlite> select uuid, name from devices; 86f23efe-8489-49c5-be6e-9b142ec8a20a|safari web-c65ae106-b674-4f70-a2ef-a60de293769a|web web-69caa3c7-729c-4bd8-9d73-73cb6d7e6a71|web 88100c74-493e-46b9-aaf0-2ce35fc78c9d|D5803 ```
Author
Owner

@dani-garcia commented on GitHub (Dec 23, 2019):

Interesting, I just checked my database and none of my devices do that, though I remember a long time ago I manually added that web- prefix for a reason I can't remember now. Is is possible that those are some very old devices?

<!-- gh-comment-id:568508034 --> @dani-garcia commented on GitHub (Dec 23, 2019): Interesting, I just checked my database and none of my devices do that, though I remember a long time ago I manually added that web- prefix for a reason I can't remember now. Is is possible that those are some very old devices?
Author
Owner

@flamechair commented on GitHub (Dec 23, 2019):

They most definitely are old devices, I've been using Bitwarden for quite some time now

-------- Original Message --------
On Dec 23, 2019, 9:44 AM, Daniel García wrote:

Interesting, I just checked my database and none of my devices do that, though I remember a long time ago I manually added that web- prefix for a reason I can't remember now. Is is possible that those are some very old devices?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

<!-- gh-comment-id:568527524 --> @flamechair commented on GitHub (Dec 23, 2019): They most definitely are old devices, I've been using Bitwarden for quite some time now -------- Original Message -------- On Dec 23, 2019, 9:44 AM, Daniel García wrote: > Interesting, I just checked my database and none of my devices do that, though I remember a long time ago I manually added that web- prefix for a reason I can't remember now. Is is possible that those are some very old devices? > > — > You are receiving this because you authored the thread. > Reply to this email directly, [view it on GitHub](https://github.com/dani-garcia/bitwarden_rs/issues/777?email_source=notifications&email_token=ACD5GLRXLXFH4J3B6Q5QV3DQ2DMEVA5CNFSM4J6NGXK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHRL5AQ#issuecomment-568508034), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ACD5GLW6KZYTOHITXFZOH6DQ2DMEVANCNFSM4J6NGXKQ).
Author
Owner

@mprasil commented on GitHub (Dec 24, 2019):

Would it make sense to add migrations SQL to drop any web-* devices?

<!-- gh-comment-id:568688475 --> @mprasil commented on GitHub (Dec 24, 2019): Would it make sense to add migrations SQL to drop any `web-*` devices?
Author
Owner

@flamechair commented on GitHub (Dec 24, 2019):

If the UUIDs aren't used anymore, then yes. Otherwise expanding the column to 40 characters would also be an option.

<!-- gh-comment-id:568787428 --> @flamechair commented on GitHub (Dec 24, 2019): If the UUIDs aren't used anymore, then yes. Otherwise expanding the column to 40 characters would also be an option.
Author
Owner

@mprasil commented on GitHub (Dec 27, 2019):

@dani-garcia can you point me to a piece of code where the web- prefix was added? I can't find it and github search certainly doesn't help.. Just to make sure it's already removed.

<!-- gh-comment-id:569226461 --> @mprasil commented on GitHub (Dec 27, 2019): @dani-garcia can you point me to a piece of code where the `web-` prefix was added? I can't find it and github search certainly doesn't help.. Just to make sure it's already removed.
Author
Owner

@dani-garcia commented on GitHub (May 13, 2020):

Closed due to inactivity.

<!-- gh-comment-id:628280234 --> @dani-garcia commented on GitHub (May 13, 2020): Closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#536
No description provided.