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

Implement Verifiable Advertiser Conversions for Brave Ads #7524

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

moritzhaller
Copy link
Contributor

@moritzhaller moritzhaller commented Jan 5, 2021

Resolves brave/brave-browser#13368

Submitter Checklist:

  • There is a ticket for my issue.
  • Used Github auto-closing keywords in the commit message.
  • Wrote a good PR/commit description
  • 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).
  • Requested a security/privacy review as needed.

Reviewer Checklist:

  • 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:

  1. start browser on fresh profile with npm start -- --enable-logging=stderr --vmodule="*/bat-native-ads/*"=6,"*/brave_ads/*"=6,"*/brave_user_model/*"=6,"*/bat_ads/*"=6 --brave-ads-staging --rewards=staging=true --brave-ads-debug

  2. run test site with conversion tag (e.g. <meta name="ad-conversion-id" content="smartbrownfoxes42">) on localhost:8000

  3. add test "untargeted" ad with conversion ID and test key to catalog and inject via proxy, e.g.

 "conversions": [
            {
              "type": "postview",
              "urlPattern": "http://localhost:8000/*",
              "observationWindow": 1,
              "conversionPublicKey": "ofIveUY/bM7qlL9eIkAv/xbjDItFs1xRTTYKRZZsPHI="
            }
          ]
  1. trigger add of segment "untargeted"

  2. navigate to localhost:8000 and verify that a conversion was triggered with logs

[86997:775:0216/065612.681696:VERBOSE1:conversions.cc(412)] Convert creative instance id 4983dc92-09fd-4e5c-94c3-616a4728c1d9 and creative set id 5bdeab83-048f-48a7-9602-a1092ded123c in 0 hours, 3 minutes, 57 seconds at 07:00
[86997:775:0216/065612.684147:VERBOSE6:conversions.cc(306)] Successfully logged conversion event
  1. wait until the confirmation for the conversion event is triggered (time in log above) and verify "envelope" payload via proxy
"envelope": {
"alg": "alg_placeholder",
"ciphertext": "ciphertext_placeholder",
"epk": "epk_placeholder",
"nonce": "nonce_placeholder"
},
  1. Verify that payload can be decrypted via https://github.com/brave-experiments/VAC-Encryption-Envelopes/blob/main/src/advertiser.ts

@moritzhaller moritzhaller changed the title tmp commit Implement Verifiable Advertiser Conversions for Brave Ads Jan 5, 2021
@moritzhaller moritzhaller self-assigned this Jan 5, 2021
@diracdeltas
Copy link
Member

@moritzhaller please open a security review for this when it's ready, thx

@moritzhaller moritzhaller force-pushed the issues/13368 branch 2 times, most recently from 03058a4 to 04f8a48 Compare March 2, 2021 11:10
@orspetol
Copy link
Contributor

orspetol commented Mar 2, 2021

@moritzhaller A note on seeds in this library: Technically TweetNaCL allows you to "pre-seed" if you want; however, I want to avoid this as much as possible to prevent implementors downstream from incorrectly seeding (just let the library call Random).

@moritzhaller
Copy link
Contributor Author

@moritzhaller A note on seeds in this library: Technically TweetNaCL allows you to "pre-seed" if you want; however, I want to avoid this as much as possible to prevent implementors downstream from incorrectly seeding (just let the library call Random).

@orspetol totally agree for future implementations, and as discussed we need to keep the seed in the utils for now to ensure key parity between ads and rewards.

@moritzhaller moritzhaller force-pushed the issues/13368 branch 2 times, most recently from 256f2f7 to cb0f937 Compare March 3, 2021 06:37
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++

@moritzhaller moritzhaller force-pushed the issues/13368 branch 2 times, most recently from a751c1b to be0ef59 Compare March 3, 2021 19:45
@moritzhaller moritzhaller force-pushed the issues/13368 branch 3 times, most recently from abdbabf to 660a65a Compare March 3, 2021 20:16
@moritzhaller moritzhaller force-pushed the issues/13368 branch 2 times, most recently from e278260 to f81def3 Compare March 4, 2021 10:39
Copy link
Collaborator

@kylehickinson kylehickinson left a comment

Choose a reason for hiding this comment

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

iOS lgtm

@moritzhaller moritzhaller force-pushed the issues/13368 branch 2 times, most recently from 378fc28 to d4d822f Compare March 4, 2021 19:32
Copy link
Contributor

@orspetol orspetol left a comment

Choose a reason for hiding this comment

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

LGTM

@moritzhaller moritzhaller force-pushed the issues/13368 branch 3 times, most recently from 175f4fc to adcdfe4 Compare March 5, 2021 07:50
@tmancey
Copy link
Collaborator

tmancey commented Mar 5, 2021

CI failed due to known audit deps

@moritzhaller moritzhaller merged commit 085947c into master Mar 5, 2021
@moritzhaller moritzhaller deleted the issues/13368 branch March 5, 2021 10:04
@moritzhaller moritzhaller added this to the 1.23.x - Nightly milestone Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verifiable Advertiser Conversions
5 participants