From 9d66d490bf14990d5b428622f14ce379ed8f2779 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Wed, 10 Jan 2024 15:51:19 +0100 Subject: [PATCH] update web-vault to v2024.1.0 --- Dockerfile | 4 +- patches/v2024.1.0.patch | 686 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 688 insertions(+), 2 deletions(-) create mode 100644 patches/v2024.1.0.patch diff --git a/Dockerfile b/Dockerfile index b370e5f..b87cf57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,8 +26,8 @@ USER node # Can be a tag, release, but prefer a commit hash because it's not changeable # https://github.com/bitwarden/clients/commit/${VAULT_VERSION} # -# Using https://github.com/bitwarden/clients/releases/tag/web-v2023.12.0 -ARG VAULT_VERSION=8d90085607341deab976952bce8d8937cf3eefb1 +# Using https://github.com/bitwarden/clients/releases/tag/web-v2024.1.0 +ARG VAULT_VERSION=e8a54a70a5d136d4e0d7ccdb15d5056d681c3f47 WORKDIR /vault RUN git -c init.defaultBranch=main init && \ diff --git a/patches/v2024.1.0.patch b/patches/v2024.1.0.patch new file mode 100644 index 0000000..c9234c9 --- /dev/null +++ b/patches/v2024.1.0.patch @@ -0,0 +1,686 @@ +diff --git a/apps/web/src/app/admin-console/organizations/create/organization-information.component.html b/apps/web/src/app/admin-console/organizations/create/organization-information.component.html +index 6029cfd833..04324b7d19 100644 +--- a/apps/web/src/app/admin-console/organizations/create/organization-information.component.html ++++ b/apps/web/src/app/admin-console/organizations/create/organization-information.component.html +@@ -12,7 +12,7 @@ + + + +- {{ "billingEmail" | i18n }} ++ {{ "email" | i18n }} + + + +diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.html b/apps/web/src/app/admin-console/organizations/settings/account.component.html +index 83e0e35cf3..9385c4071c 100644 +--- a/apps/web/src/app/admin-console/organizations/settings/account.component.html ++++ b/apps/web/src/app/admin-console/organizations/settings/account.component.html +@@ -15,7 +15,7 @@ + + + +- {{ "billingEmail" | i18n }} ++ {{ "email" | i18n }} + + + +diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.ts b/apps/web/src/app/admin-console/organizations/settings/account.component.ts +index 10aa1224e2..df3d18e89b 100644 +--- a/apps/web/src/app/admin-console/organizations/settings/account.component.ts ++++ b/apps/web/src/app/admin-console/organizations/settings/account.component.ts +@@ -120,14 +120,14 @@ export class AccountComponent { + this.canUseApi = organization.useApi; + + // Update disabled states - reactive forms prefers not using disabled attribute +- if (!this.selfHosted) { ++ if (this.selfHosted) { + this.formGroup.get("orgName").enable(); + this.formGroup.get("businessName").enable(); + this.collectionManagementFormGroup.get("limitCollectionCreationDeletion").enable(); + this.collectionManagementFormGroup.get("allowAdminAccessToAllCollectionItems").enable(); + } + +- if (!this.selfHosted && this.canEditSubscription) { ++ if (this.selfHosted && this.canEditSubscription) { + this.formGroup.get("billingEmail").enable(); + } + +@@ -183,7 +183,7 @@ export class AccountComponent { + + submitCollectionManagement = async () => { + // Early exit if self-hosted +- if (this.selfHosted) { ++ if (!this.selfHosted) { + return; + } + +diff --git a/apps/web/src/app/app.component.ts b/apps/web/src/app/app.component.ts +index 1f7d8cc2f1..5b45fd9b52 100644 +--- a/apps/web/src/app/app.component.ts ++++ b/apps/web/src/app/app.component.ts +@@ -182,6 +182,10 @@ export class AppComponent implements OnDestroy, OnInit { + break; + } + case "showToast": ++ if (typeof message.text === "string" && typeof crypto.subtle === "undefined") { ++ message.title = "This browser requires HTTPS to use the web vault"; ++ message.text = "Check the Vaultwarden wiki for details on how to enable it"; ++ } + this.showToast(message); + break; + case "setFullWidth": +diff --git a/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts b/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts +index 849e003440..de32156aad 100644 +--- a/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts ++++ b/apps/web/src/app/auth/settings/two-factor-authenticator.component.ts +@@ -109,11 +109,11 @@ export class TwoFactorAuthenticatorComponent + new window.QRious({ + element: document.getElementById("qr"), + value: +- "otpauth://totp/Bitwarden:" + ++ "otpauth://totp/Vaultwarden:" + + Utils.encodeRFC3986URIComponent(email) + + "?secret=" + + encodeURIComponent(this.key) + +- "&issuer=Bitwarden", ++ "&issuer=Vaultwarden", + size: 160, + }); + }, 100); +diff --git a/apps/web/src/app/billing/organizations/organization-billing-history-view.component.ts b/apps/web/src/app/billing/organizations/organization-billing-history-view.component.ts +index 78872aa6a9..eed953b91a 100644 +--- a/apps/web/src/app/billing/organizations/organization-billing-history-view.component.ts ++++ b/apps/web/src/app/billing/organizations/organization-billing-history-view.component.ts +@@ -44,7 +44,7 @@ export class OrgBillingHistoryViewComponent implements OnInit, OnDestroy { + return; + } + this.loading = true; +- this.billing = await this.organizationApiService.getBilling(this.organizationId); ++ this.billing = null; + this.loading = false; + } + } +diff --git a/apps/web/src/app/billing/organizations/organization-plans.component.html b/apps/web/src/app/billing/organizations/organization-plans.component.html +index a77d42a359..c9983b8547 100644 +--- a/apps/web/src/app/billing/organizations/organization-plans.component.html ++++ b/apps/web/src/app/billing/organizations/organization-plans.component.html +@@ -28,7 +28,7 @@ + (ngSubmit)="submit()" + [appApiAction]="formPromise" + ngNativeValidate +- *ngIf="!loading && !selfHosted && this.passwordManagerPlans && this.secretsManagerPlans" ++ *ngIf="!loading" + class="tw-pt-6" + > + !!plan.PasswordManager); +@@ -188,6 +189,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { + this.plan = providerDefaultPlan.type; + this.product = providerDefaultPlan.product; + } ++ */ + + if (!this.createOrganization) { + this.upgradeFlowPrefillForm(); +@@ -256,6 +258,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { + } + + get selectableProducts() { ++ return null; + if (this.acceptingSponsorship) { + const familyPlan = this.passwordManagerPlans.find( + (plan) => plan.type === PlanType.FamiliesAnnually, +@@ -286,6 +289,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { + } + + get selectablePlans() { ++ return null; + const selectedProductType = this.formGroup.controls.product.value; + const result = this.passwordManagerPlans?.filter( + (plan) => +@@ -425,10 +429,11 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { + } + + get planOffersSecretsManager() { +- return this.selectedSecretsManagerPlan != null; ++ return false; + } + + changedProduct() { ++ return; + const selectedPlan = this.selectablePlans[0]; + + this.setPlanType(selectedPlan.type); +@@ -639,7 +644,9 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { + request.name = this.formGroup.controls.name.value; + request.billingEmail = this.formGroup.controls.billingEmail.value; + request.keys = new OrganizationKeysRequest(orgKeys[0], orgKeys[1].encryptedString); ++ request.planType = PlanType.Free; + ++ /* + if (this.selectedPlan.type === PlanType.Free) { + request.planType = PlanType.Free; + } else { +@@ -669,6 +676,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy { + + // Secrets Manager + this.buildSecretsManagerRequest(request); ++ */ + + if (this.hasProvider) { + const providerRequest = new ProviderOrganizationCreateRequest( +diff --git a/apps/web/src/app/components/environment-selector/environment-selector.component.ts b/apps/web/src/app/components/environment-selector/environment-selector.component.ts +index 2e82e383b6..5c08e0b4d2 100644 +--- a/apps/web/src/app/components/environment-selector/environment-selector.component.ts ++++ b/apps/web/src/app/components/environment-selector/environment-selector.component.ts +@@ -24,7 +24,7 @@ export class EnvironmentSelectorComponent implements OnInit { + const domain = Utils.getDomain(window.location.href); + this.isEuServer = domain.includes(RegionDomain.EU); + this.isUsServer = domain.includes(RegionDomain.US) || domain.includes(RegionDomain.USQA); +- this.showRegionSelector = !this.platformUtilsService.isSelfHost(); ++ this.showRegionSelector = false; + this.routeAndParams = `/#${this.router.url}`; + } + } +diff --git a/apps/web/src/app/core/init.service.ts b/apps/web/src/app/core/init.service.ts +index 899a168479..5bb71b05f6 100644 +--- a/apps/web/src/app/core/init.service.ts ++++ b/apps/web/src/app/core/init.service.ts +@@ -7,10 +7,7 @@ import { NotificationsService as NotificationsServiceAbstraction } from "@bitwar + import { TwoFactorService as TwoFactorServiceAbstraction } from "@bitwarden/common/auth/abstractions/two-factor.service"; + import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/platform/abstractions/crypto.service"; + import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; +-import { +- EnvironmentService as EnvironmentServiceAbstraction, +- Urls, +-} from "@bitwarden/common/platform/abstractions/environment.service"; ++import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/platform/abstractions/environment.service"; + import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/platform/abstractions/i18n.service"; + import { StateService as StateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service"; + import { ConfigService } from "@bitwarden/common/platform/services/config/config.service"; +@@ -38,11 +35,23 @@ export class InitService { + ) {} + + init() { ++ function getBaseUrl() { ++ // If the base URL is `https://vaultwarden.example.com/base/path/`, ++ // `window.location.href` should have one of the following forms: ++ // ++ // - `https://vaultwarden.example.com/base/path/` ++ // - `https://vaultwarden.example.com/base/path/#/some/route[?queryParam=...]` ++ // ++ // We want to get to just `https://vaultwarden.example.com/base/path`. ++ let baseUrl = window.location.href; ++ baseUrl = baseUrl.replace(/#.*/, ""); // Strip off `#` and everything after. ++ baseUrl = baseUrl.replace(/\/+$/, ""); // Trim any trailing `/` chars. ++ return baseUrl; ++ } + return async () => { + await this.stateService.init(); + +- const urls = process.env.URLS as Urls; +- urls.base ??= this.win.location.origin; ++ const urls = { base: getBaseUrl() }; + await this.environmentService.setUrls(urls); + // Workaround to ignore stateService.activeAccount until process.env.URLS are set + // TODO: Remove this when implementing ticket PM-2637 +diff --git a/apps/web/src/app/core/router.service.ts b/apps/web/src/app/core/router.service.ts +index 5a0d903ba7..d6fedadd38 100644 +--- a/apps/web/src/app/core/router.service.ts ++++ b/apps/web/src/app/core/router.service.ts +@@ -26,7 +26,7 @@ export class RouterService { + .subscribe((event: NavigationEnd) => { + this.currentUrl = event.url; + +- let title = i18nService.t("bitWebVault"); ++ let title = "Vaultwarden Web"; + + if (this.currentUrl.includes("/sm/")) { + title = i18nService.t("bitSecretsManager"); +diff --git a/apps/web/src/app/core/web-platform-utils.service.ts b/apps/web/src/app/core/web-platform-utils.service.ts +index 02c7c29e34..cabd8b416a 100644 +--- a/apps/web/src/app/core/web-platform-utils.service.ts ++++ b/apps/web/src/app/core/web-platform-utils.service.ts +@@ -133,15 +133,15 @@ export class WebPlatformUtilsService implements PlatformUtilsService { + } + + isDev(): boolean { +- return process.env.NODE_ENV === "development"; ++ return false; + } + + isSelfHost(): boolean { +- return WebPlatformUtilsService.isSelfHost(); ++ return false; + } + + static isSelfHost(): boolean { +- return process.env.ENV.toString() === "selfhosted"; ++ return false; + } + + copyToClipboard(text: string, options?: any): void | boolean { +diff --git a/apps/web/src/app/layouts/footer.component.html b/apps/web/src/app/layouts/footer.component.html +index 98836bfd5d..3c6d5aac89 100644 +--- a/apps/web/src/app/layouts/footer.component.html ++++ b/apps/web/src/app/layouts/footer.component.html +@@ -1,7 +1,9 @@ + + +- ++ + + + {{ hostname }} +diff --git a/apps/web/src/app/layouts/navbar.component.html b/apps/web/src/app/layouts/navbar.component.html +index 72dd17d0dc..aaac2905dd 100644 +--- a/apps/web/src/app/layouts/navbar.component.html ++++ b/apps/web/src/app/layouts/navbar.component.html +@@ -1,6 +1,6 @@ +