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

Hiding rules are unable to specify to only block on the core domain and none of the subdomains (e.g. ~*.example.org doesn't work) #3291

Closed
9 tasks done
DandelionSprout opened this issue Jul 6, 2024 · 2 comments
Labels
declined declined enhancement New feature or request

Comments

@DandelionSprout
Copy link

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is NOT a YouTube, Facebook or Twitch report. These sites MUST be reported by clicking their respective links.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

Essentially, a syntax like ~*.example.org is listed in uBO's resource viewer as being an incorrect syntax, although there are cases where such a syntax would've made sense to support. In particular, if I want to only cover a main domain and not any of its subdomains at all, I presumed example.org,~*.example.org##(...) would work, but at the time of writing it doesn't.

While not all sites out there would benefit from that syntax because they always prefix www. to their regular domain, there are a fair few major sites that don't prefix such. Major examples I know of at the time of writing are imgur.com and wolt.com

Screenshot of the resource viewer:

image

A specific URL where the issue occurs.

Unfortunately it'd be a bit self-incriminating for me to list an exact URL, but since I've got no other viable choice, testers can add https://raw.githubusercontent.com/DandelionSprout/adfilt/b862f695ce847da6faf1a2f69231b5edca9227e4/a.txt as a custom list, use the "Error: n" counter on top of the resource viewer to scroll down, and ignore virtually everything else about that list.

Steps to Reproduce

  1. Add example.org,~*.example.org##.JohnMadden to "My Filters"
  2. See that "My Filters" mark ~*.example.org in red with the hover note "Invalid filter: Bad domain name"

Expected behavior

That a method would exist to only have a hiding rule apply to a core domain and none of its subdomains. My ideas are either:

  1. example.org,~*.example.org##(...)
  2. |example.org##(...)

Actual behavior

The error situations listed and screenshot above.

uBO version

1.58.1b11

Browser name and version

Chrome 126.0.6478.127 x64

Operating System and version

Windows 11 23H2 x64, with all monthly 23H2 updates installed since

@garry-ut99
Copy link

garry-ut99 commented Jul 6, 2024

https://github.com/gorhill/uBlock/wiki/Static-filter-syntax :
https://github.com/uBlockOrigin/uBlock-issues/wiki/Static-filter-syntax#hostname-regex :

Starting with 1.46.1b15, you can use regex-based values as target domain for static extended filters. Example of usage: /img[a-z]{3,5}\.buzz/##+js(nowoif). Use sparingly, when no other solution is practical from a maintenance point of view -- keeping in mind that uBO has to iterate through all the regex-based values, unlike plain hostname or entity-based values which are mere lookups.

example.org,~*.example.org##.JohnMadden = /^example\.org$/##.JohnMadden

can also be combined with normal names and entities: /^example\.org$/,somesite.org,somesite2.*##h1
or matching example.org + www.example.org: /^(?:www\.)?example\.org$/##h1

@gorhill
Copy link
Member

gorhill commented Jul 6, 2024

As pointed out by @garry-ut99, use the regex syntax.

@gwarser gwarser added enhancement New feature or request declined declined labels Jul 6, 2024
@gwarser gwarser closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
declined declined enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants