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

Add support for ABP filter redirects as mock responses #3419

Merged
merged 4 commits into from
Nov 19, 2019

Conversation

bbondy
Copy link
Member

@bbondy bbondy commented Sep 12, 2019

Fix: brave/brave-browser#6894

Unlike extensions like uBlock, we don't do this via data: URLs.
This means that the response will appear to a website as a 200 with the proper mime type, but with the content we want from the resources JSON file.

See also:
https://github.com/brave/internal/issues/660
brave/adblock-rust#29
brave/adblock-rust#50
brave/adblock-rust-ffi#8
brave/brave-core-crx-packager#74

Submitter Checklist:

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@bbondy bbondy force-pushed the adblock-resources branch 2 times, most recently from 8315b0d to 1de6056 Compare September 17, 2019 13:59
@bbondy bbondy self-assigned this Sep 18, 2019
@bbondy bbondy force-pushed the adblock-resources branch 2 times, most recently from 6dcdec8 to fa91445 Compare November 6, 2019 18:57
@antonok-edm antonok-edm mentioned this pull request Nov 6, 2019
32 tasks
@bbondy bbondy force-pushed the adblock-resources branch 5 times, most recently from f271ca1 to fa4057a Compare November 11, 2019 18:02
@bbondy bbondy marked this pull request as ready for review November 12, 2019 17:35
@bbondy bbondy changed the title WIP: Adblock resources support Adblock resources support Nov 12, 2019
@bbondy bbondy changed the title Adblock resources support Add support for ABP filter redirects as mock responses Nov 12, 2019
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just mentioned a couple of nits.

components/brave_shields/browser/ad_block_service.h Outdated Show resolved Hide resolved
components/brave_shields/browser/adblock_stub_response.cc Outdated Show resolved Hide resolved
@jumde jumde requested a review from fmarier November 12, 2019 20:18
Copy link
Contributor

@pes10k pes10k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in less code i wrote shipping in brave-core, so thats an automatic good thing for product ;)

More seriously, terrific and fantastic :)

browser/net/url_context.h Outdated Show resolved Hide resolved
@iefremov
Copy link
Contributor

LGTM in general, mostly readability and style-related comments

Copy link
Member

@fmarier fmarier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether this is the right PR for this comment, but as far as I can see from https://github.com/brave/brave-core-crx-packager/pull/74/files#diff-90ea3bb8e019a7c1cb21f2332bf78c75R13, we appear to be pulling the scriptlets directly from the uBlock origin repo.

In the security review, @diracdeltas and I manually reviewed all existing scriptlets and then asked for a Brave clone of that repo so that we could review any new ones as they get added.

@antonok-edm
Copy link
Collaborator

@fmarier that directory submodules/uBlock is a git submodule pulled from the Brave fork, not the upstream uBlock repo.

It looks like the URL of the uBlock git archive did end up sneaking through into that PR, but it's not used anywhere and I just filed brave/brave-core-crx-packager#75 to remove it.

Copy link
Member

@fmarier fmarier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarifications @antonok-edm.

@bbondy bbondy force-pushed the adblock-resources branch 2 times, most recently from 7736440 to 7434b24 Compare November 18, 2019 21:39
@bbondy bbondy added CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows and removed CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS labels Nov 19, 2019
@bbondy bbondy removed CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows labels Nov 19, 2019
@bbondy bbondy merged commit 88d1bbf into master Nov 19, 2019
@bbondy bbondy deleted the adblock-resources branch November 19, 2019 17:59
@bbondy bbondy added this to the 1.3.x - Nightly milestone Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for ABP filter redirects as mock responses
7 participants