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

Add ability to translate header= into DNR responseHeaders condition #157

Open
11 tasks done
Nexus-Gits opened this issue Jul 28, 2024 · 7 comments
Open
11 tasks done

Comments

@Nexus-Gits
Copy link

Nexus-Gits commented Jul 28, 2024

Prerequisites

  • This is NOT a YouTube, Facebook, Twitch or a shortener/hosting site report. These sites MUST be reported by clicking their respective links.
  • I read and understand the policy about what is a valid filter issue.
  • I verified that this issue is not a duplicate. (Search here to find out.)
  • I did not remove any of the default filter lists, or I have verified that the issue was not caused by removing any of the default lists.
  • I did not enable additional filter lists, or I have verified that the issue still occurs without enabling additional filter lists.
  • I do not have custom filters/rules, or I have verified that the issue still occurs without custom filters/rules.
  • I am not using uBlock Origin along with other content blockers.
  • I have verified that the web browser's built-in content blocker/tracking protection, network wide/DNS blocking, or my VPN is not causing the issue.
  • I have verified that other extensions are not causing the issue.
  • If this is about a breakage or detection, I have verified that it is caused by uBlock Origin and isn't a site issue.
  • I did not answer truthfully to ALL the above checkboxes.

URL(s) where the issue occurs.

https://yomovies.farm/

Description

Ads do not block by ublock origin lite on this site. when play video it pop up ads

Other extensions used

nothing.

Screenshot(s)

Screenshot(s)

Configuration

Details
@mapx- mapx- transferred this issue from uBlockOrigin/uAssets Jul 28, 2024
@gorhill
Copy link
Member

gorhill commented Jul 28, 2024

Possibly because the following filter can't be translated into a DNR rule for multiple reasons:

/^https?:\/\/(?:[a-z]{2}\.)?[0-9a-z]{5,16}\.[a-z]{3,7}\/[a-z](?=[a-z]{0,25}[0-9A-Z])[0-9a-zA-Z]{3,26}\/\d{4,5}(?:\?[_v]=\d+)?$/$script,3p,redirect-rule=noop.js,match-case
  • Not a compatible regex (it uses lookaround assertion)
  • redirect-rule can't be converted to DNR

@MasterKia MasterKia changed the title yomovies.farm ad blocker does not work when play any videos yomovies.farm: ads Jul 28, 2024
@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Jul 28, 2024

@gorhill Sorry, can MV3 use header now? I see the issue linked here is closed: w3c/webextensions#460

I think this issue can be solved by

*$script,3p,domain=minoplres.xyz,header=Access-Control-Allow-Headers:/megageocheckolololo/

if header is supported

@Celsius273
Copy link

response header matching was added in Chrome M128, so whenever that version lands?

@gorhill
Copy link
Member

gorhill commented Aug 1, 2024

From RuleCondition documentation, responseHeaders support is pending. Also, as per HeaderInfo documentation, if the value to match is a regex, it will have to be translatable into simple pattern matching syntax, where only * and ? are supported.

Conversion of header= filters into DNR rules will have to wait for support to be official in stable release, and also to be sure that presence of responseHeaders rules does not break the extension on older versions of the browser not supporting the capability.

@gorhill gorhill changed the title yomovies.farm: ads Add ability to translate header= into DNR responseHeaders condition Aug 1, 2024
stephenhawk8054 added a commit to uBlockOrigin/uAssets that referenced this issue Aug 3, 2024
@danielhjacobs
Copy link

danielhjacobs commented Aug 7, 2024

and also to be sure that presence of responseHeaders rules does not break the extension on older versions of the browser not supporting the capability

From my experience with ruffle-rs/ruffle#16694, this is doable with just a try/catch for adding the rule conditions on other browsers and older versions of Chrome that hadn't even begun implementing this rule condition, but on versions of Chrome that began implementing this feature behind a flag, adding the rule conditions does not throw but they take into account only their other conditions if the flag is not enabled, which may be undesirable. I had to use this code, suggested by Rob W from the Firefox team, to create a function to detect whether these conditions were really supported before registering them to work around that: w3c/webextensions#638 (comment). This is the Chrome bug indicating features developed behind a flag are not fully hidden behind the flag: https://issues.chromium.org/issues/347186592#comment9

It may be different for rules registered in the manifest.

@gorhill
Copy link
Member

gorhill commented Sep 11, 2024

It would help if uBO's header= syntax matched the DNR's HeaderInfo's syntax:

If specified, this condition matches if the header's value matches at least one pattern in this list. This supports case-insensitive header value matching plus the following constructs:
* : Matches any number of characters.
? : Matches zero or one character(s).
* and ? can be escaped with a backslash, e.g. \* and \?

I think uBO could supports the DNR's pattern matching syntax. uBO would still support the regex syntax, which would need to be dropped from the conversion, but plain or pattern-matching syntax would be translated to DNR rule with no special processing.

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Nov 1, 2024

Reference from MDN:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/HeaderInfo

Looks like it's available for chromium now.


Oh sorry, there's reference link from chromium above already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants