Skip to content

Block extension from specific hosts #701

@fregante

Description

@fregante

Problem

Extensions host permissions are not granular enough:

  • if the extension requests "all sites" access (via manifest or permissions.request()), there's no way to remove specific websites1
  • if the permission is declared in the manifest (via host_permissions or content_scripts.*.matches), there's no way to withdraw it2

Proposal: permission block list

Browsers already have the ability to disable some hosts, but this information is not clearly exposed to the extension author nor can it be expanded.

await browser.permissions.getAll();
// => {origins: ['https://*/*']}

await browser.permissions.blocked.getAll();
// => ['https://banking.example.com/*', 'https://password-manager.example.org/*']

The extension could then ask for removal: browser.permissions.blocked.remove(['https://banking.example.com/*'])

  • If the block was added via browser UI, the user will be prompted: "The extension requests access to banking.example.com"
  • If the block was added via browser.permissions.blocked.add, the action will proceed automatically.

This ability could also be used by the extension author to enable/disable its own content scripts and user scripts as necessary, for example to:

  • "Disable extension on this domain"
  • "Reload without extension"
  • "Disable extension for 15 minutes"

Related

This was proposed in some form in #653, but this proposal applies to permissions more generically. Adding a website to the block list would also disable the injection of its content scripts.

#700 also has some overlap in capability, but intent and possibilities are very different.

Footnotes

  1. Safari can do so via browser UI (screenshot), but not via API

  2. Safari and Chrome can do so via browser UI (screenshot), but not via API

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions