Skip to content

Commit

Permalink
Merge branch 'main' into auth/pm-14949/update-tde-decryption-option-text
Browse files Browse the repository at this point in the history
  • Loading branch information
rr-bw committed Jan 16, 2025
2 parents 9f655de + e815f89 commit 566775a
Show file tree
Hide file tree
Showing 319 changed files with 5,562 additions and 1,200 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
51 changes: 27 additions & 24 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 minor",
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["minor", "patch"]
},
{
"matchManagers": ["github-actions"],
"commitMessagePrefix": "[deps] BRE:"
"matchUpdateTypes": ["minor"]
},
{
"matchManagers": ["cargo"],
Expand Down Expand Up @@ -73,6 +69,29 @@
"commitMessagePrefix": "[deps] Auth:",
"reviewers": ["team:team-auth-dev"]
},
{
"matchPackageNames": [
"@angular-eslint/eslint-plugin-template",
"@angular-eslint/eslint-plugin",
"@angular-eslint/schematics",
"@angular-eslint/template-parser",
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"eslint-config-prettier",
"eslint-import-resolver-typescript",
"eslint-plugin-import",
"eslint-plugin-rxjs-angular",
"eslint-plugin-rxjs",
"eslint-plugin-storybook",
"eslint-plugin-tailwindcss",
"eslint",
"husky",
"lint-staged"
],
"description": "Architecture owned dependencies",
"commitMessagePrefix": "[deps] Architecture:",
"reviewers": ["team:dept-architecture"]
},
{
"matchPackageNames": [
"@emotion/css",
Expand All @@ -86,6 +105,7 @@
"prettier",
"prettier-plugin-tailwindcss",
"rimraf",
"@storybook/web-components-webpack5",
"tabbable",
"tldts",
"wait-on"
Expand Down Expand Up @@ -193,28 +213,11 @@
},
{
"matchPackageNames": [
"@angular-eslint/eslint-plugin",
"@angular-eslint/eslint-plugin-template",
"@angular-eslint/schematics",
"@angular-eslint/template-parser",
"@angular/elements",
"@types/jest",
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"eslint",
"eslint-config-prettier",
"eslint-import-resolver-typescript",
"eslint-plugin-import",
"eslint-plugin-rxjs",
"eslint-plugin-rxjs-angular",
"eslint-plugin-storybook",
"eslint-plugin-tailwindcss",
"husky",
"jest-extended",
"jest-junit",
"jest-mock-extended",
"jest-preset-angular",
"lint-staged",
"jest-diff",
"ts-jest"
],
"description": "Secrets Manager owned dependencies",
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Scan with SonarCloud
uses: sonarsource/sonarcloud-github-action@02ef91109b2d589e757aefcfb2854c2783fd7b19 # v4.0.0
uses: sonarsource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: >
-Dsonar.organization=${{ github.repository_owner }}
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 @@ -507,7 +514,18 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {

const biometricsPromise = async () => {
try {
const result = await this.biometricsService.authenticateWithBiometrics();
const userId = await firstValueFrom(
this.accountService.activeAccount$.pipe(map((a) => a.id)),
);
let result = false;
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;
}

// prevent duplicate dialog
biometricsResponseReceived = true;
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
@@ -0,0 +1,67 @@
import { dirname, join } from "path";
import path from "path";
import type { StorybookConfig } from "@storybook/web-components-webpack5";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import remarkGfm from "remark-gfm";

const getAbsolutePath = (value: string): string =>
dirname(require.resolve(join(value, "package.json")));

const config: StorybookConfig = {
stories: ["../lit-stories/**/*.lit-stories.@(js|jsx|ts|tsx)"],
addons: [
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-a11y"),
getAbsolutePath("@storybook/addon-designs"),
getAbsolutePath("@storybook/addon-interactions"),
{
name: "@storybook/addon-docs",
options: {
mdxPluginOptions: {
mdxCompileOptions: {
remarkPlugins: [remarkGfm],
},
},
},
},
],
framework: {
name: getAbsolutePath("@storybook/web-components-webpack5"),
options: {
legacyRootApi: true,
},
},
core: {
disableTelemetry: true,
},
env: (existingConfig) => ({
...existingConfig,
FLAGS: JSON.stringify({}),
}),
webpackFinal: async (config) => {
if (config.resolve) {
config.resolve.plugins = [
new TsconfigPathsPlugin({
configFile: path.resolve(__dirname, "../../../../../tsconfig.json"),
}),
] as any;
}

if (config.module && config.module.rules) {
config.module.rules.push({
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve("ts-loader"),
},
],
});
}
return config;
},
docs: {},
};

export default config;
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
@@ -0,0 +1,34 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

import { ActionButton } from "../../buttons/action-button";

type Args = {
buttonText: string;
disabled: boolean;
theme: Theme;
buttonAction: (e: Event) => void;
};

export default {
title: "Components/Buttons/Action Button",
argTypes: {
buttonText: { control: "text" },
disabled: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
buttonAction: { control: false },
},
args: {
buttonText: "Click Me",
disabled: false,
theme: ThemeTypes.Light,
buttonAction: () => alert("Clicked"),
},
} as Meta<Args>;

const Template = (args: Args) => ActionButton({ ...args });

export const Default: StoryObj<Args> = {
render: Template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Meta, StoryObj } from "@storybook/web-components";

import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.enum";

import { BadgeButton } from "../../buttons/badge-button";

type Args = {
buttonAction: (e: Event) => void;
buttonText: string;
disabled?: boolean;
theme: Theme;
};

export default {
title: "Components/Buttons/Badge Button",
argTypes: {
buttonText: { control: "text" },
disabled: { control: "boolean" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
buttonAction: { control: false },
},
args: {
buttonText: "Click Me",
disabled: false,
theme: ThemeTypes.Light,
buttonAction: () => alert("Clicked"),
},
} as Meta<Args>;

const Template = (args: Args) => BadgeButton({ ...args });

export const Default: StoryObj<Args> = {
render: Template,
};
Loading

0 comments on commit 566775a

Please sign in to comment.