mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
remove BlockBrowserInjectionsByDomain feature flag (#16008)
This commit is contained in:
@@ -156,7 +156,7 @@ describe("OverlayBackground", () => {
|
|||||||
fakeStateProvider = new FakeStateProvider(accountService);
|
fakeStateProvider = new FakeStateProvider(accountService);
|
||||||
showFaviconsMock$ = new BehaviorSubject(true);
|
showFaviconsMock$ = new BehaviorSubject(true);
|
||||||
neverDomainsMock$ = new BehaviorSubject({});
|
neverDomainsMock$ = new BehaviorSubject({});
|
||||||
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider, configService);
|
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider);
|
||||||
domainSettingsService.showFavicons$ = showFaviconsMock$;
|
domainSettingsService.showFavicons$ = showFaviconsMock$;
|
||||||
domainSettingsService.neverDomains$ = neverDomainsMock$;
|
domainSettingsService.neverDomains$ = neverDomainsMock$;
|
||||||
logService = mock<LogService>();
|
logService = mock<LogService>();
|
||||||
|
|||||||
@@ -213,7 +213,7 @@
|
|||||||
</bit-card>
|
</bit-card>
|
||||||
</form>
|
</form>
|
||||||
</bit-section>
|
</bit-section>
|
||||||
<bit-section [disableMargin]="!blockBrowserInjectionsByDomainEnabled">
|
<bit-section>
|
||||||
<form [formGroup]="additionalOptionsForm">
|
<form [formGroup]="additionalOptionsForm">
|
||||||
<bit-section-header>
|
<bit-section-header>
|
||||||
<h2 bitTypography="h6">{{ "additionalOptions" | i18n }}</h2>
|
<h2 bitTypography="h6">{{ "additionalOptions" | i18n }}</h2>
|
||||||
@@ -276,7 +276,7 @@
|
|||||||
</bit-card>
|
</bit-card>
|
||||||
</form>
|
</form>
|
||||||
</bit-section>
|
</bit-section>
|
||||||
<bit-section *ngIf="blockBrowserInjectionsByDomainEnabled" disableMargin>
|
<bit-section disableMargin>
|
||||||
<bit-item>
|
<bit-item>
|
||||||
<a bit-item-content routerLink="/blocked-domains">{{ "blockedDomains" | i18n }}</a>
|
<a bit-item-content routerLink="/blocked-domains">{{ "blockedDomains" | i18n }}</a>
|
||||||
<i slot="end" class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i>
|
<i slot="end" class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i>
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import {
|
|||||||
DisablePasswordManagerUri,
|
DisablePasswordManagerUri,
|
||||||
InlineMenuVisibilitySetting,
|
InlineMenuVisibilitySetting,
|
||||||
} from "@bitwarden/common/autofill/types";
|
} from "@bitwarden/common/autofill/types";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import {
|
import {
|
||||||
UriMatchStrategy,
|
UriMatchStrategy,
|
||||||
UriMatchStrategySetting,
|
UriMatchStrategySetting,
|
||||||
@@ -110,7 +109,6 @@ export class AutofillComponent implements OnInit {
|
|||||||
protected defaultBrowserAutofillDisabled: boolean = false;
|
protected defaultBrowserAutofillDisabled: boolean = false;
|
||||||
protected inlineMenuVisibility: InlineMenuVisibilitySetting =
|
protected inlineMenuVisibility: InlineMenuVisibilitySetting =
|
||||||
AutofillOverlayVisibility.OnFieldFocus;
|
AutofillOverlayVisibility.OnFieldFocus;
|
||||||
protected blockBrowserInjectionsByDomainEnabled: boolean = false;
|
|
||||||
protected browserClientVendor: BrowserClientVendor = BrowserClientVendors.Unknown;
|
protected browserClientVendor: BrowserClientVendor = BrowserClientVendors.Unknown;
|
||||||
protected disablePasswordManagerURI: DisablePasswordManagerUri =
|
protected disablePasswordManagerURI: DisablePasswordManagerUri =
|
||||||
DisablePasswordManagerUris.Unknown;
|
DisablePasswordManagerUris.Unknown;
|
||||||
@@ -222,10 +220,6 @@ export class AutofillComponent implements OnInit {
|
|||||||
this.autofillSettingsService.inlineMenuVisibility$,
|
this.autofillSettingsService.inlineMenuVisibility$,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.blockBrowserInjectionsByDomainEnabled = await this.configService.getFeatureFlag(
|
|
||||||
FeatureFlag.BlockBrowserInjectionsByDomain,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.showInlineMenuIdentities = await firstValueFrom(
|
this.showInlineMenuIdentities = await firstValueFrom(
|
||||||
this.autofillSettingsService.showInlineMenuIdentities$,
|
this.autofillSettingsService.showInlineMenuIdentities$,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ describe("AutofillService", () => {
|
|||||||
userNotificationsSettings,
|
userNotificationsSettings,
|
||||||
messageListener,
|
messageListener,
|
||||||
);
|
);
|
||||||
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider, configService);
|
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider);
|
||||||
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
||||||
jest.spyOn(BrowserApi, "tabSendMessage");
|
jest.spyOn(BrowserApi, "tabSendMessage");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -872,10 +872,7 @@ export default class MainBackground {
|
|||||||
|
|
||||||
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
|
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
|
||||||
|
|
||||||
this.domainSettingsService = new DefaultDomainSettingsService(
|
this.domainSettingsService = new DefaultDomainSettingsService(this.stateProvider);
|
||||||
this.stateProvider,
|
|
||||||
this.configService,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.themeStateService = new DefaultThemeStateService(this.globalStateProvider);
|
this.themeStateService = new DefaultThemeStateService(this.globalStateProvider);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { mock, MockProxy } from "jest-mock-extended";
|
import { mock } from "jest-mock-extended";
|
||||||
import { of } from "rxjs";
|
import { of } from "rxjs";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DomainSettingsService,
|
DomainSettingsService,
|
||||||
DefaultDomainSettingsService,
|
DefaultDomainSettingsService,
|
||||||
} from "@bitwarden/common/autofill/services/domain-settings.service";
|
} from "@bitwarden/common/autofill/services/domain-settings.service";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
@@ -54,14 +53,11 @@ describe("ScriptInjectorService", () => {
|
|||||||
const mockUserId = Utils.newGuid() as UserId;
|
const mockUserId = Utils.newGuid() as UserId;
|
||||||
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId);
|
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId);
|
||||||
const fakeStateProvider: FakeStateProvider = new FakeStateProvider(accountService);
|
const fakeStateProvider: FakeStateProvider = new FakeStateProvider(accountService);
|
||||||
let configService: MockProxy<ConfigService>;
|
|
||||||
let domainSettingsService: DomainSettingsService;
|
let domainSettingsService: DomainSettingsService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.spyOn(BrowserApi, "getTab").mockImplementation(async () => tabMock);
|
jest.spyOn(BrowserApi, "getTab").mockImplementation(async () => tabMock);
|
||||||
configService = mock<ConfigService>();
|
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider);
|
||||||
configService.getFeatureFlag$.mockImplementation(() => of(false));
|
|
||||||
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider, configService);
|
|
||||||
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
||||||
domainSettingsService.blockedInteractionsUris$ = of({});
|
domainSettingsService.blockedInteractionsUris$ = of({});
|
||||||
scriptInjectorService = new BrowserScriptInjectorService(
|
scriptInjectorService = new BrowserScriptInjectorService(
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
safeProvider({
|
safeProvider({
|
||||||
provide: DomainSettingsService,
|
provide: DomainSettingsService,
|
||||||
useClass: DefaultDomainSettingsService,
|
useClass: DefaultDomainSettingsService,
|
||||||
deps: [StateProvider, ConfigService],
|
deps: [StateProvider],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: AbstractStorageService,
|
provide: AbstractStorageService,
|
||||||
|
|||||||
@@ -532,10 +532,7 @@ export class ServiceContainer {
|
|||||||
this.authService,
|
this.authService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.domainSettingsService = new DefaultDomainSettingsService(
|
this.domainSettingsService = new DefaultDomainSettingsService(this.stateProvider);
|
||||||
this.stateProvider,
|
|
||||||
this.configService,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.fileUploadService = new FileUploadService(this.logService, this.apiService);
|
this.fileUploadService = new FileUploadService(this.logService, this.apiService);
|
||||||
|
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
safeProvider({
|
safeProvider({
|
||||||
provide: DomainSettingsService,
|
provide: DomainSettingsService,
|
||||||
useClass: DefaultDomainSettingsService,
|
useClass: DefaultDomainSettingsService,
|
||||||
deps: [StateProvider, ConfigService],
|
deps: [StateProvider],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: CipherServiceAbstraction,
|
provide: CipherServiceAbstraction,
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { MockProxy, mock } from "jest-mock-extended";
|
|
||||||
import { firstValueFrom, of } from "rxjs";
|
import { firstValueFrom, of } from "rxjs";
|
||||||
|
|
||||||
import { FakeStateProvider, FakeAccountService, mockAccountServiceWith } from "../../../spec";
|
import { FakeStateProvider, FakeAccountService, mockAccountServiceWith } from "../../../spec";
|
||||||
import { ConfigService } from "../../platform/abstractions/config/config.service";
|
|
||||||
import { Utils } from "../../platform/misc/utils";
|
import { Utils } from "../../platform/misc/utils";
|
||||||
import { UserId } from "../../types/guid";
|
import { UserId } from "../../types/guid";
|
||||||
|
|
||||||
@@ -10,7 +8,6 @@ import { DefaultDomainSettingsService, DomainSettingsService } from "./domain-se
|
|||||||
|
|
||||||
describe("DefaultDomainSettingsService", () => {
|
describe("DefaultDomainSettingsService", () => {
|
||||||
let domainSettingsService: DomainSettingsService;
|
let domainSettingsService: DomainSettingsService;
|
||||||
let configService: MockProxy<ConfigService>;
|
|
||||||
const mockUserId = Utils.newGuid() as UserId;
|
const mockUserId = Utils.newGuid() as UserId;
|
||||||
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId);
|
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId);
|
||||||
const fakeStateProvider: FakeStateProvider = new FakeStateProvider(accountService);
|
const fakeStateProvider: FakeStateProvider = new FakeStateProvider(accountService);
|
||||||
@@ -22,9 +19,7 @@ describe("DefaultDomainSettingsService", () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
configService = mock<ConfigService>();
|
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider);
|
||||||
configService.getFeatureFlag$.mockImplementation(() => of(false));
|
|
||||||
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider, configService);
|
|
||||||
|
|
||||||
jest.spyOn(domainSettingsService, "getUrlEquivalentDomains");
|
jest.spyOn(domainSettingsService, "getUrlEquivalentDomains");
|
||||||
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
// FIXME: Update this file to be type safe and remove this and next line
|
||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { map, Observable, switchMap, of } from "rxjs";
|
import { map, Observable } from "rxjs";
|
||||||
|
|
||||||
import { FeatureFlag } from "../../enums/feature-flag.enum";
|
|
||||||
import {
|
import {
|
||||||
NeverDomains,
|
NeverDomains,
|
||||||
EquivalentDomains,
|
EquivalentDomains,
|
||||||
UriMatchStrategySetting,
|
UriMatchStrategySetting,
|
||||||
UriMatchStrategy,
|
UriMatchStrategy,
|
||||||
} from "../../models/domain/domain-service";
|
} from "../../models/domain/domain-service";
|
||||||
import { ConfigService } from "../../platform/abstractions/config/config.service";
|
|
||||||
import { Utils } from "../../platform/misc/utils";
|
import { Utils } from "../../platform/misc/utils";
|
||||||
import {
|
import {
|
||||||
DOMAIN_SETTINGS_DISK,
|
DOMAIN_SETTINGS_DISK,
|
||||||
@@ -111,10 +109,7 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
|
|||||||
private defaultUriMatchStrategyState: ActiveUserState<UriMatchStrategySetting>;
|
private defaultUriMatchStrategyState: ActiveUserState<UriMatchStrategySetting>;
|
||||||
readonly defaultUriMatchStrategy$: Observable<UriMatchStrategySetting>;
|
readonly defaultUriMatchStrategy$: Observable<UriMatchStrategySetting>;
|
||||||
|
|
||||||
constructor(
|
constructor(private stateProvider: StateProvider) {
|
||||||
private stateProvider: StateProvider,
|
|
||||||
private configService: ConfigService,
|
|
||||||
) {
|
|
||||||
this.showFaviconsState = this.stateProvider.getGlobal(SHOW_FAVICONS);
|
this.showFaviconsState = this.stateProvider.getGlobal(SHOW_FAVICONS);
|
||||||
this.showFavicons$ = this.showFaviconsState.state$.pipe(map((x) => x ?? true));
|
this.showFavicons$ = this.showFaviconsState.state$.pipe(map((x) => x ?? true));
|
||||||
|
|
||||||
@@ -123,14 +118,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
|
|||||||
|
|
||||||
// Needs to be global to prevent pre-login injections
|
// Needs to be global to prevent pre-login injections
|
||||||
this.blockedInteractionsUrisState = this.stateProvider.getGlobal(BLOCKED_INTERACTIONS_URIS);
|
this.blockedInteractionsUrisState = this.stateProvider.getGlobal(BLOCKED_INTERACTIONS_URIS);
|
||||||
|
this.blockedInteractionsUris$ = this.blockedInteractionsUrisState.state$.pipe(
|
||||||
this.blockedInteractionsUris$ = this.configService
|
map((x) => x ?? ({} as NeverDomains)),
|
||||||
.getFeatureFlag$(FeatureFlag.BlockBrowserInjectionsByDomain)
|
|
||||||
.pipe(
|
|
||||||
switchMap((featureIsEnabled) =>
|
|
||||||
featureIsEnabled ? this.blockedInteractionsUrisState.state$ : of({} as NeverDomains),
|
|
||||||
),
|
|
||||||
map((disabledUris) => (Object.keys(disabledUris).length ? disabledUris : {})),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.equivalentDomainsState = this.stateProvider.getActive(EQUIVALENT_DOMAINS);
|
this.equivalentDomainsState = this.stateProvider.getActive(EQUIVALENT_DOMAINS);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export enum FeatureFlag {
|
|||||||
PM14938_BrowserExtensionLoginApproval = "pm-14938-browser-extension-login-approvals",
|
PM14938_BrowserExtensionLoginApproval = "pm-14938-browser-extension-login-approvals",
|
||||||
|
|
||||||
/* Autofill */
|
/* Autofill */
|
||||||
BlockBrowserInjectionsByDomain = "block-browser-injections-by-domain",
|
|
||||||
EnableNewCardCombinedExpiryAutofill = "enable-new-card-combined-expiry-autofill",
|
EnableNewCardCombinedExpiryAutofill = "enable-new-card-combined-expiry-autofill",
|
||||||
NotificationRefresh = "notification-refresh",
|
NotificationRefresh = "notification-refresh",
|
||||||
UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection",
|
UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection",
|
||||||
@@ -76,7 +75,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.CreateDefaultLocation]: FALSE,
|
[FeatureFlag.CreateDefaultLocation]: FALSE,
|
||||||
|
|
||||||
/* Autofill */
|
/* Autofill */
|
||||||
[FeatureFlag.BlockBrowserInjectionsByDomain]: FALSE,
|
|
||||||
[FeatureFlag.EnableNewCardCombinedExpiryAutofill]: FALSE,
|
[FeatureFlag.EnableNewCardCombinedExpiryAutofill]: FALSE,
|
||||||
[FeatureFlag.NotificationRefresh]: FALSE,
|
[FeatureFlag.NotificationRefresh]: FALSE,
|
||||||
[FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE,
|
[FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE,
|
||||||
|
|||||||
Reference in New Issue
Block a user