1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

[PM-21912] Require userID for KeyService's hasUserKey (#14890)

* Update keyService hasUserKey to require userId and remove unused/duplicate methods

* Update lock component consumer

* Update send commands to pass in userId

* update SSO login to pass in userID

* Update bw serve to pass in userID

* remove unneeded method from electron-key.service
This commit is contained in:
Thomas Avery
2025-07-09 11:53:16 -05:00
committed by GitHub
parent 9f1531a1b2
commit 09fb74679d
14 changed files with 66 additions and 75 deletions

View File

@@ -3,6 +3,7 @@
import * as koaMulter from "@koa/multer";
import * as koaRouter from "@koa/router";
import * as koa from "koa";
import { firstValueFrom, map } from "rxjs";
import { ConfirmCommand } from "./admin-console/commands/confirm.command";
import { ShareCommand } from "./admin-console/commands/share.command";
@@ -170,6 +171,7 @@ export class OssServeConfigurator {
this.serviceContainer.searchService,
this.serviceContainer.encryptService,
this.serviceContainer.apiService,
this.serviceContainer.accountService,
);
this.sendEditCommand = new SendEditCommand(
this.serviceContainer.sendService,
@@ -182,6 +184,7 @@ export class OssServeConfigurator {
this.serviceContainer.sendService,
this.serviceContainer.environmentService,
this.serviceContainer.searchService,
this.serviceContainer.accountService,
);
this.sendRemovePasswordCommand = new SendRemovePasswordCommand(
this.serviceContainer.sendService,
@@ -414,7 +417,10 @@ export class OssServeConfigurator {
this.processResponse(res, Response.error("You are not logged in."));
return true;
}
if (await this.serviceContainer.keyService.hasUserKey()) {
const userId = await firstValueFrom(
this.serviceContainer.accountService.activeAccount$.pipe(map((account) => account?.id)),
);
if (await this.serviceContainer.keyService.hasUserKey(userId)) {
return false;
}
this.processResponse(res, Response.error("Vault is locked."));