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 dapp detection #2678

Merged
merged 18 commits into from
Jul 18, 2019
Merged

Add dapp detection #2678

merged 18 commits into from
Jul 18, 2019

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Jun 13, 2019

contents script in brave extension detects whether window.web3 is accessed or not
from current tab and sends a message to background script to notify to browser.
When browser gets "braveWallet.dappAvailable", it shows wallet extension install
prompt.

dapp detection originally existed in muon and is similar to https://github.com/brave/browser-laptop/blob/master/app/extensions/brave/content/scripts/dappListener.js

Fix brave/brave-browser#718

Screen Shot 2019-06-17 at 18 08 47

Submitter Checklist:

Test Plan:

yarn test brave_browser_tests --filter=BraveShieldsAPIBrowserTest.DappDetectionTest

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.

@simonhong simonhong self-assigned this Jun 13, 2019
@simonhong simonhong force-pushed the dapp_detection branch 2 times, most recently from f80d7d2 to dddde19 Compare June 17, 2019 07:02
@simonhong simonhong marked this pull request as ready for review June 17, 2019 07:02
@simonhong simonhong force-pushed the dapp_detection branch 3 times, most recently from 4b459f8 to 80faaca Compare June 17, 2019 12:24
@simonhong simonhong added this to the 0.68.x - Nightly milestone Jun 17, 2019
@bsclifton
Copy link
Member

@simonhong is this ready for review? (wasn't sure when I saw the TODOs)

@simonhong
Copy link
Member Author

@bsclifton Yup, it's ready. I added more description about TODOs above :)

@simonhong simonhong requested a review from bridiver as a code owner July 9, 2019 15:02
@bbondy bbondy force-pushed the dapp_detection branch 7 times, most recently from 29b7191 to e492cc2 Compare July 9, 2019 21:43
simonhong and others added 15 commits July 17, 2019 09:05
contents script in brave extension detects whether window.web3 is accessed or not
from current tab and sends a message to background script to notify to browser.
When browser gets "braveShields.dappAvailable", it shows wallet extension install
guide when dapp detection pref is enabled.
Simply loading brave://wallet will install the extension if it's not already installed
Since the permission prompt is properly scoped within the tab, we don't need to check active. And we don't want to check it.

The check for the frameId is just to future proof to make sure a DOS attack is not possible subframes
Thi is so that it can continue to be loaded in the future
It is more clear for what is being done
This is different than chrome.braveWallet being available in the first place
@bbondy bbondy force-pushed the dapp_detection branch 2 times, most recently from b629cac to 26afc11 Compare July 17, 2019 14:27
bridiver
bridiver previously approved these changes Jul 17, 2019
@bbondy
Copy link
Member

bbondy commented Jul 18, 2019

Passes CI on official and non official build runs. Since this feature is gated on a build flag that's only enabled for non official builds, it was needed to check both.

@bbondy bbondy merged commit 48ad51c into master Jul 18, 2019
@bsclifton bsclifton deleted the dapp_detection branch July 22, 2019 07:34
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 Dapp detection
4 participants