mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
No external user ID created when using bwdc and user already has an account #1663
Reference in New Issue
Block a user
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 @louisfgr on GitHub (Aug 14, 2023).
Originally assigned to: @BlackDex on GitHub.
Subject of the issue
I user Bitwarden directory connector (v2022.11.0) to sync my AD users and groups into my Organisation.
Thereby I noticed that users who already have an account do not get an external id.
This seems to be independent of whether the account already exists because the user is using the private vault and is not yet part of an organization or the user has already been manually invited to the organization.
Deployment environment
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden:
Steps to reproduce
Case 1: A user without an account in this Vaultwarden instance is added to an organization via bwdc.
The user is invited and External ID is set successfully.
Case 2: A user with an existing account in this Vaultwarden instance is added to an organization via bwdc.
The user is invited and added to the organization, but no External ID is set.
Case 3: A user who is already part of my organization is to be subsequently managed by bwdc and given an External ID. After synchronization the user seems to be untouched. No External ID has been set.
Expected behaviour
In every case an External ID should be assigned to the user.
Even if the user already exists, an external ID should be assigned, otherwise the permission assignment between Vaultwarden and AD groups will not work.
If this is an issue in bwdc, is there a way to manually assign the External ID?
@BlackDex commented on GitHub (Aug 14, 2023):
We would have to check how this logic works on Bitwarden it self.
I'm not totally sure how this flow goes with existing users from the top of my head.
@louisfgr commented on GitHub (Aug 14, 2023):
That's the log on debug level during the bwdc sync:
[2023-08-14 11:52:41.230][request][INFO] POST /api/public/organization/import
[2023-08-14 11:52:41.233][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_name")], "org_name")))
[2023-08-14 11:52:41.233][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("img_src")], "img_src")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_name")], "org_name")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_id")], "org_id")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_user_id")], "org_user_id")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("email")], "email")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_name")], "org_name")))
[2023-08-14 11:52:41.234][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("token")], "token")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("img_src")], "img_src")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_name")], "org_name")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_name")], "org_name")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_id")], "org_id")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_user_id")], "org_user_id")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("email")], "email")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("org_name_encoded")], "org_name_encoded")))
[2023-08-14 11:52:41.235][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("token")], "token")))
[2023-08-14 11:52:41.257][response][INFO] (ldap_import) POST /api/public/organization/import => 200 OK
[2023-08-14 11:52:45.671][vaultwarden::api::core::two_factor][DEBUG] Sending notifications for incomplete 2FA logins
[2023-08-14 11:52:48.011][request][INFO] GET /alive
[2023-08-14 11:52:48.012][response][INFO] (alive) GET /alive => 200 OK
@louisfgr commented on GitHub (Aug 18, 2023):
Bitwarden has an additional check for this case and adds the external ID to the user.
fd892b2ff4/src/Core/Services/Implementations/OrganizationService.cs (L1850-L1867)This does not seem to be the case with Vaultwarden.
5b7d7390b0/src/api/core/public.rs (L63-L87)@louisfgr commented on GitHub (Aug 24, 2023):
As someone who is not really familiar with Rust, is there anything I can do to help fix this issue sooner?
Alternatively, is there any way to set the external ID manually, e.g. by manually calling an API endpoint or by changing the DB?
@BlackDex commented on GitHub (Aug 24, 2023):
I have not had time to look at this yet. You just need to be patient for a fix.
You should be able to modified the database, just check how the other users are listed in the database.