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

Use gin to add braveSkus handler #13645

Merged
merged 3 commits into from
Jun 18, 2022
Merged

Use gin to add braveSkus handler #13645

merged 3 commits into from
Jun 18, 2022

Conversation

spylogsster
Copy link
Contributor

@spylogsster spylogsster commented Jun 7, 2022

Resolves brave/brave-browser#20437

  • Refactored skus js handler to use gin
  • Added overwrite protection
  • Added tests
  • Made skus origin list configurable by moving it to the browser process and pass via brave_renderer_configuration

Security review https://github.com/brave/security/issues/907

image

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:

  • Try to enable VPN with clean profile

@spylogsster spylogsster requested a review from bsclifton June 7, 2022 12:34
@spylogsster spylogsster self-assigned this Jun 7, 2022
@spylogsster spylogsster force-pushed the brave-20437 branch 3 times, most recently from 84b4af0 to b9958e0 Compare June 7, 2022 12:38
@spylogsster spylogsster marked this pull request as draft June 7, 2022 17:38
@spylogsster spylogsster changed the title Use gin to add braveSkus handler wip: Use gin to add braveSkus handler Jun 7, 2022
@spylogsster spylogsster marked this pull request as ready for review June 7, 2022 19:31
@spylogsster spylogsster changed the title wip: Use gin to add braveSkus handler Use gin to add braveSkus handler Jun 7, 2022
@github-actions github-actions bot added rebase and removed rebase labels Jun 7, 2022
@spylogsster spylogsster added this to the 1.41.x - Nightly milestone Jun 7, 2022
@github-actions github-actions bot removed the rebase label Jun 7, 2022
@spylogsster spylogsster force-pushed the brave-20437 branch 6 times, most recently from dea9eda to a2382a7 Compare June 8, 2022 19:01
@diracdeltas
Copy link
Member

native implementation lgtm, note that it's still overrideable if it's part of window.chrome because window.chrome can be redefined to be anything. is this a problem?

@spylogsster spylogsster force-pushed the brave-20437 branch 3 times, most recently from 5c1a3c9 to b22e7bf Compare June 9, 2022 18:55
@spylogsster
Copy link
Contributor Author

native implementation lgtm, note that it's still overrideable if it's part of window.chrome because window.chrome can be redefined to be anything. is this a problem?

chrome exists at the time of call mostly but I wrapped it to be non-writable too

@diracdeltas
Copy link
Member

i'm curious what is the output of https://portswigger-labs.net/hackability/inspector/?input=chrome.braveSkus with this PR; cc @thypon
is there a build we can try on M1 macos?

started https://ci.brave.com/job/test-brave-browser-build-macos-arm64/182/

thx, i downloaded this but seems chrome.braveSkus is undefined even after enabling the sku flags in brave://flags/ - is there something else i have to do?

@spylogsster spylogsster force-pushed the brave-20437 branch 2 times, most recently from 08e5613 to 8a6fee4 Compare June 16, 2022 06:54
@spylogsster
Copy link
Contributor Author

spylogsster commented Jun 16, 2022

thx, i downloaded this but seems chrome.braveSkus is undefined even after enabling the sku flags in brave://flags/ - is there something else i have to do?

Need to enable vpn and 2 skus flags, please pay attention I reworked test via the RenderViewTest and it allowed to keep urls hardcoded inside the renderer process as it was initially. Restarted new build with this changes if required https://ci.brave.com/job/test-brave-browser-build-macos-arm64/183/ cc @diracdeltas @bsclifton

@diracdeltas
Copy link
Member

lgtm, what origins do we plan on having chrome.braveSkus available on? only account.brave.com and its staging origins?

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

++ on changes since I last viewed (ex: InitWithFeatures adding SKU to test 😄)

@spylogsster spylogsster merged commit f1dd849 into master Jun 18, 2022
@spylogsster spylogsster deleted the brave-20437 branch June 18, 2022 10:02
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.

Move window.chrome.braveSkus to use gin
4 participants