Skip to content

Conversation

@Ponjimon
Copy link
Contributor

@Ponjimon Ponjimon commented Dec 23, 2020

I noticed there is an unnecessary await since verifyKey does not return a promise and while using this, I also noticed that it can stall requests when there is an incoming request with empty signature / timestamp headers.

It is because it throws an error here but that error is never caught, so it never returns the 401 message.

Express (and similar middleware handlers) also do not care about errors on their own, so if you use it the way you do it in the example, it will stall the request if the headers are missing and this error is thrown.

This PR fixes it by just catching the error(s) from verifyKey in the middleware and returning a 401 message instead, as it was supposed to do.

@typpo typpo merged commit c3965c3 into discord:main Dec 23, 2020
@typpo
Copy link
Contributor

typpo commented Dec 23, 2020

Thank you for catching this

@typpo
Copy link
Contributor

typpo commented Dec 23, 2020

Published in v1.3.2

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.

2 participants