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

Support $match-case option for adblock filters #28194

Closed
antonok-edm opened this issue Feb 1, 2023 · 4 comments · Fixed by brave/brave-core#16951
Closed

Support $match-case option for adblock filters #28194

antonok-edm opened this issue Feb 1, 2023 · 4 comments · Fixed by brave/brave-core#16951

Comments

@antonok-edm
Copy link
Collaborator

antonok-edm commented Feb 1, 2023

Brave's default lists include several $match-case regex filters; the option should be supported by Brave Shields for better compatibility.

Test Plan:

Add the following to brave://settings/shields/filters:

/^https?:\/\/cdn\.[a-z]{4,6}\.xyz\/test\.json/$3p,match-case

Visit https://example.com, open the DevTools panel, and paste each of the following lines into the console:

await fetch('https://cdn.abcdef.xyz/test.json');
await fetch('https://cdn.abcdef.xyz/TEST.JSON');

Without the fix, both will produce a net::ERR_BLOCKED_BY_CLIENT error.

With the fix, the second script should instead produce a net::ERR_NAME_NOT_RESOLVED error.

@MadhaviSeelam
Copy link

MadhaviSeelam commented Feb 8, 2023

Verification PASSED using

Brave | 1.49.90 Chromium: 110.0.5481.77 (Official Build) beta (64-bit)
-- | --
Revision | 65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481@{#839}
OS | Windows 11 Version 21H2 (Build 22000.1455)
  1. Install 1.49.90
  2. launch Brave
  3. open a new-tab page
  4. open brave://settings/shields/filters
  5. add following in the Create custom filters text box
    • /^https?:\/\/cdn\.[a-z]{4,6}\.xyz\/test\.json/$3p,match-case
  6. click Save Changes
  7. visit https://example.com/ in a new tab
  8. open the DevTools panel, and paste each of the following lines separately into the console:
    • await fetch('https://cdn.abcdef.xyz/test.json');
    • await fetch('https://cdn.abcdef.xyz/TEST.JSON');

Confirmed second script (await fetch('https://cdn.abcdef.xyz/TEST.JSON');) produced net::ERR_NAME_NOT_RESOLVED error.

before fix (1.48.158) step 5-6 step 8a step 8b
image image image image

@stephendonner
Copy link

Verification IN-PROGRESS using

Brave 1.49.96 Chromium: 110.0.5481.77 (Official Build) beta (x86_64)
Revision 65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481@{#839}
OS macOS Version 11.7.3 (Build 20G1116)

Steps:

  1. installed 1.49.96
  2. launched Brave
  3. opened a new-tab page
  4. opened brave://settings/shields/filters
  5. added the following in the Create custom filters text box
    /^https?:\/\/cdn\.[a-z]{4,6}\.xyz\/test\.json/$3p,match-case
  6. clicked Save changes
  7. visit https://example.com/ in a new tab
  8. open the DevTools panel, and paste each of the following lines separately into the console:
    await fetch('https://cdn.abcdef.xyz/test.json');
    await fetch('https://cdn.abcdef.xyz/TEST.JSON');

Confirmed second script (await fetch('https://cdn.abcdef.xyz/TEST.JSON';) produced net::ERR_NAME_NOT_RESOLVED error.

steps 5-6 step 8a step 8b
Screen Shot 2023-02-13 at 10 00 24 AM Screen Shot 2023-02-13 at 10 04 48 AM Screen Shot 2023-02-13 at 10 02 27 AM

@LaurenWags LaurenWags added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Feb 28, 2023
@LaurenWags
Copy link
Member

LaurenWags commented Feb 28, 2023

Verified with

Brave	1.49.114 Chromium: 110.0.5481.177 (Official Build) beta (64-bit) 
Revision	f34f7ab2d4ca4ad498ef42aeba4f4eb2c1392d63-refs/branch-heads/5481@{#1239}
OS	Linux

Verified test plan from #28194 (comment).

Reproduced the issue using 1.48.171.

1.48.171 brave://settings/shields/filters 1.49.114
1 48 x Screen Shot 2023-02-28 at 3 13 58 PM 1 49 114

@LaurenWags LaurenWags added QA Pass-Linux and removed QA/In-Progress Indicates that QA is currently in progress for that particular issue labels Feb 28, 2023
@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Mar 7, 2023

Verification PASSED on Samsung Galaxy version 12 running Bravemonoarm64.apk_1.49.118

Verified test plan from #28194 (comment).

Reproduced the issue using 1.48.171.

1.48.171 brave://adblock 1.49.118
image Screenshot_20230307-175313_Brave image

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

Successfully merging a pull request may close this issue.

7 participants