1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-31 08:20:37 +01:00

Enforce password reprompt from reports pages (#1225)

This commit is contained in:
Thomas Rittson 2021-10-11 23:32:30 +10:00 committed by GitHub
parent fa6f33cbc5
commit c682f460b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 46 additions and 22 deletions

View File

@ -4,6 +4,7 @@ import { ActivatedRoute } from '@angular/router';
import { AuditService } from 'jslib-common/abstractions/audit.service'; import { AuditService } from 'jslib-common/abstractions/audit.service';
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -24,8 +25,8 @@ export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportC
constructor(cipherService: CipherService, auditService: AuditService, constructor(cipherService: CipherService, auditService: AuditService,
modalService: ModalService, messagingService: MessagingService, modalService: ModalService, messagingService: MessagingService,
userService: UserService, private route: ActivatedRoute) { userService: UserService, passwordRepromptService: PasswordRepromptService, private route: ActivatedRoute) {
super(cipherService, auditService, modalService, messagingService, userService); super(cipherService, auditService, modalService, messagingService, userService, passwordRepromptService);
} }
ngOnInit() { ngOnInit() {

View File

@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router';
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -19,9 +20,9 @@ import { CipherView } from 'jslib-common/models/view/cipherView';
}) })
export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent { export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent {
constructor(cipherService: CipherService, modalService: ModalService, constructor(cipherService: CipherService, modalService: ModalService,
messagingService: MessagingService, userService: UserService, messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService,
private route: ActivatedRoute) { private route: ActivatedRoute) {
super(cipherService, modalService, messagingService, userService); super(cipherService, modalService, messagingService, userService, passwordRepromptService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router';
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -23,9 +24,9 @@ export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportCom
manageableCiphers: Cipher[]; manageableCiphers: Cipher[];
constructor(cipherService: CipherService, modalService: ModalService, constructor(cipherService: CipherService, modalService: ModalService,
messagingService: MessagingService, userService: UserService, messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService,
private route: ActivatedRoute) { private route: ActivatedRoute) {
super(cipherService, modalService, messagingService, userService); super(cipherService, modalService, messagingService, userService, passwordRepromptService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router';
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -19,9 +20,9 @@ import { CipherView } from 'jslib-common/models/view/cipherView';
}) })
export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent { export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent {
constructor(cipherService: CipherService, modalService: ModalService, constructor(cipherService: CipherService, modalService: ModalService,
messagingService: MessagingService, userService: UserService, messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService,
private route: ActivatedRoute) { private route: ActivatedRoute) {
super(cipherService, modalService, messagingService, userService); super(cipherService, modalService, messagingService, userService, passwordRepromptService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -4,6 +4,7 @@ import { ActivatedRoute } from '@angular/router';
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -25,8 +26,9 @@ export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportCompone
constructor(cipherService: CipherService, passwordGenerationService: PasswordGenerationService, constructor(cipherService: CipherService, passwordGenerationService: PasswordGenerationService,
modalService: ModalService, messagingService: MessagingService, modalService: ModalService, messagingService: MessagingService,
userService: UserService, private route: ActivatedRoute) { userService: UserService, passwordRepromptService: PasswordRepromptService, private route: ActivatedRoute) {
super(cipherService, passwordGenerationService, modalService, messagingService, userService); super(cipherService, passwordGenerationService, modalService, messagingService, userService,
passwordRepromptService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -11,7 +11,10 @@ import { Organization } from 'jslib-common/models/domain/organization';
import { AddEditComponent as OrgAddEditComponent } from '../organizations/vault/add-edit.component'; import { AddEditComponent as OrgAddEditComponent } from '../organizations/vault/add-edit.component';
import { AddEditComponent } from '../vault/add-edit.component'; import { AddEditComponent } from '../vault/add-edit.component';
import { CipherRepromptType } from 'jslib-common/enums/cipherRepromptType';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -26,7 +29,8 @@ export class CipherReportComponent {
organization: Organization; organization: Organization;
constructor(private modalService: ModalService, protected userService: UserService, constructor(private modalService: ModalService, protected userService: UserService,
protected messagingService: MessagingService, public requiresPaid: boolean) { } protected messagingService: MessagingService, protected passwordRepromptService: PasswordRepromptService,
public requiresPaid: boolean) { }
async load() { async load() {
this.loading = true; this.loading = true;
@ -36,6 +40,10 @@ export class CipherReportComponent {
} }
async selectCipher(cipher: CipherView) { async selectCipher(cipher: CipherView) {
if (!await this.repromptCipher(cipher)) {
return;
}
const type = this.organization != null ? OrgAddEditComponent : AddEditComponent; const type = this.organization != null ? OrgAddEditComponent : AddEditComponent;
const [modal, childComponent] = await this.modalService.openViewRef(type, this.cipherAddEditModalRef, (comp: OrgAddEditComponent | AddEditComponent) => { const [modal, childComponent] = await this.modalService.openViewRef(type, this.cipherAddEditModalRef, (comp: OrgAddEditComponent | AddEditComponent) => {
@ -85,4 +93,8 @@ export class CipherReportComponent {
protected async setCiphers() { protected async setCiphers() {
this.ciphers = []; this.ciphers = [];
} }
protected async repromptCipher(c: CipherView) {
return c.reprompt === CipherRepromptType.None || await this.passwordRepromptService.showPasswordPrompt();
}
} }

View File

@ -6,6 +6,7 @@ import {
import { AuditService } from 'jslib-common/abstractions/audit.service'; import { AuditService } from 'jslib-common/abstractions/audit.service';
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -25,8 +26,8 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple
constructor(protected cipherService: CipherService, protected auditService: AuditService, constructor(protected cipherService: CipherService, protected auditService: AuditService,
modalService: ModalService, messagingService: MessagingService, modalService: ModalService, messagingService: MessagingService,
userService: UserService) { userService: UserService, passwordRepromptService: PasswordRepromptService) {
super(modalService, userService, messagingService, true); super(modalService, userService, messagingService, passwordRepromptService, true);
} }
ngOnInit() { ngOnInit() {

View File

@ -5,6 +5,7 @@ import {
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -26,8 +27,8 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
cipherDocs = new Map<string, string>(); cipherDocs = new Map<string, string>();
constructor(protected cipherService: CipherService, modalService: ModalService, constructor(protected cipherService: CipherService, modalService: ModalService,
messagingService: MessagingService, userService: UserService) { messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService) {
super(modalService, userService, messagingService, true); super(modalService, userService, messagingService, passwordRepromptService, true);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -5,6 +5,7 @@ import {
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -23,8 +24,9 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem
passwordUseMap: Map<string, number>; passwordUseMap: Map<string, number>;
constructor(protected cipherService: CipherService, modalService: ModalService, constructor(protected cipherService: CipherService, modalService: ModalService,
messagingService: MessagingService, userService: UserService) { messagingService: MessagingService, userService: UserService,
super(modalService, userService, messagingService, true); passwordRepromptService: PasswordRepromptService) {
super(modalService, userService, messagingService, passwordRepromptService, true);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -5,6 +5,7 @@ import {
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -21,8 +22,8 @@ import { CipherReportComponent } from './cipher-report.component';
}) })
export class UnsecuredWebsitesReportComponent extends CipherReportComponent implements OnInit { export class UnsecuredWebsitesReportComponent extends CipherReportComponent implements OnInit {
constructor(protected cipherService: CipherService, modalService: ModalService, constructor(protected cipherService: CipherService, modalService: ModalService,
messagingService: MessagingService, userService: UserService) { messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService) {
super(modalService, userService, messagingService, true); super(modalService, userService, messagingService, passwordRepromptService, true);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -6,6 +6,7 @@ import {
import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { UserService } from 'jslib-common/abstractions/user.service'; import { UserService } from 'jslib-common/abstractions/user.service';
import { ModalService } from 'jslib-angular/services/modal.service'; import { ModalService } from 'jslib-angular/services/modal.service';
@ -27,9 +28,9 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
private passwordStrengthCache = new Map<string, number>(); private passwordStrengthCache = new Map<string, number>();
constructor(protected cipherService: CipherService, protected passwordGenerationService: PasswordGenerationService, constructor(protected cipherService: CipherService, protected passwordGenerationService: PasswordGenerationService,
modalService: ModalService, messagingService: MessagingService, modalService: ModalService, messagingService: MessagingService, userService: UserService,
userService: UserService) { passwordRepromptService: PasswordRepromptService) {
super(modalService, userService, messagingService, true); super(modalService, userService, messagingService, passwordRepromptService, true);
} }
async ngOnInit() { async ngOnInit() {