Skip to content

Commit

Permalink
Merge branch 'main' into tools/PM-15070/start-critical-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
voommen-livefront committed Jan 15, 2025
2 parents 69f0960 + 334dd4c commit 426477c
Show file tree
Hide file tree
Showing 188 changed files with 2,582 additions and 453 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
"@typescript-eslint/no-this-alias": ["error", { "allowedNames": ["self"] }],
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"no-console": "error",
"import/no-unresolved": "off", // TODO: Look into turning off once each package is an actual package.
Expand Down
10 changes: 3 additions & 7 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
"enabledManagers": ["cargo", "github-actions", "npm"],
"packageRules": [
{
"groupName": "gh minor",
"groupName": "github action dependencies",
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["minor", "patch"]
},
{
"matchManagers": ["github-actions"],
"commitMessagePrefix": "[deps] BRE:"
"matchUpdateTypes": ["minor"]
},
{
"matchManagers": ["cargo"],
Expand Down Expand Up @@ -210,10 +206,10 @@
"eslint-plugin-storybook",
"eslint-plugin-tailwindcss",
"husky",
"jest-extended",
"jest-junit",
"jest-mock-extended",
"jest-preset-angular",
"jest-diff",
"lint-staged",
"ts-jest"
],
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-undef */
/* eslint-disable no-undef, @typescript-eslint/no-require-imports */
module.exports = {
plugins: [require("tailwindcss"), require("autoprefixer"), require("postcss-nested")],
};
9 changes: 3 additions & 6 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4007,6 +4007,9 @@
"passkeyRemoved": {
"message": "Passkey removed"
},
"autofillSuggestions": {
"message": "Autofill suggestions"
},
"itemSuggestions": {
"message": "Suggested items"
},
Expand Down Expand Up @@ -4586,12 +4589,6 @@
"textSends": {
"message": "Text Sends"
},
"bitwardenNewLook": {
"message": "Bitwarden has a new look!"
},
"bitwardenNewLookDesc": {
"message": "It's easier and more intuitive than ever to autofill and search from the Vault tab. Take a look around!"
},
"accountActions": {
"message": "Account actions"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2 bitTypography="h6">{{ "unlockMethods" | i18n }}</h2>
{{ biometricUnavailabilityReason }}
</bit-hint>
</bit-form-control>
<bit-form-control class="tw-pl-5" *ngIf="this.form.value.biometric">
<bit-form-control class="tw-pl-5" *ngIf="this.form.value.biometric && showAutoPrompt">
<input
bitCheckbox
id="autoBiometricsPrompt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
import { DeviceType } from "@bitwarden/common/enums";
import { VaultTimeoutAction } from "@bitwarden/common/enums/vault-timeout-action.enum";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
Expand Down Expand Up @@ -106,6 +107,7 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
hasVaultTimeoutPolicy = false;
biometricUnavailabilityReason: string;
showChangeMasterPass = true;
showAutoPrompt = true;

form = this.formBuilder.group({
vaultTimeout: [null as VaultTimeout | null],
Expand Down Expand Up @@ -141,6 +143,11 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
) {}

async ngOnInit() {
// Firefox popup closes when unfocused by biometrics, blocking all unlock methods
if (this.platformUtilsService.getDevice() === DeviceType.FirefoxExtension) {
this.showAutoPrompt = false;
}

const hasMasterPassword = await this.userVerificationService.hasMasterPassword();
this.showMasterPasswordOnClientRestartOption = hasMasterPassword;
const maximumVaultTimeoutPolicy = this.policyService.get$(PolicyType.MaximumVaultTimeout);
Expand Down Expand Up @@ -514,6 +521,8 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
try {
const userKey = await this.biometricsService.unlockWithBiometricsForUser(userId);
result = await this.keyService.validateUserKey(userKey, userId);
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
result = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,16 @@ describe("AutoSubmitLoginBackground", () => {

sendMockExtensionMessage({ command: "triggerAutoSubmitLogin" }, sender);

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
expect(autofillService.doAutoFillOnTab).not.toHaveBeenCalled;
});

it("skips acting on messages whose command does not have a registered handler", () => {
sendMockExtensionMessage({ command: "someInvalidCommand" }, sender);

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
expect(autofillService.doAutoFillOnTab).not.toHaveBeenCalled;
});

Expand Down
2 changes: 2 additions & 0 deletions apps/browser/src/autofill/content/auto-submit-login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ describe("AutoSubmitLogin content script", () => {
beforeEach(() => {
jest.useFakeTimers();
setupEnvironmentDefaults();
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./auto-submit-login");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export function EditButton({
title=${buttonText}
class=${editButtonStyles({ disabled, theme })}
@click=${(event: Event) => {
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
!disabled && buttonAction(event);
}}
>
Expand Down
4 changes: 4 additions & 0 deletions apps/browser/src/autofill/content/components/cipher/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const CipherTypes = {
Login: 1,
SecureNote: 2,
Expand All @@ -7,6 +9,8 @@ const CipherTypes = {

type CipherType = (typeof CipherTypes)[keyof typeof CipherTypes];

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const CipherRepromptTypes = {
None: 0,
Password: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ describe("ContentMessageHandler", () => {
);

beforeEach(() => {
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./content-message-handler");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ describe("TriggerAutofillScriptInjection", () => {

describe("init", () => {
it("sends a message to the extension background", () => {
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("../content/trigger-autofill-script-injection");

expect(chrome.runtime.sendMessage).toHaveBeenCalledWith({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { AutofillOverlayElement } from "../../../../enums/autofill-overlay.enum"

import AutofillOverlayButton from "./autofill-overlay-button.deprecated";

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./legacy-button.scss");

(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { AutofillOverlayElement } from "../../../../enums/autofill-overlay.enum"

import AutofillOverlayList from "./autofill-overlay-list.deprecated";

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./legacy-list.scss");

(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe("Fido2 Content Script", () => {
chrome.runtime.connect = jest.fn(() => portSpy);

it("destroys the messenger when the port is disconnected", () => {
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

triggerPortOnDisconnectEvent(portSpy);
Expand All @@ -75,6 +77,8 @@ describe("Fido2 Content Script", () => {
const mockResult = { credentialId: "mock" } as CreateCredentialResult;
jest.spyOn(chrome.runtime, "sendMessage").mockResolvedValue(mockResult);

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

const response = await messenger.handler!(message, new AbortController());
Expand All @@ -99,6 +103,8 @@ describe("Fido2 Content Script", () => {
data: mock<InsecureCreateCredentialParams>(),
});

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

await messenger.handler!(message, new AbortController());
Expand All @@ -121,6 +127,8 @@ describe("Fido2 Content Script", () => {
const abortController = new AbortController();
const abortSpy = jest.spyOn(abortController.signal, "removeEventListener");

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

await messenger.handler!(message, abortController);
Expand All @@ -141,6 +149,8 @@ describe("Fido2 Content Script", () => {
abortController.abort();
});

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

await messenger.handler!(message, abortController);
Expand All @@ -161,6 +171,8 @@ describe("Fido2 Content Script", () => {
const abortController = new AbortController();
jest.spyOn(chrome.runtime, "sendMessage").mockResolvedValue({ error: errorMessage });

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");
const result = messenger.handler!(message, abortController);

Expand All @@ -175,6 +187,8 @@ describe("Fido2 Content Script", () => {
contentType: "application/json",
}));

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

expect(messengerForDOMCommunicationSpy).not.toHaveBeenCalled();
Expand All @@ -193,6 +207,8 @@ describe("Fido2 Content Script", () => {
},
}));

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

expect(messengerForDOMCommunicationSpy).not.toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe("FIDO2 page-script for manifest v2", () => {
it("skips appending the `page-script.js` file if the document contentType is not `text/html`", () => {
Object.defineProperty(window.document, "contentType", { value: "text/plain", writable: true });

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-page-script-append.mv2");

expect(window.document.createElement).not.toHaveBeenCalled();
Expand All @@ -33,6 +35,8 @@ describe("FIDO2 page-script for manifest v2", () => {
return node;
});

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-page-script-append.mv2");

expect(window.document.createElement).toHaveBeenCalledWith("script");
Expand All @@ -48,6 +52,8 @@ describe("FIDO2 page-script for manifest v2", () => {
return node;
});

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-page-script-append.mv2");

expect(window.document.createElement).toHaveBeenCalledWith("script");
Expand Down
2 changes: 2 additions & 0 deletions apps/browser/src/autofill/fido2/content/fido2-page-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ import { Messenger } from "./messaging/messenger";

clearWaitForFocus();
void messenger.destroy();
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
/** empty */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ describe("Fido2 page script with native WebAuthn support", () => {
setupMockedWebAuthnSupport();

beforeAll(() => {
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-page-script");
});

Expand Down Expand Up @@ -166,6 +168,8 @@ describe("Fido2 page script with native WebAuthn support", () => {
contentType: "json/application",
}));

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

expect(Messenger.forDOMCommunication).not.toHaveBeenCalled();
Expand All @@ -184,6 +188,8 @@ describe("Fido2 page script with native WebAuthn support", () => {
},
}));

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-content-script");

expect(Messenger.forDOMCommunication).not.toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ describe("Fido2 page script without native WebAuthn support", () => {
const mockCreateCredentialsResult = createCreateCredentialResultMock();
const mockCredentialRequestOptions = createCredentialRequestOptionsMock();
const mockCredentialAssertResult = createAssertCredentialResultMock();
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./fido2-page-script");

afterEach(() => {
Expand Down
2 changes: 2 additions & 0 deletions apps/browser/src/autofill/notification/bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
NotificationBarIframeInitData,
} from "./abstractions/notification-bar";

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./bar.scss");

const logService = new ConsoleLogService(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { AutofillOverlayElement } from "../../../../enums/autofill-overlay.enum"

import { AutofillInlineMenuButton } from "./autofill-inline-menu-button";

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./button.scss");

(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { AutofillOverlayElement } from "../../../../enums/autofill-overlay.enum"

import { AutofillInlineMenuList } from "./autofill-inline-menu-list";

// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./list.scss");

(function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./menu-container.scss");

import { AutofillInlineMenuContainer } from "./autofill-inline-menu-container";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,8 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
url.origin + pathWithoutTrailingSlashAndSearch,
url.origin + pathWithoutTrailingSlashSearchAndHash,
]);
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_error) {
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions apps/browser/src/autofill/services/dom-query.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ export class DomQueryService implements DomQueryServiceInterface {
if ((chrome as any).dom?.openOrClosedShadowRoot) {
try {
return (chrome as any).dom.openOrClosedShadowRoot(node);
// FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
return null;
}
Expand Down
1 change: 1 addition & 0 deletions apps/browser/src/background/main.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ export default class MainBackground {
this.logService,
this.keyService,
this.biometricStateService,
this.messagingService,
);

this.appIdService = new AppIdService(this.storageService, this.logService);
Expand Down
Loading

0 comments on commit 426477c

Please sign in to comment.