-
Notifications
You must be signed in to change notification settings - Fork 399
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
HTTPReceiver does not immediately respond to an invalid signature request (no response instead) #1509
Comments
Hi @nirvparekh, thanks for writing in. With the default settings, bolt-js automatically returns HTTP status 401 for you. The behavior should be accepted by the review team. If your app does not work this way, do you customize some settings or implement your own Receiver? |
Hi @seratch, I resubmitted, but still reviewers has rejected. |
We are unable to help you for the review process but one thing that I suggest is to make sure if your app immediately responds with 401 HTTP status (the quickest way is to send an HTTP POST request using curl command). If not, perhaps other factors specific to yours may affect the behavior. |
But how can I send 401 HTTP status, when my app doesn't know what happened? it's not being caught in app.error() as well. |
Could you please provide example snippet how to handle signature mismatch and send 401 HTTP response using Bolt? |
@nirvparekh The following snippet may be helpful to you. curl -XPOST https://{your public domain}/slack/events -d'this data does not matter' -H'x-slack-signature: xxx' -H'x-slack-request-timestamp: '`date '+%s'` -v |
@seratch thanks, but I want example for how to handle this request at NodeJS app. |
@nirvparekh There is nothing special for it. If you use bolt-js, straight-forward configuration like this should work for you. Therefore, I would suggest verifying whether your app correctly returns 401 HTTP status response using the above curl script. If it does not return an HTTP response, there is some factors preventing your bolt-js app from returning the valid response. |
@seratch the app is logging as [warn] instead of [error], and that's why I'm not able to catch in app.error and so in Slack. |
@nirvparekh As you can see here, Bolt automatically returns 401 HTTP status and it does not allow your app.error handlers to customize the behavior as of today. The logging level does not matter in this case. If you see the warn logging with invalid signature plus your app returns 401 HTTP status code immediately, it is an expected and valid behavior. If your app does not work this way, I would suggest you to check what HTTP response your app returns by using the above curl code snippet. The App Directory review team verifies the following points:
There are already many App Directory apps built with bolt-js. As long as you configure your app correctly, the 401 response to invalid signature should be accepted by the review team. I don't have any further guidance here. I hope you will figure out the proper way to run your app soon. |
@seratch I have simply initialized with the Bolt framework. then Bolt should send 401 http code. but the postman is not receiving any response. What I'm missing? |
@nirvparekh When I run the above curl script with my simple bolt-js app, the app immediately returns 401 response as below.
What happens if you run the following scripts with your app? If your app does not return any responses, that is quite different from the situation I am aware of. Also, I would suggest checking how a different simple app works when you send invalid requests. curl -XPOST http://localhost:3000/slack/events -d'this data does not matter' -H'x-slack-signature: xxx' -H'x-slack-request-timestamp: '`date '+%s'` -v
curl -XPOST https://xxx.ngrok.io/slack/events -d'this data does not matter' -H'x-slack-signature: xxx' -H'x-slack-request-timestamp: '`date '+%s'` -v |
@seratch when I hit the |
@nirvparekh Thanks for your response here and I am sorry to say that I had been wrong here. My above testing was done with ExpressReceiver (my bad). ExpressReceiver does not have any issues but as you pointed out, the default HTTPReceiver has the issue that you've been facing. I will come up with a quick fix for it. |
…alid signature request (no response instead)
@seratch thanks a lot man... 👍 |
…nature request (no response instead) (#1528)
Description
My app was in review submission. Reviewers checked if signature verification failure has been handled or not.
In my Nodejs code App initialization, I didn't pass signatureVerification as by default TRUE.
They sent request by dummy signing secrete, and signature verification mismatched and in slack, it shows operation timeout error.
While I logged the output in server, it was showing
[warn] Slack request signing verification failed. Signature mismatch.
How to handle it and show the users proper error message?
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version:
@slack/bolt v3.11.0
node version:
v16.13.2
OS version(s):
Linux Ubuntu 18.4
Steps to reproduce:
Expected result:
The error should be caught in app.error()
Actual result:
The error is not being caught in app.error()
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
The text was updated successfully, but these errors were encountered: