Skip to content

Commit

Permalink
don't allow 'except password' permissions to view or copy hidden fiel…
Browse files Browse the repository at this point in the history
…ds (#12899)
  • Loading branch information
jaasen-livefront authored Jan 17, 2025
1 parent a803e5b commit 43a6a93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ export class CustomFieldsComponent implements OnInit, AfterViewInit {
);
});

if (!this.cipherFormContainer.originalCipherView?.viewPassword) {
this.customFieldsForm.disable();
}

// Disable the form if in partial-edit mode
// Must happen after the initial fields are populated
if (this.cipherFormContainer.config.mode === "partial-edit") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h2 bitTypography="h6">{{ "customFields" | i18n }}</h2>
type="button"
bitIconButton
bitPasswordInputToggle
*ngIf="canViewPassword"
(toggledChange)="logHiddenEvent($event)"
></button>
<button
Expand All @@ -47,6 +48,7 @@ <h2 bitTypography="h6">{{ "customFields" | i18n }}</h2>
[appCopyClick]="field.value"
showToast
[valueLabel]="field.name"
*ngIf="canViewPassword"
[appA11yTitle]="'copyCustomField' | i18n: field.name"
(click)="logCopyEvent()"
></button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export class CustomFieldV2Component implements OnInit {
return this.i18nService.t(linkedType.i18nKey);
}

get canViewPassword() {
return this.cipher.viewPassword;
}

async logHiddenEvent(hiddenFieldVisible: boolean) {
if (hiddenFieldVisible) {
await this.eventCollectionService.collect(
Expand Down

0 comments on commit 43a6a93

Please sign in to comment.