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

Ratelimit window creation requests #215

Open
Technifocal opened this issue May 29, 2019 · 1 comment
Open

Ratelimit window creation requests #215

Technifocal opened this issue May 29, 2019 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Technifocal
Copy link

Technifocal commented May 29, 2019

Description of the Feature or Idea

Ratelimit the speed at which sites can create getInfo()/sendInvoice()/makeInvoice() requests if they require opening a window (for example, getInfo(), if pre-approved, should not be ratelimited). In testing, a buggy/malicious site can easily open tens or hundreds of windows.

Existing Example(s) of Feature

Here is an example piece of code to trigger the malicious action:

<html>
	<header>
		<script src="https://unpkg.com/[email protected]/dist/webln.min.js" integrity="sha384-mTReBqbhPO7ljQeIoFaD1NYS2KiYMwFJhUNpdwLj+VIuhhjvHQlZ1XpwzAvd93nQ" crossorigin="anonymous"></script>
		<script>
			async function alertInvoice() {
				var webln = await WebLN.requestProvider();
				var weblnbolt11 = await webln.makeInvoice({defaultAmount: "5", minimumAmount: "1", maximumAmount: "10"});
			}
		</script>
	</header>
	<body>
		<input type="button" onclick="for(var i = 0; i < 15; i++) {alertInvoice();}" value="Click me!" />
	</body>
</html>
@wbobeirne wbobeirne added the bug Something isn't working label Jun 3, 2019
@wbobeirne
Copy link
Member

This should be pretty simple to auto-reject if they call it more than say 2 times per second. Thanks for the test case!

@wbobeirne wbobeirne added the good first issue Good for newcomers label Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants