Closed ericplane closed 10 months ago
@ericplaneRBLX Do you have a pointer to an extension that we can look at?
@rebron The extension I used to find out about this issue is a subscription based extension so I don't really. The only thing I could offer is screensharing the issue and such via Discord.
The issue only appears in exensions with Manifest v3 and when using the declarativenetrequest feature of the manifest linking it to a json table with all the rules works fine but when you restart your browser you get content-security policy errors and all the svgs don't load from a third-party website but everything else works.
Users from our extension report this same issue. The code that registers the rules is not very complicated. It is placed in the main body of the service worker script and looks like this:
if (chrome.declarativeNetRequest) {
chrome.runtime.onInstalled.addListener((details) => {
const RULES = [ ... ];
chrome.declarativeNetRequest.updateDynamicRules({
removeRuleIds: RULES.map(r => r.id),
addRules: RULES,
});
});
}
Hey we think we're maybe seeing a related/the same issue:
We've a simple brave/chrome extension (for you.com) that basically lets the user toggle their default search engine preferences via extension. The gist of the code is below, but basically a user can send a message for a couple different things and the rulesets (which redirect your default search to the appropriate endpoint) are set below.
} else if (req === "code") {
chrome.declarativeNetRequest.updateEnabledRulesets({
enableRulesetIds: ["ruleset_1"],
disableRulesetIds: ["ruleset_2", "ruleset_3", "ruleset_4"],
});
chrome.tabs.create({ url: "https://code.you.com/" });
} else if (req === "youchat") {
chrome.declarativeNetRequest.updateEnabledRulesets({
enableRulesetIds: ["ruleset_3"],
disableRulesetIds: ["ruleset_1", "ruleset_2", "ruleset_4"],
});
chrome.tabs.create({
url: "https://you.com/search?q=" + queries[index] + "&tbm=youchat",
});
}
We think this was working fine until quite recently, but now is a no-op, in that rulesets don't seem to get changed despite message going through. This still works on slightly older versions of Brave (haven't pinned down exact breaking point yet) so seems perhaps related to a recent change? it continues to work fine on Edge/Chrome.
If it helps, the code/published extension is here with that pinned commit:
Thanks so much for all you do, Brave is great!
I had the same issue and I created a simple extension to reproduce the bug: https://github.com/gs256/brave-declarativeNetRequest-bug.
The extension should block all images on https://www.google.com/search?q=test&tbm=isch&gbv=1 but it stops working after Brave restart. Reproduction steps are described in my repo.
Here is the whole code:
manifest.json
{
"name": "Brave extension bug",
"version": "0.1",
"manifest_version": 3,
"background": {},
"permissions": ["webRequest", "declarativeNetRequest", "declarativeNetRequestFeedback"],
"declarative_net_request": {
"rule_resources": [
{
"id": "rules",
"enabled": true,
"path": "rules.json"
}
]
},
"host_permissions": ["*://*/*"],
"action": {}
}
rules.json
[
{
"id": 1,
"priority": 1,
"action": {
"type": "block"
},
"condition": {
"urlFilter": "https://*.gstatic.com/*"
}
}
]
@rebron I just linked an issue to a simple extension that is not working because of this bug.
@ericplaneRBLX Do you have a pointer to an extension that we can look at?
You can try scratch addons just get some messages on your scratch account then open scratch addons then try to mark messages as read. It works on Chrome but not on Brave
@rebron Any update on this? It's been almost 3 months and it's a big issue when owning an extension.
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run chrome.runtime.reload()
.
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run
chrome.runtime.reload()
.
But, how do it only once?
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run
chrome.runtime.reload()
.But, how do it only once?
Mind clarifying what you mean by once? If you want an example you can check out the source code of the extension I made
Would really appreciate a fix by now. My extension with 30k+ users has not been working in brave now for months because of this: https://github.com/pietervanheijningen/clickbait-remover-for-youtube/issues/56
Really don't think brave should deviate much from standard chromium behaviour. Especially with the extension API. Sure this might be a strange way of doing things, but I don't feel like re-writing most of my extension just to make it work for a small minority of brave users.
how is this not solved yet? its breaking so many manifest v3 extensions that use declarativeNetRequest.
static rules in brave is working the same as session rules, that get removed on a browser restart. static rules should be always active.
i dont know why they ask for "more info" when is so easy to reproduce.
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run
chrome.runtime.reload()
.
this assumes that you have access to the extension right? because the extension I use isn't made by me
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run
chrome.runtime.reload()
.this assumes that you have access to the extension right? because the extension I use isn't made by me
Yes, it can only be used for extensions you are developing. If that extension isn't by you, maybe you can contact the developer or even mod the extension to support it for brave. Or just wait until brave fixes this (spoiler - it's probably after GTA 6 gets released)
Here is a repo that is an interactive extension just for this repro
I have had this issue on both Linux (arch) and Windows, so I don't think it is OS specific. I would expect it to be a problem on MacOS as well.
Last release this worked was v1.51.118
Due to this issue, several of my extensions are unable to function properly, and I have received continuous 1-star ratings over the past week. This has caused significant harm to me. If you are willing to fix this problem, I am willing to generously pay a sum of money.
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run
chrome.runtime.reload()
.this assumes that you have access to the extension right? because the extension I use isn't made by me
No... You don't need to write the extension yourself. Here is what i did based on the instructions to temporary resolve this:
Method 1:
Click the more button at the top-right
Click the extensions button
locate the extension that is having problems and click details (in my case ScratchAddons)
Click the background process or if you only have one process click it (shown in the picture)
a new window should open up, click console (shown in the picture)
type in chrome.runtime.reload()
and press enter
Try using the extension again.
Method 2:
Method 3:
Click end process
There will be a message click to message to reload
@kokofixcomputers That seems like a good solution; unfortunately there isn't anything at all at inspect views for me.
This is no different than just flipping the toggle switch off and on, on the extension itself…
On Tue, Oct 24, 2023 at 17:18 kokofixcomputers @.***> wrote:
I found a temporary hack which can solve this. In the manifest specify a content script, which sends a certain message "x" to the background script. Then for that message run chrome.runtime.reload().
this assumes that you have access to the extension right? because the extension I use isn't made by me
No... You don't need to write the extension yourself. Here is what i did based on the instructions to temporary resolve this:
- Click the more button at the top-right
- Click the extensions button
- locate the extension that is having problems and click details (in my case ScratchAddons)
[image: image] https://user-images.githubusercontent.com/113046561/277830253-69a0b01a-d814-4110-9688-8ae75863a035.png
- Click the background process or if you only have one process click it (shown in the picture)
[image: image] https://user-images.githubusercontent.com/113046561/277829078-16ea51f0-3030-4e1b-a458-c234dcea6fa6.png
- a new window should open up, click console (shown in the picture)
[image: image] https://user-images.githubusercontent.com/113046561/277829317-843141bb-9b21-4962-b2a0-3c048768f415.png
- type in
chrome.runtime.reload()
and press enter [image: image] https://user-images.githubusercontent.com/113046561/277830437-a3af0859-73f4-49ce-9099-fcfac1baa3b5.png- Try using the extension again.
— Reply to this email directly, view it on GitHub https://github.com/brave/brave-browser/issues/30854#issuecomment-1778205233, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO7UUIYHWON62PZA65HZTLYBBEGHAVCNFSM6AAAAAAY4KMTUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZYGIYDKMRTGM . You are receiving this because you commented.Message ID: @.***>
@rebron I think there has been more than enough information collected within this issue to start triage. Can we please get the needs-more-info
label removed and get the priority bumped?
@kokofixcomputers I mean as mentioned method 2 works for me though but yes:
@kokofixcomputers I mean as mentioned method 2 works for me though but yes:
Oh yes, I can see that there is no inspect views, sometimes when i open the extension popup and reload the extension details page you will see the inspect views. But... if method 2 works then you problobly don't have to worry about it
Due to this issue, several of my extensions are unable to function properly, and I have received continuous 1-star ratings over the past week. This has caused significant harm to me. If you are willing to fix this problem, I am willing to generously pay a sum of money.
@carl-jin just use what I found -> https://github.com/brave/brave-browser/issues/30854#issuecomment-1685247036 and https://github.com/brave/brave-browser/issues/30854#issuecomment-1696642903
Hi @bbondy,
Can Brave team take a look at this and give some priority to it? As you can see there is enough information to reproduce this, but basically any extension with declarativeNetRequest will not work on start, so extensions have to be disabled and then re-enable for them to work, something not good for any user or even developers since they get people making issues for their extensions for something Brave is 100% at fault.
This issue started happening when Brave got Chromium 114 with build Nightly v1.53.43 (Chromium 114.0.5735.26)
on May 16th, the previous version Nightly v1.53.42 (Chromium 113.0.5672.92)
on May 15th worked fine with Manifestv3-declarativeNetRequest extensions.
So, it's been 175 days or 5 months 22 days since this started happening, almost half a year where many extensions have failed to work properly as they should. And while Google delayed the force of the Manifestv3, developers are and will adopt it more and more since it is the future, this is limiting Brave as a browser because extensions are important for many users, so Brave should make sure to work work the best it can, without issues like this. Thank you.
Due to this issue, several of my extensions are unable to function properly, and I have received continuous 1-star ratings over the past week. This has caused significant harm to me. If you are willing to fix this problem, I am willing to generously pay a sum of money.
@carl-jin just use what I found -> #30854 (comment) and #30854 (comment)
thats not a fix, and thats not even work when you do redirects. thats only work for injected code on pages. declarativeNetRequest do much more than just inject things in pages. they can edit headers, blocks, redirects...
Hi folks!
Thanks for the loads of good information! Since we have enough info here, I've cleaned up the comments a bit. Thanks to those that shared information, repro steps, and screenshots. We'll work on getting this prioritized
I've assigned a P3 for now - stay tuned for updates. I'll unlock this again after things cool down a bit
Hey everyone! This is now fixed in nightly
starting with version 1.63.94
. After some testing we might uplift it into beta
/release
channels.
Test case:
youtube.com
The step (4) failed on versions prior to 1.63.94
, i.e. extension didn't work without manual off/on on brave://extensions/
.
PASSED
usingBrave | 1.63.102 Chromium: 120.0.6099.199 (Official Build) nightly (x86_64)
-- | --
Revision | e04c47f4648bb8a13cad74d386e61d33a80d70be
OS | macOS Version 14.3 (Build 23D5043d)
1.63.102
https://chromewebstore.google.com/detail/clickbait-remover-for-you/omoinegiohhgbikclijaniebjpkeopip
youtube.com
brave://extensions
example | example | example | example | example | example |
---|---|---|---|---|---|
When is it expected to get released in latest builds?
Hi @leteaaDEV - this is merged already into both Nightly and Beta builds. 1.63 is scheduled to hit Release channel on February 20th
Verification PASSED
using
Brave | 1.63.134 Chromium: 121.0.6167.85 (Official Build) beta (64-bit)
-- | --
Revision | cdcba6ef408b305ce19b1a9b3fabbb5e9e3b36bf
OS | Windows 11 Version 23H2 (Build 22631.3085)
1.63.134
https://chromewebstore.google.com/detail/clickbait-remover-for-you/omoinegiohhgbikclijaniebjpkeopip
lowercase
and restarted browserlowercase
title shown correct caseexample | example | example | example | example |
---|---|---|---|---|
This issue still exists in the latest version of Brave. Brave: v1.62.153 sys: MacOS v13.1 ext: https://chromewebstore.google.com/detail/esuit-ad-blocker-for-face/jkbklfkombochacjoeagggbiohipcbaj
This extension uses declarativeNetRequest to define rules that remove Facebook's CSP rules, but when I use cmd + q to exit Brave and then reopen the Brave browser to visit the FB page, declarativeNetRequest does not take any effect on FB. I have to manually disable this extension and then re-enable it in order for the declarativeNetRequest rules to be applied correctly.
I have now reported this issue to the users and have been working to get them back to Chrome as at least Chrome provides stable support.
Hello @ESUITDEV the fix is currently only in nightly and beta builds 1.63 the devs said it will be in the release build which will drop around February 20th.
Clearing QA-Pass
labels as the above will need to be re-verified via 1.62.x
. Used https://github.com/brave/brave-browser/issues/30854#issuecomment-1881983720 as the needed verification to uplift the above into 1.62.x
.
The above requires 1.62.155
or higher for 1.62.x
verification 👍
Removed QA/Test-All-Platforms
- per discussion with @goodov QA will check this on Windows and macOS.
cc @brave/qa-team
Verified with
Brave | 1.62.155 Chromium: 121.0.6167.85 (Official Build) (x86_64)
-- | --
Revision | 91c989228daf153ef41bd965f268fabc7b9dbbf0
OS | macOS Version 13.6.4 (Build 22G513)
Reproduced the issue using 1.62.153 Chromium: 121.0.6167.85
. Saw that the extension listed via https://github.com/brave/brave-browser/issues/30854#issuecomment-1880542650 didn't work on browser restart unless manually toggled off/back on.
1.62.153 before browser restart | 1.62.153 after browser restart | 1.62.153 after extension toggle off/on |
---|---|---|
Verification PASSED
using
Brave | 1.62.155 Chromium: 121.0.6167.85 (Official Build) (64-bit)
-- | --
Revision | 91c989228daf153ef41bd965f268fabc7b9dbbf0
OS | Windows 11 Version 23H2 (Build 22631.3085)
Reproduced the issue from https://github.com/brave/brave-browser/issues/30854#issuecomment-1880542650
1.62.153 before browser restart | 1.62.153 after browser restart | 1.62.153 after extension toggle off/on |
---|---|---|
Clean profile:
example | example |
---|---|
Upgrade:
https://chromewebstore.google.com/detail/clickbait-remover-for-you/omoinegiohhgbikclijaniebjpkeopip
lowercase
title shown correct casebefore restarting browser | restart browser | After upgrade w/out extension toggle restart |
---|---|---|
Description
Whenever using a chrome extension which adds declarativeNetRequest rules it will only work after reloading the extension after browser startup. Brave doesn't check for these rules on browser startup so I need to reload the extension to get it to work allowing the content security policies rather than blocking them.
Steps to Reproduce
Reproduces how often:
Easily reproduced
Brave version (brave://version info)
1.52.119 Chromium: 114.0.5735.90 (Official Build) (64-bit)
Other Additional Information: