mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-04-26 01:35:54 +03:00
[GH-ISSUE #1081] MySQL backend: Cannot share cipher with organisation #767
Labels
No labels
SSO
Third party
better for forum
bug
bug
documentation
duplicate
enhancement
future Vault
future Vault
future Vault
good first issue
help wanted
low priority
notes
pull-request
question
troubleshooting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vaultwarden#767
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @smerschjohann on GitHub (Aug 3, 2020).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1081
Subject of the issue
If bitwarden_rs is used with mysql backend, it is not possible to share existing ciphers with an organisation.
Your environment
Server Installed 1.16.1
Server Latest 1.16.1
Web Installed 2.15.1
Web Latest 2.15.1
Bitwarden_rs version: In Openshift environment using docker image: bitwardenrs/server-mysql:1.16.1
Install method
Steps to reproduce
Expected behaviour
The cipher can be moved to the organisation.
Actual behaviour
the cipher cannot be stored because of a constraint violation.
Relevant logs
If the contraint is divided in update and delete constraints, it turns out that the delete contraint is violated:
It seems that the server wants to recreate the cipher in the database instead of updating it. By trying that, it violated the key constraints of the ciphers_collections.
It apperas that the folder_collection is also affected.
@smerschjohann commented on GitHub (Aug 3, 2020):
A possible workaround for now: Delete the constraint on the collection tables
@smerschjohann commented on GitHub (Aug 3, 2020):
The issue is the use of replace_into in all of the save() methods:
github.com/dani-garcia/bitwarden_rs@f724addf9a/src/db/models/user.rs (L186)github.com/dani-garcia/bitwarden_rs@f724addf9a/src/db/models/cipher.rs (L207)replace_into checks for constraint violations on delete: If there are foreign keys, ON DELETE action will be activated by REPLACE..
Instead of
REPLACE INTO, the use ofINSERT ... ON DUPLICATE KEY UPDATEshould fix the problem, but it seems unavailable in the diesel sdk.I think it cannot be done in a single statement using that framework.
@jobec commented on GitHub (Aug 9, 2020):
As with #1065 , if you switch to MariaDB 10.3 (e.g. image
mariadb:10.3) I'm guessing it'll be fixed.