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

Changing of request headers (declarativeNetRequest) inside the side panel does not work #119

Open
yankovichv opened this issue Nov 16, 2023 · 10 comments

Comments

@yankovichv
Copy link

Why? Maybe I should specify some special parameters for the rule?

Example:

 addRules: [
      {
        id: 1,
        priority: 1,
        action: {
          type: 'modifyHeaders',
          requestHeaders: todoist.requestHeaders,
        },
        condition: {
          resourceTypes: ["sub_frame"],
          requestDomains: todoist.requestDomains,
        },
      },
@yankovichv
Copy link
Author

@Bhuvana-Priya , @sivsouvamMSFT 👋, 🙏.

@Bhuvana-Priya
Copy link

Hi @yankovichv ,

Thank you for reporting this. We are looking into this and will let you know as soon as we have an update.

@abhishek-shanthkumar
Copy link
Member

@yankovichv, can you share more details about where you're calling the declarativeNetRequest API from (static ruleset from manifest, background script, side panel surface, ...), whether you see any warning or error in the developer console when you make the call, and what the request domains are for which the header modification is not working?

@yankovichv
Copy link
Author

yankovichv commented Feb 1, 2024

@abhishek-shanthkumar, we call the code from the service worker. We don't get any errors. The rules work fine in tabs but not in the side panel.

@stefanvd
Copy link

stefanvd commented Feb 2, 2024

@Bhuvana-Priya
I have my Page Sidebar for Microsoft Edge in the store:
https://microsoftedge.microsoft.com/addons/detail/page-sidebar-open-any-p/miifojhnicpdfnfmojlcjkgebnmcckjb
However, I encounter the same issue where it does not allow my page content to show up. While in Google Chrome and Firefox, the same code works for both web browsers.

My code is free and Open-Source:
https://github.com/stefanvd/Browser-Extensions/tree/master/Page-Sidebar

Are there any updates? And what is the reason that your Microsoft web browser makes this different?

@abhishek-shanthkumar
Copy link
Member

Thanks, @yankovichv. It'll help if you can share a minimal extension with which the behaviour can be reproduced. If I understand it correctly, you make some network requests from your extension's side panel surface, and for those requests, the header modification rules don't apply (while they do for requests made from other surfaces like the popup and the service worker). Is that right?

@yankovichv
Copy link
Author

👋

@stefanvd
Copy link

@Bhuvana-Priya @abhishek-shanthkumar Is there any update about this important issue? As it is very important for my users.

@abhishek-shanthkumar
Copy link
Member

Sorry for the delay. I can repro the reported issue through the following steps:

  1. Install the extension https://microsoftedge.microsoft.com/addons/detail/page-sidebar-open-any-p/miifojhnicpdfnfmojlcjkgebnmcckjb
  2. Open the extension side panel and search for or drag-and-drop a site that has CSP headers (example: https://content-security-policy.com/) into it.

Expected result: The site loads because the extension modifies the CSP headers. This is the behavior on Chrome.
Actual result on Microsoft Edge: The site fails to load because of CSP violations.

We're engaged with our security team to determine the best approach here.

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

No branches or pull requests

4 participants