Skip to content

Commit

Permalink
Merge branch 'master' into sm/sm-949-service-account-event-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Avery authored Oct 16, 2023
2 parents 1f483c1 + c3856ce commit f5f9335
Show file tree
Hide file tree
Showing 172 changed files with 5,885 additions and 563 deletions.
4 changes: 2 additions & 2 deletions apps/browser/src/_locales/bg/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"message": "Копиране на потребителското име"
},
"copyNumber": {
"message": "Копиране на номера"
"message": "Копиране на но̀мера"
},
"copySecurityCode": {
"message": "Копиране на кода за сигурност"
Expand Down Expand Up @@ -257,7 +257,7 @@
"message": "Избор"
},
"generatePassword": {
"message": "Генериране на парола"
"message": "Нова парола"
},
"regeneratePassword": {
"message": "Регенериране на паролата"
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/_locales/fa/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
"message": "درباره سازمان‌ها اطلاعات کسب کنید"
},
"learnOrgConfirmation": {
"message": "Bitwarden به شما اجازه می‌دهد با استفاده از سازماندهی، موارد گاوصندوق خود را با دیگران به اشتراک بگذارید. آیا مایل به بازدید از وب سایت bitwarden.com برای کسب اطلاعات بیشتر هستید؟"
"message": "Bitwarden به شما اجازه می‌دهد با استفاده از سازمان، موارد گاوصندوق خود را با دیگران به اشتراک بگذارید. آیا مایل به بازدید از وب سایت bitwarden.com برای کسب اطلاعات بیشتر هستید؟"
},
"moveToOrganization": {
"message": "انتقال به سازمان"
Expand Down
16 changes: 8 additions & 8 deletions apps/browser/src/_locales/sr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@
"message": "Аутоматско допуњавање"
},
"autoFillLogin": {
"message": "Auto-fill login"
"message": "Ауто-пуњење пријаве"
},
"autoFillCard": {
"message": "Auto-fill card"
"message": "Ауто-пуњење картице"
},
"autoFillIdentity": {
"message": "Auto-fill identity"
"message": "Ауто-пуњење идентитета"
},
"generatePasswordCopied": {
"message": "Генериши Лозинку (копирано)"
Expand All @@ -110,19 +110,19 @@
"message": "Нема одговарајућих пријављивања."
},
"noCards": {
"message": "No cards"
"message": "Нема карте"
},
"noIdentities": {
"message": "No identities"
"message": "Нема идентитета"
},
"addLoginMenu": {
"message": "Add login"
"message": "Нема пријаве"
},
"addCardMenu": {
"message": "Add card"
"message": "Додати картицу"
},
"addIdentityMenu": {
"message": "Add identity"
"message": "Додати идентитет"
},
"unlockVaultMenu": {
"message": "Откључај свој сеф"
Expand Down
4 changes: 2 additions & 2 deletions apps/browser/src/_locales/sv/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
"message": "Fyll i automatiskt"
},
"autoFillLogin": {
"message": "Auto-fill login"
"message": "Autofyll inloggning"
},
"autoFillCard": {
"message": "Auto-fill card"
"message": "Autofyll kort"
},
"autoFillIdentity": {
"message": "Auto-fill identity"
Expand Down
5 changes: 4 additions & 1 deletion apps/browser/src/auth/popup/two-factor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ <h1 class="center">
"
>
<div id="duo-frame">
<iframe id="duo_iframe" sandbox="allow-scripts allow-forms allow-same-origin"></iframe>
<iframe
id="duo_iframe"
sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"
></iframe>
</div>
<div class="box">
<div class="box-content">
Expand Down
5 changes: 0 additions & 5 deletions apps/browser/src/autofill/content/autofill.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,6 @@
function fillTheElement(el, op) {
var shouldCheck;
if (el && null !== op && void 0 !== op && !(el.disabled || el.a || el.readOnly)) {
const tabURLChanged = !fillScript.savedUrls?.some(url => url.startsWith(window.location.origin))
// Check to make sure the page location didn't change
if (tabURLChanged) {
return;
}
switch (markTheFilling && el.form && !el.form.opfilled && (el.form.opfilled = true),
el.type ? el.type.toLowerCase() : null) {
case 'checkbox':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ describe("InsertAutofillContentService", () => {
jest.spyOn(insertAutofillContentService as any, "fillingWithinSandboxedIframe");
jest.spyOn(insertAutofillContentService as any, "userCancelledInsecureUrlAutofill");
jest.spyOn(insertAutofillContentService as any, "userCancelledUntrustedIframeAutofill");
jest.spyOn(insertAutofillContentService as any, "tabURLChanged");
jest.spyOn(insertAutofillContentService as any, "runFillScriptAction");

insertAutofillContentService.fillForm(fillScript);
Expand All @@ -120,7 +119,6 @@ describe("InsertAutofillContentService", () => {
expect(
insertAutofillContentService["userCancelledUntrustedIframeAutofill"]
).not.toHaveBeenCalled();
expect(insertAutofillContentService["tabURLChanged"]).not.toHaveBeenCalled();
expect(insertAutofillContentService["runFillScriptAction"]).not.toHaveBeenCalled();
});

Expand All @@ -130,7 +128,6 @@ describe("InsertAutofillContentService", () => {
.mockReturnValue(true);
jest.spyOn(insertAutofillContentService as any, "userCancelledInsecureUrlAutofill");
jest.spyOn(insertAutofillContentService as any, "userCancelledUntrustedIframeAutofill");
jest.spyOn(insertAutofillContentService as any, "tabURLChanged");
jest.spyOn(insertAutofillContentService as any, "runFillScriptAction");

insertAutofillContentService.fillForm(fillScript);
Expand All @@ -142,7 +139,6 @@ describe("InsertAutofillContentService", () => {
expect(
insertAutofillContentService["userCancelledUntrustedIframeAutofill"]
).not.toHaveBeenCalled();
expect(insertAutofillContentService["tabURLChanged"]).not.toHaveBeenCalled();
expect(insertAutofillContentService["runFillScriptAction"]).not.toHaveBeenCalled();
});

Expand All @@ -154,7 +150,6 @@ describe("InsertAutofillContentService", () => {
.spyOn(insertAutofillContentService as any, "userCancelledInsecureUrlAutofill")
.mockReturnValue(true);
jest.spyOn(insertAutofillContentService as any, "userCancelledUntrustedIframeAutofill");
jest.spyOn(insertAutofillContentService as any, "tabURLChanged");
jest.spyOn(insertAutofillContentService as any, "runFillScriptAction");

insertAutofillContentService.fillForm(fillScript);
Expand All @@ -164,7 +159,6 @@ describe("InsertAutofillContentService", () => {
expect(
insertAutofillContentService["userCancelledUntrustedIframeAutofill"]
).not.toHaveBeenCalled();
expect(insertAutofillContentService["tabURLChanged"]).not.toHaveBeenCalled();
expect(insertAutofillContentService["runFillScriptAction"]).not.toHaveBeenCalled();
});

Expand All @@ -178,7 +172,6 @@ describe("InsertAutofillContentService", () => {
jest
.spyOn(insertAutofillContentService as any, "userCancelledUntrustedIframeAutofill")
.mockReturnValue(true);
jest.spyOn(insertAutofillContentService as any, "tabURLChanged").mockReturnValue(false);
jest.spyOn(insertAutofillContentService as any, "runFillScriptAction");

insertAutofillContentService.fillForm(fillScript);
Expand All @@ -188,31 +181,6 @@ describe("InsertAutofillContentService", () => {
expect(
insertAutofillContentService["userCancelledUntrustedIframeAutofill"]
).toHaveBeenCalled();
expect(insertAutofillContentService["tabURLChanged"]).not.toHaveBeenCalled();
expect(insertAutofillContentService["runFillScriptAction"]).not.toHaveBeenCalled();
});

it("returns early if the page location origin does not match against any of the cipher saved URLs", () => {
jest
.spyOn(insertAutofillContentService as any, "fillingWithinSandboxedIframe")
.mockReturnValue(false);
jest
.spyOn(insertAutofillContentService as any, "userCancelledInsecureUrlAutofill")
.mockReturnValue(false);
jest
.spyOn(insertAutofillContentService as any, "userCancelledUntrustedIframeAutofill")
.mockReturnValue(false);
jest.spyOn(insertAutofillContentService as any, "tabURLChanged").mockReturnValue(true);
jest.spyOn(insertAutofillContentService as any, "runFillScriptAction");

insertAutofillContentService.fillForm(fillScript);

expect(insertAutofillContentService["fillingWithinSandboxedIframe"]).toHaveBeenCalled();
expect(insertAutofillContentService["userCancelledInsecureUrlAutofill"]).toHaveBeenCalled();
expect(
insertAutofillContentService["userCancelledUntrustedIframeAutofill"]
).toHaveBeenCalled();
expect(insertAutofillContentService["tabURLChanged"]).toHaveBeenCalled();
expect(insertAutofillContentService["runFillScriptAction"]).not.toHaveBeenCalled();
});

Expand All @@ -226,7 +194,6 @@ describe("InsertAutofillContentService", () => {
jest
.spyOn(insertAutofillContentService as any, "userCancelledUntrustedIframeAutofill")
.mockReturnValue(false);
jest.spyOn(insertAutofillContentService as any, "tabURLChanged").mockReturnValue(false);
jest.spyOn(insertAutofillContentService as any, "runFillScriptAction");

insertAutofillContentService.fillForm(fillScript);
Expand All @@ -236,7 +203,6 @@ describe("InsertAutofillContentService", () => {
expect(
insertAutofillContentService["userCancelledUntrustedIframeAutofill"]
).toHaveBeenCalled();
expect(insertAutofillContentService["tabURLChanged"]).toHaveBeenCalled();
expect(insertAutofillContentService["runFillScriptAction"]).toHaveBeenCalledTimes(3);
expect(insertAutofillContentService["runFillScriptAction"]).toHaveBeenNthCalledWith(
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,14 @@ class InsertAutofillContentService implements InsertAutofillContentServiceInterf
!fillScript.script?.length ||
this.fillingWithinSandboxedIframe() ||
this.userCancelledInsecureUrlAutofill(fillScript.savedUrls) ||
this.userCancelledUntrustedIframeAutofill(fillScript) ||
this.tabURLChanged(fillScript.savedUrls)
this.userCancelledUntrustedIframeAutofill(fillScript)
) {
return;
}

fillScript.script.forEach(this.runFillScriptAction);
}

/**
* Determines if the page URL no longer matches one of the cipher's savedURL domains
* @param {string[] | null} savedUrls
* @returns {boolean}
* @private
*/
private tabURLChanged(savedUrls?: AutofillScript["savedUrls"]): boolean {
return savedUrls && !savedUrls.some((url) => url.startsWith(window.location.origin));
}

/**
* Identifies if the execution of this script is happening
* within a sandboxed iframe.
Expand Down
12 changes: 11 additions & 1 deletion apps/browser/src/vault/popup/components/vault/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,21 @@ export class ViewComponent extends BaseViewComponent {
}

private async doAutofill() {
const originalTabURL = this.tab.url?.length && new URL(this.tab.url);

if (!(await this.promptPassword())) {
return false;
}

if (this.pageDetails == null || this.pageDetails.length === 0) {
const currentTabURL = this.tab.url?.length && new URL(this.tab.url);

const originalTabHostPath =
originalTabURL && `${originalTabURL.origin}${originalTabURL.pathname}`;
const currentTabHostPath = currentTabURL && `${currentTabURL.origin}${currentTabURL.pathname}`;

const tabUrlChanged = originalTabHostPath !== currentTabHostPath;

if (this.pageDetails == null || this.pageDetails.length === 0 || tabUrlChanged) {
this.platformUtilsService.showToast("error", null, this.i18nService.t("autofillError"));
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"**/node_modules/@bitwarden/desktop-native/index.js",
"**/node_modules/@bitwarden/desktop-native/desktop_native.${platform}-${arch}*.node"
],
"electronVersion": "26.3.0",
"electronVersion": "25.9.1",
"generateUpdatesFilesForAllChannels": true,
"publish": {
"provider": "generic",
Expand Down
6 changes: 4 additions & 2 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bitwarden/desktop",
"description": "A secure and free password manager for all of your devices.",
"version": "2023.9.2",
"version": "2023.9.3",
"keywords": [
"bitwarden",
"password",
Expand All @@ -19,8 +19,10 @@
"postinstall": "electron-rebuild",
"start": "cross-env ELECTRON_IS_DEV=0 ELECTRON_NO_UPDATER=1 electron ./build",
"build-native": "cd desktop_native && npm run build",
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
"build": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\" \"npm run build:preload\"",
"build:dev": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main:dev\" \"npm run build:renderer:dev\"",
"build:preload": "cross-env NODE_ENV=production webpack --config webpack.preload.js",
"build:preload:watch": "cross-env NODE_ENV=production webpack --config webpack.preload.js --watch",
"build:main": "cross-env NODE_ENV=production webpack --config webpack.main.js",
"build:main:dev": "npm run build-native && cross-env NODE_ENV=development webpack --config webpack.main.js",
"build:main:watch": "npm run build-native && cross-env NODE_ENV=development webpack --config webpack.main.js --watch",
Expand Down
5 changes: 5 additions & 0 deletions apps/desktop/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ concurrently(
command: "npm run build:main:watch",
prefixColor: "yellow",
},
{
name: "Prel",
command: "npm run build:preload:watch",
prefixColor: "magenta",
},
{
name: "Rend",
command: "npm run build:renderer:watch",
Expand Down
3 changes: 1 addition & 2 deletions apps/desktop/src/app/accounts/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { DialogService } from "@bitwarden/components";

import { flagEnabled } from "../../platform/flags";
import { ElectronStateService } from "../../platform/services/electron-state.service.abstraction";
import { isWindowsStore } from "../../utils";
import { SetPinComponent } from "../components/set-pin.component";
@Component({
selector: "app-settings",
Expand Down Expand Up @@ -589,7 +588,7 @@ export class SettingsComponent implements OnInit {

this.form.controls.enableBrowserIntegration.setValue(false);
return;
} else if (isWindowsStore()) {
} else if (ipc.platform.isWindowsStore) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationWindowsStoreDesc" },
Expand Down
3 changes: 1 addition & 2 deletions apps/desktop/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser";
import { Router } from "@angular/router";
import { ipcRenderer } from "electron";
import { IndividualConfig, ToastrService } from "ngx-toastr";
import { firstValueFrom, Subject, takeUntil } from "rxjs";

Expand Down Expand Up @@ -227,7 +226,7 @@ export class AppComponent implements OnInit, OnDestroy {
this.systemService.cancelProcessReload();
break;
case "reloadProcess":
ipcRenderer.send("reload-process");
ipc.platform.reloadProcess();
break;
case "syncStarted":
break;
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { enableProdMode } from "@angular/core";
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";

import { ipc } from "../preload";
import { isDev } from "../utils";

// Temporary polyfill for preload script
(window as any).ipc = ipc;

require("../scss/styles.scss");
require("../scss/tailwind.css");

Expand Down
7 changes: 2 additions & 5 deletions apps/desktop/src/app/services/desktop-theming.service.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { Injectable } from "@angular/core";
import { ipcRenderer } from "electron";

import { ThemingService } from "@bitwarden/angular/services/theming/theming.service";
import { ThemeType } from "@bitwarden/common/enums";

@Injectable()
export class DesktopThemingService extends ThemingService {
protected async getSystemTheme(): Promise<ThemeType> {
return await ipcRenderer.invoke("systemTheme");
return await ipc.platform.getSystemTheme();
}

protected monitorSystemThemeChanges(): void {
ipcRenderer.on("systemThemeUpdated", (_event, theme: ThemeType) =>
this.updateSystemTheme(theme)
);
ipc.platform.onSystemThemeUpdated((theme: ThemeType) => this.updateSystemTheme(theme));
}
}
5 changes: 4 additions & 1 deletion apps/desktop/src/auth/two-factor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ <h1>{{ title }}</h1>
"
>
<div id="duo-frame">
<iframe id="duo_iframe" sandbox="allow-scripts allow-forms allow-same-origin"></iframe>
<iframe
id="duo_iframe"
sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"
></iframe>
</div>
<div class="box last">
<div class="box-content">
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module "forcefocus";
declare const ipc: typeof import("./preload").ipc;
1 change: 1 addition & 0 deletions apps/desktop/src/main/window.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class WindowMain {
backgroundColor: await this.getBackgroundColor(),
alwaysOnTop: this.enableAlwaysOnTop,
webPreferences: {
// preload: path.join(__dirname, "preload.js"),
spellcheck: false,
nodeIntegration: true,
backgroundThrottling: false,
Expand Down
Loading

0 comments on commit f5f9335

Please sign in to comment.