Opened on 08/20/2018 at 11:51:58 AM
Closed on 09/04/2018 at 03:39:10 PM
Last modified on 10/24/2018 at 02:12:10 PM
#6868 closed defect (fixed)
Rewrite filter with wildcard doesn't match end of URL
Reported by: | mjethani | Assignee: | mjethani |
---|---|---|---|
Priority: | P3 | Milestone: | |
Module: | Core | Keywords: | |
Cc: | jsonesen, hfiguiere, kzar | Blocked By: | |
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | yes | Confidential: | no |
Tester: | Ross | Verified working: | yes |
Review URL(s): |
Description (last modified by mjethani)
Environment
ABP development build as of changeset a87d009836da
All filter lists disabled
How to reproduce
- Add the filter &trackingId=*$rewrite= on the options page
- Load the HTML <iframe src="https://example.com/?foo=bar&trackingId=123"></iframe>
- Observe the network requests for the page in DevTools
Observed behaviour
The frame's URL is rewritten to https://example.com/?foo=bar123
Expected behaviour
The frame's URL is rewritten to https://example.com/?foo=bar
Additional notes
This happens because the wildcard at the end of the URL pattern is ignored since it is considered to be redundant. While this is true for most blocking filters, the wildcard should not be ignored for filters containing the $rewrite option.
Hints for testers
Check for the expected behavior above.
Additionally, make sure that blocking filters with no $rewrite= option, both with and without leading and trailing wildcards, are working. For example, *foo* should block http://example.com/foo/bar.
Attachments (0)
Change History (10)
comment:2 Changed on 08/20/2018 at 11:53:21 AM by mjethani
- Cc jsonesen hfiguiere kzar added
comment:3 Changed on 08/24/2018 at 03:46:45 PM by mjethani
comment:4 Changed on 08/24/2018 at 04:44:07 PM by mjethani
- Owner set to mjethani
- Review URL(s) modified (diff)
comment:5 Changed on 08/24/2018 at 04:44:20 PM by mjethani
- Status changed from new to reviewing
comment:6 Changed on 08/24/2018 at 04:44:30 PM by mjethani
- Ready set
comment:7 Changed on 09/04/2018 at 03:38:04 PM by abpbot
A commit referencing this issue has landed:
Issue 6868 - Enable capturing of surrounding wildcards for rewrite filters
comment:8 Changed on 09/04/2018 at 03:39:10 PM by mjethani
- Resolution set to fixed
- Status changed from reviewing to closed
comment:10 Changed on 10/24/2018 at 02:12:10 PM by Ross
- Tester changed from Unknown to Ross
- Verified working set
Done. Working as described.
ABP 3.3.2.2175
Firefox 62 / 51 / Windows 10
Chrome 69 / 49 / Windows 10
Opera 56 / 36 / Windows 10
The first question to answer here is whether we even need the optimizations for leading and trailing wildcards. I wrote this little test to find out:
If we change the regular expression from aa to .*aa.*, there is a significant negative effect on the performance. Indeed we should keep the optimizations.