Opened on 05/16/2017 at 11:26:34 AM

Closed on 05/16/2017 at 01:26:19 PM

Last modified on 08/02/2017 at 06:30:08 AM

#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"]

Attachments (0)

Change History (6)

comment:1 Changed on 05/16/2017 at 11:27:28 AM by mjethani

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

comment:2 Changed on 05/16/2017 at 11:52:44 AM by kzar

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

comment:3 Changed on 05/16/2017 at 11:53:49 AM by kzar

  • Cc mario added

comment:4 Changed on 05/16/2017 at 01:04:11 PM by abpbot

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

comment:5 Changed on 05/16/2017 at 01:26:19 PM by mjethani

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

comment:6 Changed on 08/02/2017 at 06:30:08 AM by mjethani

  • Blocking 5464 added

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from mjethani.
 
Note: See TracTickets for help on using tickets.