Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#5248 closed change (fixed)

[abp2blocklist] Use wildcard to match any subdomains

Reported by: mjethani Assignee: mjethani
Priority: P4 Milestone:
Module: Platform Keywords: abp2blocklist
Cc: sebastian, arthur, kzar, mario Blocked By:
Blocking: #5464 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29438577/

Description

Background

Domain restrictions in Adblock Plus filters, specified with the domain option, normally apply to subdomains as well. When abp2blocklist converts these filters into content blocker rules, it translates the domain value into only two variants of the domain, one with and one without the www subdomain.

For example, this filter:

    /ads$domain=example.com

It gets converted into this rule:

{
  "trigger": {
    "url-filter": "^https?://.*/ads",
    "resource-type": [
      "image",
      "style-sheet",
      "script",
      "font",
      "media",
      "raw",
      "document"
    ],
    "if-domain": [
      "example.com",
      "www.example.com"
    ]
  },
  "action": {
    "type": "block"
  }
}

Since content blocker rules already support a wildcard syntax for matching any subdomains, abp2blocklist should use the wildcard syntax to cover any subdomains.

What to change

Remove the addDomainPrefix function and the tldjs dependency that came with it. Instead, simply add a * character in front of the name. e.g. $domain=example.com should get converted to "if-domain": ["*example.com"]

Change History (6)

comment:1 Changed 3 years ago by mjethani

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 3 years ago by kzar

  • Cc sebastian arthur kzar added
  • Keywords abp2blocklist added
  • Priority changed from Unknown to P4
  • Ready set

comment:3 Changed 3 years ago by kzar

  • Cc mario added

comment:4 Changed 3 years ago by abpbot

A commit referencing this issue has landed:
Issue 5248 - Use wildcard to match any subdomains

comment:5 Changed 3 years ago by mjethani

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:6 Changed 2 years ago by mjethani

  • Blocking 5464 added
Note: See TracTickets for help on using tickets.