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

show eTLD+1 prominently in request panel #12701

Merged
merged 4 commits into from
Mar 31, 2022
Merged

show eTLD+1 prominently in request panel #12701

merged 4 commits into from
Mar 31, 2022

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Mar 22, 2022

Resolves brave/brave-browser#21787

Request panel from dApp now will show full origin with eTLD+1 emphasized

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:

  1. Go to https://app.uniswap.org/#/swap and click Connect Wallet
  2. The eTLD+1 part of the URL should be Bold in the Connect with site panel

Screen Shot 2022-03-23 at 11 18 51 AM

  1. Go to https://app.uniswap.org/#/swap and choose a token to swap, click Allow spend
  2. The eTLD+1 part of the URL should be Bold in the Allow Spend panel

Screen Shot 2022-03-23 at 11 15 09 AM

  1. Go to chainlist.org and connect your wallet, choose a Network to add.
  2. The eTLD+1 part of the URL should be Bold in the Allow Add Network panel

Screen Shot 2022-03-23 at 11 06 54 AM

  1. You should see another prompt to switch networks
  2. The eTLD+1 part of the URL should be Bold in the Allow Switch Network panel

Screen Shot 2022-03-23 at 11 07 06 AM

  1. Open the Wallet Panel and click on the Connected button to get the Site Permissions panel
  2. The eTLD+1 part of the URL should be Bold in the Site Permissions panel

Screen Shot 2022-03-23 at 11 07 22 AM

  1. Go to app.skiff.org and connect your wallet
  2. You will then be prompt to Sign, sign the the transaction
  3. You will then be prompt to provide your public encryption key.
  4. The eTLD+1 part of the URL should be Bold in the Public Encryption Key panel

Screen Shot 2022-03-23 at 1 26 34 PM

  1. Go to http://www.reddit.com______________________________________________.________________________._________ethereum.defiapplication.wormholenetwork.com______________________._.______________wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww.xdv.cz.srv21.endora.cz/metapoc/index.html and connect your wallet
  2. The URL should be wrapped and the eTLD+1 part of the URL should be Bold in the Connect with site panel

Screen Shot 2022-03-23 at 4 43 09 PM

  1. Open the Wallet Panel and click on the Connected button to get the Site Permissions panel
  2. The URL should be wrapped and the eTLD+1 part of the URL should be Bold in the Site Permissions panel

Screen Shot 2022-03-23 at 4 42 47 PM

@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Mar 22, 2022
@diracdeltas
Copy link
Member

lgtm

@darkdh darkdh requested a review from yrliou March 23, 2022 22:12
@darkdh darkdh marked this pull request as ready for review March 23, 2022 22:12
@darkdh darkdh requested a review from a team as a code owner March 23, 2022 22:12
@github-actions github-actions bot added rebase and removed rebase labels Mar 23, 2022
@brave-builds brave-builds force-pushed the request-etld-plus-one branch from 0865cbc to 6b272d5 Compare March 23, 2022 22:15
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@Douglashdaniel Douglashdaniel force-pushed the request-etld-plus-one branch 2 times, most recently from 54d417d to 562e4e2 Compare March 25, 2022 18:10
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Contributor

@josheleonard josheleonard left a comment

Choose a reason for hiding this comment

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

LGTM, other than some useMemo performance gotchas

@@ -122,6 +123,13 @@ const ConnectedPanel = (props: Props) => {

const onClickViewOnBlockExplorer = useExplorer(selectedNetwork)

const showConnectButton = React.useMemo((): boolean => {
if (originInfo.origin) {
return originInfo.origin.startsWith('chrome://')
Copy link
Member

Choose a reason for hiding this comment

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

can this be an exact check for a set of whitelisted origins? i'm wondering why all of chrome:// needs to be whitelisted.

Copy link
Contributor

Choose a reason for hiding this comment

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

While addressing this issue brave/brave-browser#20973 it was decided there is no reason to allow a user to give/remove a Site Permission to chrome:// origins.
cc: @bbondy @srirambv

@@ -135,6 +136,11 @@ bool GetSubRequestOrigin(const GURL& old_origin,
return AddAccountToHost(old_origin, account, new_origin);
}

std::string eTLDPlusOne(const GURL& url) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this one don't belong to ethereum_permission_utils.cc but belong to something more general, like brave_wallet_utils.cc.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in e926740

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

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

Backend overall LGTM, just a few minor comments.

browser/brave_wallet/BUILD.gn Outdated Show resolved Hide resolved
browser/brave_wallet/brave_wallet_service_delegate_impl.cc Outdated Show resolved Hide resolved
@darkdh darkdh force-pushed the request-etld-plus-one branch from e926740 to 3e94a70 Compare March 28, 2022 18:40
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh added this to the 1.39.x - Nightly milestone Mar 29, 2022
@Douglashdaniel Douglashdaniel force-pushed the request-etld-plus-one branch from 3e94a70 to 0bba717 Compare March 30, 2022 17:30
Copy link
Contributor

@josheleonard josheleonard left a comment

Choose a reason for hiding this comment

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

LGTM

@Douglashdaniel Douglashdaniel force-pushed the request-etld-plus-one branch from a369c51 to 91cf091 Compare March 31, 2022 17:40
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[hackerone] show eTLD+1 prominently in wallet
6 participants