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

[DNR] extensionPath should not require exposing the target in web_accessible_resources #604

Closed
tophf opened this issue May 6, 2024 · 3 comments
Labels
needs-triage: safari Safari needs to assess this issue for the first time opposed: chrome Opposed by Chrome opposed: firefox Opposed by Firefox

Comments

@tophf
Copy link

tophf commented May 6, 2024

declarativeNetRequest's extensionPath should not require exposing the target in web_accessible_resources, because it's problematic:

  • the extension may want to disallow web-initiated redirections in general, allowing them only for its own DNR rules;
  • it's a regression from ManifestV2 where extensions could stop the navigation by returning {cancel:true} or {redirectUrl: 'javascript:0'} and then redirect the tab via chrome.tabs.update(tabId, {url: 'own.html'}) - in Chrome's ManifestV3 implementation normal extensions can't use webRequestBlocking anymore;
  • the requirement is not intuitively obvious.
@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels May 6, 2024
@oliverdunk oliverdunk added opposed: chrome Opposed by Chrome and removed needs-triage: chrome Chrome needs to assess this issue for the first time labels May 9, 2024
@Rob--W Rob--W added opposed: firefox Opposed by Firefox and removed needs-triage: firefox Firefox needs to assess this issue for the first time labels May 9, 2024
@Rob--W
Copy link
Member

Rob--W commented May 9, 2024

By design, web_accessible_resources blocks access from content unless explicitly allowed. When an extension redirects to an extension resource, the web page will try to fetch it. It is not possible to create an exception for redirects, because ultimately a direct fetch from web pages is indistinguishable from a redirect at the policy enforcement level.

If there is broader interest, I am willing to become supportive of a mechanism for extensions to declare web_accessible_resources as only exposed in response to a specific DNR request.

Ultimately, I think that the better approach to this problem is to not weaken the policies around network requests, but to introduce a dedicated way to synthetize a response body (and headers?) for a given request. On the Firefox side I filed a request for this feature at https://bugzilla.mozilla.org/show_bug.cgi?id=1712096.

@tophf
Copy link
Author

tophf commented May 9, 2024

The use case I had in mind was only about main_frame navigation (also sub_frame), sorry for not clarifying, it just slipped my mind. In this case navigation isn't performed by the page, but by the browser. I guess I should make another issue?

Extensions like Tapermonkey/Violentmonkey/Stylus and others want to redirect specific URLs to their own built-in UI page without exposing it to the web. URLs ending on .user.js or .user.css and such, so this is not solved by custom protocol handlers.

@tophf
Copy link
Author

tophf commented May 11, 2024

Superseded by #610.

@tophf tophf closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage: safari Safari needs to assess this issue for the first time opposed: chrome Opposed by Chrome opposed: firefox Opposed by Firefox
Projects
None yet
Development

No branches or pull requests

3 participants