Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-13115] Allow users to disable extension content script injections by domain #11826

Merged
merged 19 commits into from
Jan 6, 2025

Conversation

jprusik
Copy link
Contributor

@jprusik jprusik commented Nov 1, 2024

🎟️ Tracking

PM-13115

📔 Objective

Create a concept of disabled domains for the Bitwarden extension; unlike the excluded domains in the notification settings, a page belonging to the disabled domain list would prevent the Bitwarden extension from interacting with the page at all.

Notes

  • This feature is gated by the block-browser-injections-by-domain feature flag
  • While this work is functionally complete, there are follow up UX/design tasks (see tracked tasks in the ticket) that must be completed before this is released (via feature-flag)
  • This would not replace or otherwise impact the “excluded domains” concept for notifications (at least not within the scope of this PR; see comment)
  • Changes made to the blocked domains will not be reflected until the next content script injection to the page (typically a page navigation or refresh)
  • Supporting presentational experience work split to [PM-16804] Add supporting Vault component presentational updates for blocked domains #12720 enable more incremental development

Screen capture

Kapture.2024-12-16.at.11.09.36.mp4
Kapture.2024-12-16.at.11.28.39.mp4

Screenshot 2024-12-16 at 11 02 26 AM

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@jprusik jprusik self-assigned this Nov 1, 2024
@jprusik jprusik force-pushed the pm-13115 branch 2 times, most recently from 77d3472 to e8ddd67 Compare November 1, 2024 19:53
Copy link
Contributor

github-actions bot commented Nov 11, 2024

Logo
Checkmarx One – Scan Summary & Detailsf39b8b59-7177-4af7-ae94-062678ef5beb

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/deprecated/overlay/pages/list/autofill-overlay-list.deprecated.ts: 393
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html: 15

@jprusik jprusik force-pushed the pm-13115 branch 3 times, most recently from 308c302 to 2695a47 Compare December 16, 2024 14:51
@@ -67,7 +66,6 @@ import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.co
JslibModule,
LinkModule,
PopOutComponent,
PopupFooterComponent,
Copy link
Contributor Author

@jprusik jprusik Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PopupFooterComponent was not in use anywhere here or in the template

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is largely a copy of apps/browser/src/autofill/popup/settings/excluded-domains.component.ts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an open bug for the existing UI here PM-13808 with the input styling. Do you think we can get that fixed so we don't duplicate the UI into this new component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note to that ticket to include the blocked URIs view that would be introduced by this work

@@ -3,6 +3,7 @@
[ciphers]="ciphers"
[title]="'autofillSuggestions' | i18n"
[showRefresh]="showRefresh"
[sectionIndicators]="sectionIndicators"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This concept allows for the conditional addition of icon indicators alongside the section title (in this case, an informational icon indicating the view contains ciphers for a domain that has been added to the user's block list).

this.domainSettingsService
.setBlockedInteractionsUris({
...blockedURIs,
[this.autofillTabHostname]: { bannerIsDismissed: true },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the existing NeverDomains data shape give us tons of flexibility in the future if we implement more granular injection-blocking options.

As it is, we could merge the neverDomains state concept (expressed in the interface as "Excluded Domains" and currently used to allow users to block the notification bar on specified domains) into blockedInteractionsUris concept with a state migration.

For example (not a well-considered data shape, just for illustrative purposes):

{
  "banking-portal.real-tld": {
    "blockedInjections": null, // all injections blocked
    "dismissedMessages": ['autofillBlockedBanner']
  }, 
  "duckduckgo.com": {
    "blockedInjections": ["notifications", "inline-menu"], 
    "dismissedMessages": []
  }
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example (not a well-considered data shape, just for illustrative purposes):

💭 You might want to update this example to account for our "no-null" guidance. If you want to keep the example short, I'd just swap out the null for true or "all" (no list).

A more comprehensive example that would be easier to port to Rust (as an enum) uses a discriminated union.

type ScriptType = "notifications" | "inline-menu";
type Injectable = { type: "allow-all" } | { type: "deny-list", injections: ScriptType[] } | { type: "deny-all" };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted; a fair point and we'll pull this into our design when we get to migrating excluded domains (or other NeverDomain concepts) in

Comment on lines 57 to 61
if (!injectionAllowedInTab) {
throw new Error("This URI of this tab is on the blocked domains list.");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like
Screenshot 2024-12-16 at 9 51 47 AM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purposeful blocking, no? Do we want a visible error like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it might be helpful to have some kind of dev/console visibility in case people set a blocked domain and forget later (and then are wondering why the extension isn't working). But yeah, I think that would be better served as a warning or informational log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in f6c1a55

@jprusik jprusik force-pushed the pm-13115 branch 7 times, most recently from 1dd180e to ab2f085 Compare December 19, 2024 20:54
@jprusik jprusik changed the title [PM-13115] Allow users to disable the Bitwarden extension by domain [PM-13115] Allow users to disable extension content script injections by domain Dec 19, 2024
@jprusik jprusik marked this pull request as ready for review December 19, 2024 21:05
@jprusik jprusik requested review from a team as code owners December 19, 2024 21:05
addisonbeck
addisonbeck previously approved these changes Jan 3, 2025
gbubemismith
gbubemismith previously approved these changes Jan 3, 2025
audreyality
audreyality previously approved these changes Jan 6, 2025
Copy link
Member

@audreyality audreyality left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a nit, but it doesn't block merge.

@jprusik jprusik enabled auto-merge (squash) January 6, 2025 17:33
Copy link
Member

@shane-melton shane-melton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good from a Vault's perspective and I'm excited for the feature!

I did have two suggestions for how we could better encapsulate the autofill logic and avoid adding complexity to the generic vault components. Let me know what you think!

@@ -22,6 +22,16 @@
</bit-no-items>
</div>

<bit-banner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨 How would you feel if we encapsulated this banner in its own blocked-injection-script-banner component? It would let us move the handleScriptInjectionIsBlockedBannerDismiss() and showScriptInjectionIsBlockedBanner logic out of the top-level vault.

This is a problem we have in the Web vault component today -- it has a lot of various business logic in a single component -- and I'm hoping we can avoid repeating that in the new refreshed Browser vault by breaking logic out into their own components.

Copy link
Member

@shane-melton shane-melton Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨 I would prefer we use content projection instead of introducing sectionIndicator strings. We could use something like this in the template:

<h2 bitTypography="h6">
  {{ title }}
  <ng-content select="[slot=title-icon]"></ng-content>
</h2>

And then the autofill-vault-list-items component could do something like:

<app-vault-list-items-container ...>
   <i slot="title-icon"
      *ngIf="showAutofillBlockedIndicator"
      class="bwi bwi-info-circle"
      [appA11yTitle]="'autofillBlockedTooltip' | i18n">
   </i>
</app-vault-list-items-container>

This would help reduce the amount of bespoke autofill logic in our generic vault item components. Let me know what you think!

@jprusik jprusik disabled auto-merge January 6, 2025 21:32
@jprusik jprusik enabled auto-merge (squash) January 6, 2025 22:03
@jprusik jprusik merged commit 15faf52 into main Jan 6, 2025
91 checks passed
@jprusik jprusik deleted the pm-13115 branch January 6, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants