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 ads status header to all search.brave.com requests. #16023

Merged
merged 6 commits into from
Jan 19, 2023
Merged

Conversation

aseren
Copy link
Collaborator

@aseren aseren commented Nov 18, 2022

Previously, X-Brave-Ads-Enabled: 1 header is added to search.brave.com main frame navigation requests if Brave Ads are enabled. It was implemented here: brave/brave-browser#25430
Now server search side requires to get X-Brave-Ads-Enabled: 1 header with xhr/fetch requests also. And for simplicity, it was decided to send the header with all search.brave.com requests if Brave Ads are enabled.

The X-Brave-Ads-Enabled header description: https://github.com/brave/brave-browser/wiki/Custom-Headers#x-brave-ads-enabled

Resolves brave/brave-browser#26812

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Run Brave browser with fresh profile

  • Open https://search.brave.com
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com
  • type query in the search box and press submit
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com and that a search result ad can be viewed
  • do a search query from Omnibox
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com and that a search result ad can be viewed

Enable Brave Private Ads

  • Open https://search.brave.com
  • make sure that X-Brave-Ads-Enabled: 1 header is presented in requests to search.brave.com
  • type query in the search box and press submit
  • make sure that X-Brave-Ads-Enabled: 1 header is presented in requests to search.brave.com and that a search result ad is not shown
  • do a search query from Omnibox
  • make sure that X-Brave-Ads-Enabled: 1 header is presented in requests to search.brave.com and that a search result ad is not shown

Disable Brave Private Ads

  • Open https://search.brave.com
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com
  • type query in the search box and press submit
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com and that a search result ad can be viewed
  • do a search query from Omnibox
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com and that a search result ad can be viewed

Run browser in Private mode

  • Open https://search.brave.com
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com
  • type query in the search box and press submit
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com and that a search result ad can be viewed
  • do a search query from Omnibox
  • make sure that X-Brave-Ads-Enabled header is not set in requests to search.brave.com and that a search result ad can be viewed

Also need to make sure that this logic is working for dev/staging Brave Search environments. The list of supported hosts is here: hosts

@aseren aseren requested a review from remusao November 18, 2022 19:10
@aseren aseren requested review from iefremov and a team as code owners November 18, 2022 19:10
@github-actions github-actions bot added CI/run-network-audit Run network-audit potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false labels Nov 18, 2022
@aseren aseren changed the title Add ads status header to brave.search.com requests. Add ads status header to all brave.search.com requests. Nov 18, 2022
Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM

@aseren aseren force-pushed the issues/26812 branch 2 times, most recently from 1e73741 to 580ad09 Compare December 16, 2022 19:22
@aseren aseren force-pushed the issues/26812 branch 2 times, most recently from 36b8db3 to 1744cb7 Compare December 20, 2022 17:41
@aseren aseren requested a review from goodov December 21, 2022 03:00
@bridiver bridiver requested a review from pes10k January 3, 2023 19:26
@aseren aseren changed the title Add ads status header to all brave.search.com requests. Add ads status header to all search.brave.com requests. Jan 19, 2023
@aseren aseren merged commit 6d63ffc into master Jan 19, 2023
@aseren aseren deleted the issues/26812 branch January 19, 2023 15:14
@github-actions github-actions bot added this to the 1.49.x - Nightly milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-network-audit Run network-audit potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Brave Ads status header to search.brave.com fetch/xhr requests
7 participants