From 2ff9c3bb766f7bcb37d0084d7dd689e86fda4d27 Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Thu, 13 Jun 2024 13:18:49 -0700 Subject: [PATCH 1/5] [AC-2771] [AC-2772] Provider Restriction Fixes (#9635) * [AC-2771] Do not make API request when restricted provider is not a member of the org * [AC-2771] Fix console errors when switching organizations * [AC-2772] Fix org vault for providers who are members - Show vault filters - Hide header search bar - Show create new item button --- .../vault-collection-row.component.ts | 4 ++-- .../vault-header/vault-header.component.html | 2 +- .../vault-header/vault-header.component.ts | 8 ++++++-- .../src/app/vault/org-vault/vault.component.ts | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts b/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts index 8909c3e8bd9..873bdd3e1a0 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts +++ b/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts @@ -69,9 +69,9 @@ export class VaultCollectionRowComponent { if (this.collection instanceof CollectionAdminView) { // Only show AddAccess if unmanaged and allowAdminAccessToAllCollectionItems is disabled return ( - !this.organization.allowAdminAccessToAllCollectionItems && + !this.organization?.allowAdminAccessToAllCollectionItems && this.collection.unmanaged && - this.organization.canEditUnmanagedCollections() + this.organization?.canEditUnmanagedCollections() ); } diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html index ee45f5921e5..75ea3fd050b 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html @@ -93,7 +93,7 @@ (); @@ -352,6 +356,16 @@ export class VaultComponent implements OnInit, OnDestroy { } let ciphers; + // Restricted providers (who are not members) do not have access org cipher endpoint below + // Return early to avoid 404 response + if ( + this.restrictProviderAccessEnabled && + !organization.isMember && + organization.isProviderUser + ) { + return []; + } + if (this.flexibleCollectionsV1Enabled) { // Flexible collections V1 logic. // If the user can edit all ciphers for the organization then fetch them ALL. From d266868dd8a5fdc0ed8ad9989d385831f8c6ea6b Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:26:52 -0400 Subject: [PATCH 2/5] Bumped client version(s) (#9636) --- apps/web/package.json | 2 +- package-lock.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index 286811dd5c6..b56a3e03d03 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@bitwarden/web-vault", - "version": "2024.6.0", + "version": "2024.6.1", "scripts": { "build:oss": "webpack", "build:bit": "webpack -c ../../bitwarden_license/bit-web/webpack.config.js", diff --git a/package-lock.json b/package-lock.json index ab127c10058..5c5d17352cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -251,7 +251,7 @@ }, "apps/web": { "name": "@bitwarden/web-vault", - "version": "2024.6.0" + "version": "2024.6.1" }, "libs/admin-console": { "name": "@bitwarden/admin-console", From 23330598858114ab632c3560cfcbc65cc38a5da1 Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Thu, 13 Jun 2024 14:11:18 -0700 Subject: [PATCH 3/5] [PM-8831] Hide trashed items from new vault popup lists (#9633) --- .../popup/services/vault-popup-list-filters.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts b/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts index 66e264dd6de..8242637d5de 100644 --- a/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts +++ b/apps/browser/src/vault/popup/services/vault-popup-list-filters.service.ts @@ -2,10 +2,10 @@ import { Injectable } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { FormBuilder } from "@angular/forms"; import { - Observable, combineLatest, distinctUntilChanged, map, + Observable, startWith, switchMap, tap, @@ -104,6 +104,11 @@ export class VaultPopupListFiltersService { map( (filters) => (ciphers: CipherView[]) => ciphers.filter((cipher) => { + // Vault popup lists never shows deleted ciphers + if (cipher.isDeleted) { + return false; + } + if (filters.cipherType !== null && cipher.type !== filters.cipherType) { return false; } From 2e2061e34ab0c909bb85547eccd6299dcbb3d076 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Thu, 13 Jun 2024 21:06:44 -0500 Subject: [PATCH 4/5] [PM-8869] Autofill features broken on Safari --- .../autofill/services/collect-autofill-content.service.ts | 5 +++-- apps/browser/src/autofill/utils/index.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/browser/src/autofill/services/collect-autofill-content.service.ts b/apps/browser/src/autofill/services/collect-autofill-content.service.ts index 87470655786..39e75711561 100644 --- a/apps/browser/src/autofill/services/collect-autofill-content.service.ts +++ b/apps/browser/src/autofill/services/collect-autofill-content.service.ts @@ -21,6 +21,7 @@ import { nodeIsFormElement, nodeIsInputElement, sendExtensionMessage, + requestIdleCallbackPolyfill, } from "../utils"; import { AutofillOverlayContentService } from "./abstractions/autofill-overlay-content.service"; @@ -1057,7 +1058,7 @@ class CollectAutofillContentService implements CollectAutofillContentServiceInte } if (!this.mutationsQueue.length) { - globalThis.requestIdleCallback(this.processMutations, { timeout: 500 }); + requestIdleCallbackPolyfill(this.processMutations, { timeout: 500 }); } this.mutationsQueue.push(mutations); }; @@ -1194,7 +1195,7 @@ class CollectAutofillContentService implements CollectAutofillContentServiceInte continue; } - globalThis.requestIdleCallback( + requestIdleCallbackPolyfill( // We are setting this item to a -1 index because we do not know its position in the DOM. // This value should be updated with the next call to collect page details. () => void this.buildAutofillFieldItem(node as ElementWithOpId, -1), diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts index cbb0a862e3c..ab01f517e3e 100644 --- a/apps/browser/src/autofill/utils/index.ts +++ b/apps/browser/src/autofill/utils/index.ts @@ -1,6 +1,14 @@ import { AutofillPort } from "../enums/autofill-port.enums"; import { FillableFormFieldElement, FormFieldElement } from "../types"; +export function requestIdleCallbackPolyfill(callback: () => void, options?: Record) { + if ("requestIdleCallback" in globalThis) { + return globalThis.requestIdleCallback(() => callback(), options); + } + + return globalThis.setTimeout(() => callback(), 1); +} + /** * Generates a random string of characters that formatted as a custom element name. */ From 15e4a24b9fabceaa17c305f442e9ed068352538d Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Thu, 13 Jun 2024 21:07:39 -0500 Subject: [PATCH 5/5] [PM-8869] Autofill features broken on Safari --- apps/browser/src/autofill/utils/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts index ab01f517e3e..e5d20cf9f59 100644 --- a/apps/browser/src/autofill/utils/index.ts +++ b/apps/browser/src/autofill/utils/index.ts @@ -1,6 +1,12 @@ import { AutofillPort } from "../enums/autofill-port.enums"; import { FillableFormFieldElement, FormFieldElement } from "../types"; +/** + * Polyfills the requestIdleCallback API with a setTimeout fallback. + * + * @param callback - The callback function to run when the browser is idle. + * @param options - The options to pass to the requestIdleCallback function. + */ export function requestIdleCallbackPolyfill(callback: () => void, options?: Record) { if ("requestIdleCallback" in globalThis) { return globalThis.requestIdleCallback(() => callback(), options);