mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-22629] Forbid importing popup outside (#15168)
Adds an eslint rule forbidding non popup scripts from importing popups. Also added a webpack plugin that throws if it detects @angular inside background output.
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
|||||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||||
|
|
||||||
import { BrowserRouterService } from "../../platform/popup/services/browser-router.service";
|
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This guard verifies the user's authentication status.
|
* This guard verifies the user's authentication status.
|
||||||
@@ -22,7 +22,11 @@ import { DuoLaunchAction } from "@bitwarden/auth/angular";
|
|||||||
import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type";
|
import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type";
|
||||||
|
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
import { BrowserApi } from "../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
AuthPopoutType,
|
AuthPopoutType,
|
||||||
closeSsoAuthResultPopout,
|
closeSsoAuthResultPopout,
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ import {
|
|||||||
import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type";
|
import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type";
|
||||||
|
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
import { BrowserApi } from "../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
AuthPopoutType,
|
AuthPopoutType,
|
||||||
closeSsoAuthResultPopout,
|
closeSsoAuthResultPopout,
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { EnvironmentService } from "@bitwarden/common/platform/abstractions/envi
|
|||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openTwoFactorAuthDuoPopout } from "../../auth/popup/utils/auth-popout-window";
|
import { openTwoFactorAuthDuoPopout } from "../../auth/popup/utils/auth-popout-window";
|
||||||
import { ZonedMessageListenerService } from "../../platform/browser/zoned-message-listener.service";
|
import { ZonedMessageListenerService } from "../../platform/browser/zoned-message-listener.service";
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ jest.mock("../../platform/popup/browser-popup-utils", () => ({
|
|||||||
inPopup: jest.fn(),
|
inPopup: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openTwoFactorAuthEmailPopout } from "../../auth/popup/utils/auth-popout-window";
|
import { openTwoFactorAuthEmailPopout } from "../../auth/popup/utils/auth-popout-window";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
||||||
|
|
||||||
import { ExtensionTwoFactorAuthEmailComponentService } from "./extension-two-factor-auth-email-component.service";
|
import { ExtensionTwoFactorAuthEmailComponentService } from "./extension-two-factor-auth-email-component.service";
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService } from "@bitwarden/components";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openTwoFactorAuthEmailPopout } from "../../auth/popup/utils/auth-popout-window";
|
import { openTwoFactorAuthEmailPopout } from "../../auth/popup/utils/auth-popout-window";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
|
||||||
|
|
||||||
// TODO: popup state persistence should eventually remove the need for this service
|
// TODO: popup state persistence should eventually remove the need for this service
|
||||||
|
|||||||
@@ -44,8 +44,12 @@ import { TaskService } from "@bitwarden/common/vault/tasks";
|
|||||||
import { SecurityTaskType } from "@bitwarden/common/vault/tasks/enums";
|
import { SecurityTaskType } from "@bitwarden/common/vault/tasks/enums";
|
||||||
import { SecurityTask } from "@bitwarden/common/vault/tasks/models/security-task";
|
import { SecurityTask } from "@bitwarden/common/vault/tasks/models/security-task";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
|
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
import { BrowserApi } from "../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
openAddEditVaultItemPopout,
|
openAddEditVaultItemPopout,
|
||||||
openViewVaultItemPopout,
|
openViewVaultItemPopout,
|
||||||
|
|||||||
@@ -49,8 +49,12 @@ import { IdentityView } from "@bitwarden/common/vault/models/view/identity.view"
|
|||||||
import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view";
|
import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view";
|
||||||
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
|
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
|
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
import { BrowserApi } from "../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
openAddEditVaultItemPopout,
|
openAddEditVaultItemPopout,
|
||||||
openViewVaultItemPopout,
|
openViewVaultItemPopout,
|
||||||
|
|||||||
@@ -30,8 +30,12 @@ import { CipherType } from "@bitwarden/common/vault/enums";
|
|||||||
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
|
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
|
||||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
|
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
import { BrowserApi } from "../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
openAddEditVaultItemPopout,
|
openAddEditVaultItemPopout,
|
||||||
openVaultItemPasswordRepromptPopout,
|
openVaultItemPasswordRepromptPopout,
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import {
|
|||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
|
|
||||||
import { BrowserApi } from "../../../platform/browser/browser-api";
|
import { BrowserApi } from "../../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { closeFido2Popout, openFido2Popout } from "../../../vault/popup/utils/vault-popout-window";
|
import { closeFido2Popout, openFido2Popout } from "../../../vault/popup/utils/vault-popout-window";
|
||||||
|
|
||||||
const BrowserFido2MessageName = "BrowserFido2UserInterfaceServiceMessage";
|
const BrowserFido2MessageName = "BrowserFido2UserInterfaceServiceMessage";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { BehaviorSubject, Observable } from "rxjs";
|
import { BehaviorSubject, Observable } from "rxjs";
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ import { IdentityView } from "@bitwarden/common/vault/models/view/identity.view"
|
|||||||
|
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
import { BrowserApi } from "../../platform/browser/browser-api";
|
||||||
import { ScriptInjectorService } from "../../platform/services/abstractions/script-injector.service";
|
import { ScriptInjectorService } from "../../platform/services/abstractions/script-injector.service";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openVaultItemPasswordRepromptPopout } from "../../vault/popup/utils/vault-popout-window";
|
import { openVaultItemPasswordRepromptPopout } from "../../vault/popup/utils/vault-popout-window";
|
||||||
import { AutofillMessageCommand, AutofillMessageSender } from "../enums/autofill-message.enums";
|
import { AutofillMessageCommand, AutofillMessageSender } from "../enums/autofill-message.enums";
|
||||||
import { AutofillPort } from "../enums/autofill-port.enum";
|
import { AutofillPort } from "../enums/autofill-port.enum";
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { ExtensionCommand, ExtensionCommandType } from "@bitwarden/common/autofi
|
|||||||
import { VaultTimeoutService } from "@bitwarden/common/key-management/vault-timeout";
|
import { VaultTimeoutService } from "@bitwarden/common/key-management/vault-timeout";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { openUnlockPopout } from "../auth/popup/utils/auth-popout-window";
|
import { openUnlockPopout } from "../auth/popup/utils/auth-popout-window";
|
||||||
import { LockedVaultPendingNotificationsData } from "../autofill/background/abstractions/notification.background";
|
import { LockedVaultPendingNotificationsData } from "../autofill/background/abstractions/notification.background";
|
||||||
import { BrowserApi } from "../platform/browser/browser-api";
|
import { BrowserApi } from "../platform/browser/browser-api";
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import { CipherType } from "@bitwarden/common/vault/enums";
|
|||||||
import { VaultMessages } from "@bitwarden/common/vault/enums/vault-messages.enum";
|
import { VaultMessages } from "@bitwarden/common/vault/enums/vault-messages.enum";
|
||||||
import { BiometricsCommands } from "@bitwarden/key-management";
|
import { BiometricsCommands } from "@bitwarden/key-management";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
closeUnlockPopout,
|
closeUnlockPopout,
|
||||||
openSsoAuthResultPopout,
|
openSsoAuthResultPopout,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { TestBed } from "@angular/core/testing";
|
import { TestBed } from "@angular/core/testing";
|
||||||
import { mock, MockProxy } from "jest-mock-extended";
|
import { mock, MockProxy } from "jest-mock-extended";
|
||||||
import { firstValueFrom, of } from "rxjs";
|
import { firstValueFrom, of } from "rxjs";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { map, Observable, of, switchMap } from "rxjs";
|
import { map, Observable, of, switchMap } from "rxjs";
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
import { VaultTimeoutSettingsService } from "@bitwarden/common/key-management/vault-timeout";
|
import { VaultTimeoutSettingsService } from "@bitwarden/common/key-management/vault-timeout";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
import { RemovePasswordComponent as BaseRemovePasswordComponent } from "@bitwarden/key-management-ui";
|
import { RemovePasswordComponent as BaseRemovePasswordComponent } from "@bitwarden/key-management-ui";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { TestBed } from "@angular/core/testing";
|
import { TestBed } from "@angular/core/testing";
|
||||||
import { mock, MockProxy } from "jest-mock-extended";
|
import { mock, MockProxy } from "jest-mock-extended";
|
||||||
import { firstValueFrom, of } from "rxjs";
|
import { firstValueFrom, of } from "rxjs";
|
||||||
@@ -18,7 +20,11 @@ import {
|
|||||||
import { UnlockOptions } from "@bitwarden/key-management-ui";
|
import { UnlockOptions } from "@bitwarden/key-management-ui";
|
||||||
|
|
||||||
import { BrowserApi } from "../../../platform/browser/browser-api";
|
import { BrowserApi } from "../../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
||||||
|
|
||||||
import { ExtensionLockComponentService } from "./extension-lock-component.service";
|
import { ExtensionLockComponentService } from "./extension-lock-component.service";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { inject } from "@angular/core";
|
import { inject } from "@angular/core";
|
||||||
import { combineLatest, defer, firstValueFrom, map, Observable } from "rxjs";
|
import { combineLatest, defer, firstValueFrom, map, Observable } from "rxjs";
|
||||||
|
|
||||||
@@ -15,7 +17,11 @@ import { LockComponentService, UnlockOptions } from "@bitwarden/key-management-u
|
|||||||
|
|
||||||
import { BiometricErrors, BiometricErrorTypes } from "../../../models/biometricErrors";
|
import { BiometricErrors, BiometricErrorTypes } from "../../../models/biometricErrors";
|
||||||
import { BrowserApi } from "../../../platform/browser/browser-api";
|
import { BrowserApi } from "../../../platform/browser/browser-api";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
||||||
|
|
||||||
export class ExtensionLockComponentService implements LockComponentService {
|
export class ExtensionLockComponentService implements LockComponentService {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { NgZone } from "@angular/core";
|
import { NgZone } from "@angular/core";
|
||||||
import { MonoTypeOperatorFunction, Observable } from "rxjs";
|
import { MonoTypeOperatorFunction, Observable } from "rxjs";
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIXME (PM-22628): angular imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Injectable, NgZone } from "@angular/core";
|
import { Injectable, NgZone } from "@angular/core";
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
|||||||
@@ -43,12 +43,12 @@ import {
|
|||||||
} from "@bitwarden/auth/angular";
|
} from "@bitwarden/auth/angular";
|
||||||
import { LockComponent } from "@bitwarden/key-management-ui";
|
import { LockComponent } from "@bitwarden/key-management-ui";
|
||||||
|
|
||||||
import { fido2AuthGuard } from "../auth/guards/fido2-auth.guard";
|
|
||||||
import { AccountSwitcherComponent } from "../auth/popup/account-switching/account-switcher.component";
|
import { AccountSwitcherComponent } from "../auth/popup/account-switching/account-switcher.component";
|
||||||
import {
|
import {
|
||||||
ExtensionAnonLayoutWrapperComponent,
|
ExtensionAnonLayoutWrapperComponent,
|
||||||
ExtensionAnonLayoutWrapperData,
|
ExtensionAnonLayoutWrapperData,
|
||||||
} from "../auth/popup/extension-anon-layout-wrapper/extension-anon-layout-wrapper.component";
|
} from "../auth/popup/extension-anon-layout-wrapper/extension-anon-layout-wrapper.component";
|
||||||
|
import { fido2AuthGuard } from "../auth/popup/guards/fido2-auth.guard";
|
||||||
import { SetPasswordComponent } from "../auth/popup/set-password.component";
|
import { SetPasswordComponent } from "../auth/popup/set-password.component";
|
||||||
import { AccountSecurityComponent } from "../auth/popup/settings/account-security.component";
|
import { AccountSecurityComponent } from "../auth/popup/settings/account-security.component";
|
||||||
import { UpdateTempPasswordComponent } from "../auth/popup/update-temp-password.component";
|
import { UpdateTempPasswordComponent } from "../auth/popup/update-temp-password.component";
|
||||||
@@ -70,9 +70,6 @@ import { AboutPageV2Component } from "../tools/popup/settings/about-page/about-p
|
|||||||
import { ExportBrowserV2Component } from "../tools/popup/settings/export/export-browser-v2.component";
|
import { ExportBrowserV2Component } from "../tools/popup/settings/export/export-browser-v2.component";
|
||||||
import { ImportBrowserV2Component } from "../tools/popup/settings/import/import-browser-v2.component";
|
import { ImportBrowserV2Component } from "../tools/popup/settings/import/import-browser-v2.component";
|
||||||
import { SettingsV2Component } from "../tools/popup/settings/settings-v2.component";
|
import { SettingsV2Component } from "../tools/popup/settings/settings-v2.component";
|
||||||
import { canAccessAtRiskPasswords } from "../vault/guards/at-risk-passwords.guard";
|
|
||||||
import { clearVaultStateGuard } from "../vault/guards/clear-vault-state.guard";
|
|
||||||
import { IntroCarouselGuard } from "../vault/guards/intro-carousel.guard";
|
|
||||||
import { AtRiskPasswordsComponent } from "../vault/popup/components/at-risk-passwords/at-risk-passwords.component";
|
import { AtRiskPasswordsComponent } from "../vault/popup/components/at-risk-passwords/at-risk-passwords.component";
|
||||||
import { AddEditV2Component } from "../vault/popup/components/vault-v2/add-edit/add-edit-v2.component";
|
import { AddEditV2Component } from "../vault/popup/components/vault-v2/add-edit/add-edit-v2.component";
|
||||||
import { AssignCollections } from "../vault/popup/components/vault-v2/assign-collections/assign-collections.component";
|
import { AssignCollections } from "../vault/popup/components/vault-v2/assign-collections/assign-collections.component";
|
||||||
@@ -81,6 +78,9 @@ import { IntroCarouselComponent } from "../vault/popup/components/vault-v2/intro
|
|||||||
import { PasswordHistoryV2Component } from "../vault/popup/components/vault-v2/vault-password-history-v2/vault-password-history-v2.component";
|
import { PasswordHistoryV2Component } from "../vault/popup/components/vault-v2/vault-password-history-v2/vault-password-history-v2.component";
|
||||||
import { VaultV2Component } from "../vault/popup/components/vault-v2/vault-v2.component";
|
import { VaultV2Component } from "../vault/popup/components/vault-v2/vault-v2.component";
|
||||||
import { ViewV2Component } from "../vault/popup/components/vault-v2/view-v2/view-v2.component";
|
import { ViewV2Component } from "../vault/popup/components/vault-v2/view-v2/view-v2.component";
|
||||||
|
import { canAccessAtRiskPasswords } from "../vault/popup/guards/at-risk-passwords.guard";
|
||||||
|
import { clearVaultStateGuard } from "../vault/popup/guards/clear-vault-state.guard";
|
||||||
|
import { IntroCarouselGuard } from "../vault/popup/guards/intro-carousel.guard";
|
||||||
import { AppearanceV2Component } from "../vault/popup/settings/appearance-v2.component";
|
import { AppearanceV2Component } from "../vault/popup/settings/appearance-v2.component";
|
||||||
import { DownloadBitwardenComponent } from "../vault/popup/settings/download-bitwarden.component";
|
import { DownloadBitwardenComponent } from "../vault/popup/settings/download-bitwarden.component";
|
||||||
import { FoldersV2Component } from "../vault/popup/settings/folders-v2.component";
|
import { FoldersV2Component } from "../vault/popup/settings/folders-v2.component";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { inject } from "@angular/core";
|
import { inject } from "@angular/core";
|
||||||
import { CanDeactivateFn } from "@angular/router";
|
import { CanDeactivateFn } from "@angular/router";
|
||||||
|
|
||||||
import { VaultV2Component } from "../popup/components/vault-v2/vault-v2.component";
|
import { VaultV2Component } from "../components/vault-v2/vault-v2.component";
|
||||||
import { VaultPopupItemsService } from "../popup/services/vault-popup-items.service";
|
import { VaultPopupItemsService } from "../services/vault-popup-items.service";
|
||||||
import { VaultPopupListFiltersService } from "../popup/services/vault-popup-list-filters.service";
|
import { VaultPopupListFiltersService } from "../services/vault-popup-list-filters.service";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guard to clear the vault state (search and filter) when navigating away from the vault view.
|
* Guard to clear the vault state (search and filter) when navigating away from the vault view.
|
||||||
@@ -5,7 +5,7 @@ import { of } from "rxjs";
|
|||||||
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
|
|
||||||
import { IntroCarouselService } from "../popup/services/intro-carousel.service";
|
import { IntroCarouselService } from "../services/intro-carousel.service";
|
||||||
|
|
||||||
import { IntroCarouselGuard } from "./intro-carousel.guard";
|
import { IntroCarouselGuard } from "./intro-carousel.guard";
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ import { firstValueFrom } from "rxjs";
|
|||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
|
|
||||||
import { IntroCarouselService } from "../popup/services/intro-carousel.service";
|
import { IntroCarouselService } from "../services/intro-carousel.service";
|
||||||
|
|
||||||
export const IntroCarouselGuard = async () => {
|
export const IntroCarouselGuard = async () => {
|
||||||
const router = inject(Router);
|
const router = inject(Router);
|
||||||
@@ -8,6 +8,8 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
|||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService } from "@bitwarden/components";
|
||||||
import { PasswordRepromptService } from "@bitwarden/vault";
|
import { PasswordRepromptService } from "@bitwarden/vault";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { SetPinComponent } from "./../../auth/popup/components/set-pin.component";
|
import { SetPinComponent } from "./../../auth/popup/components/set-pin.component";
|
||||||
import { Fido2UserVerificationService } from "./fido2-user-verification.service";
|
import { Fido2UserVerificationService } from "./fido2-user-verification.service";
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
|||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService } from "@bitwarden/components";
|
||||||
import { PasswordRepromptService } from "@bitwarden/vault";
|
import { PasswordRepromptService } from "@bitwarden/vault";
|
||||||
|
|
||||||
|
// FIXME (PM-22628): Popup imports are forbidden in background
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { SetPinComponent } from "../../auth/popup/components/set-pin.component";
|
import { SetPinComponent } from "../../auth/popup/components/set-pin.component";
|
||||||
|
|
||||||
export class Fido2UserVerificationService {
|
export class Fido2UserVerificationService {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const TerserPlugin = require("terser-webpack-plugin");
|
|||||||
const { TsconfigPathsPlugin } = require("tsconfig-paths-webpack-plugin");
|
const { TsconfigPathsPlugin } = require("tsconfig-paths-webpack-plugin");
|
||||||
const configurator = require("./config/config");
|
const configurator = require("./config/config");
|
||||||
const manifest = require("./webpack/manifest");
|
const manifest = require("./webpack/manifest");
|
||||||
|
const AngularCheckPlugin = require("./webpack/angular-check");
|
||||||
|
|
||||||
if (process.env.NODE_ENV == null) {
|
if (process.env.NODE_ENV == null) {
|
||||||
process.env.NODE_ENV = "development";
|
process.env.NODE_ENV = "development";
|
||||||
@@ -404,7 +405,7 @@ if (manifestVersion == 2) {
|
|||||||
cache: true,
|
cache: true,
|
||||||
},
|
},
|
||||||
dependencies: ["main"],
|
dependencies: ["main"],
|
||||||
plugins: [...requiredPlugins],
|
plugins: [...requiredPlugins /*new AngularCheckPlugin()*/], // TODO (PM-22630): Re-enable this plugin when angular is removed from the background script.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Safari's desktop build process requires a background.html and vendor.js file to exist
|
// Safari's desktop build process requires a background.html and vendor.js file to exist
|
||||||
|
|||||||
21
apps/browser/webpack/angular-check.js
vendored
Normal file
21
apps/browser/webpack/angular-check.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Webpack plugin that errors if it detects angular imports.
|
||||||
|
*/
|
||||||
|
class AngularCheckPlugin {
|
||||||
|
apply(compiler) {
|
||||||
|
compiler.hooks.assetEmitted.tap("AngularCheckPlugin", (file, info) => {
|
||||||
|
// Ensure we only check outputted JavaScript files
|
||||||
|
if (!file.endsWith(".js")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.content.includes("@angular")) {
|
||||||
|
throw new Error(
|
||||||
|
`Angular detected in ${file}. Please ensure angular is not imported to non popup scripts.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = AngularCheckPlugin;
|
||||||
@@ -279,6 +279,31 @@ export default tseslint.config(
|
|||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Browser background and content scripts are not allowed to import from the popup directory
|
||||||
|
{
|
||||||
|
files: ["apps/browser/src/**/*.ts"],
|
||||||
|
rules: {
|
||||||
|
"no-restricted-imports": buildNoRestrictedImports([
|
||||||
|
"@angular",
|
||||||
|
"bitwarden_license/**",
|
||||||
|
"@bitwarden/bit-common/*",
|
||||||
|
"@bitwarden/bit-web/*",
|
||||||
|
|
||||||
|
"**/popup/*",
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// This removes the previous rule forbidding imports from the popup directory
|
||||||
|
{
|
||||||
|
files: ["apps/browser/src/**/popup/**/*.ts"],
|
||||||
|
rules: {
|
||||||
|
"no-restricted-imports": buildNoRestrictedImports([
|
||||||
|
"bitwarden_license/**",
|
||||||
|
"@bitwarden/bit-common/*",
|
||||||
|
"@bitwarden/bit-web/*",
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
files: ["libs/nx-plugin/**/*.ts", "libs/nx-plugin/**/*.js"],
|
files: ["libs/nx-plugin/**/*.ts", "libs/nx-plugin/**/*.js"],
|
||||||
rules: {
|
rules: {
|
||||||
|
|||||||
Reference in New Issue
Block a user