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

Prevent external domains from submitting more than one perm request at once #8148

Merged
merged 1 commit into from
Mar 6, 2020

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Mar 2, 2020

Summary

  • Return an error if an external domain requests permissions while they already have a pending permissions request

Details

I haven't fully decided whether we should do this. Are there legitimate uses for multiple permission requests submitted at once?

Related: #7969 (whichever is merged last will have to be rebased and updated with new tests)

@rekmarks rekmarks requested a review from danjm as a code owner March 2, 2020 00:09
@rekmarks rekmarks changed the title Prevent external origins from submitting more than one perm requests at once Prevent external domains from submitting more than one perm requests at once Mar 2, 2020
@rekmarks rekmarks requested review from danfinlay and Gudahtt March 2, 2020 00:12
@metamaskbot
Copy link
Collaborator

Builds ready [8484c1a]
Page Load Metrics (661 ± 60 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeNotificationfirstPaint379250178
domContentLoaded34982565912560
load35482766112460
domInteractive34882565912560

@rekmarks rekmarks requested a review from whymarrh March 2, 2020 02:52
@rekmarks rekmarks changed the title Prevent external domains from submitting more than one perm requests at once Prevent external domains from submitting more than one perm request at once Mar 2, 2020
@Gudahtt
Copy link
Member

Gudahtt commented Mar 3, 2020

Are there legitimate uses for multiple permission requests submitted at once?

Huh, interesting point 🤔. Maybe? It's conceivable that once we start adding more permissions, a dapp might allow the user to request them one-by-one in the dapp, thus triggering separate permission requests.

@rekmarks
Copy link
Member Author

rekmarks commented Mar 3, 2020

It's conceivable that once we start adding more permissions, a dapp might allow the user to request them one-by-one in the dapp, thus triggering separate permission requests.

Good point. We probably shouldn't restrict that without good reason. If we merge this, we should add an issue making sure that only e.g. duplicate eth_requestAccounts requests are rejected (that being the one that's probably most likely to get spammed).

@danfinlay
Copy link
Contributor

I kinda like it just because it would fundamentally simplify the process of keeping the approval prompt safe. Devs will build interfaces that work well with our approval system, so we can simply avoid the scenario Mark suggested by merging this.

@rekmarks
Copy link
Member Author

rekmarks commented Mar 3, 2020

@danfinlay I think the case Mark described warrants an issue and further discussion (we already talked about it some), but I do agree that this should be merged for now regardless!

@Gudahtt
Copy link
Member

Gudahtt commented Mar 6, 2020

I think I've come around to this idea - it would definitely be simpler. And if we impose this restriction from the start, dapps will be forced to accommodate it.

If we do allow multiple requests to be pending at once, then that raises the question of how to deal with "corrections", or requests that supersede previous ones. That would be a complex flow to handle; if we do nothing, then the user might customize permissions to their liking on the first request, then not remember what the chose the second time they're asked (i.e. we'd want to go the extra mile to show what's changing in order to help the user understand what's going on). If we try to merge the requests, then we risk things updating while the user is reviewing, which is dangerous. We could issue an alert, but that would be clunky. And on top of all of that, we'd still want to have some sort of rate-limiting in place to prevent abuse.

Far simpler to disallow it altogether.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

5 participants