Repository navigation
Fix #648 Option to disable signature verification - #1088
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1088 +/- ##
==========================================
- Coverage 70.16% 69.55% -0.62%
==========================================
Files 13 13
Lines 1257 1281 +24
Branches 369 377 +8
==========================================
+ Hits 882 891 +9
- Misses 305 319 +14
- Partials 70 71 +1
Continue to review full report at Codecov.
|
| next(); | ||
| }; | ||
|
|
||
| export function verifySignatureAndParseRawBody( |
There was a problem hiding this comment.
Wanted to rename the builder method to buildVerificationBodyParserMiddleware internally but we still need to keep exporting this one for backward compatibility
| signingSecret?: HTTPReceiverOptions['signingSecret']; | ||
| endpoints?: HTTPReceiverOptions['endpoints']; | ||
| processBeforeResponse?: HTTPReceiverOptions['processBeforeResponse']; | ||
| requestVerification?: HTTPReceiverOptions['requestVerification']; |
There was a problem hiding this comment.
There may be a better name for this flag. Let me know if you have any suggestions.
There was a problem hiding this comment.
What about signatureVerification? It feels a bit more specific.
There was a problem hiding this comment.
@filmaj That's also an option! But strictly speaking, the validation checks not only the signature but also others like x-slack-request-timestamp: https://api.slack.com/authentication/verifying-requests-from-slack Thus, I'm thinking that "request verification" is slightly more suitable. What do you think?
There was a problem hiding this comment.
I immediately thought of signatureVerification as well. But requestVerification also makes sense to me.
There was a problem hiding this comment.
Thanks for the inputs! OK, let me change the name and see how it looks!
There was a problem hiding this comment.
renamed to signatureVerification ✅
filmaj
left a comment
There was a problem hiding this comment.
LGTM!
Do Bolt or the lower level Slack SDKs have a concept of environments, in the sense of being able to differentiate between a production Slack app, vs. one deployed to a development environment, or even one used in local test suites? The reason I ask is based on the discussion in the original issue, it seems the impetus for this feature is mostly around testing. If testing is the intended use of this feature, perhaps there could be some manner of environment checks in conjunction with this flag to ensure that users don't use this flag for a production application? Just thinking out loud; acceptable answers include "no" 😄
| signingSecret?: HTTPReceiverOptions['signingSecret']; | ||
| endpoints?: HTTPReceiverOptions['endpoints']; | ||
| processBeforeResponse?: HTTPReceiverOptions['processBeforeResponse']; | ||
| requestVerification?: HTTPReceiverOptions['requestVerification']; |
There was a problem hiding this comment.
What about signatureVerification? It feels a bit more specific.
|
@filmaj Thanks for the comment!
This option is indeed useful for testing but the main reason why we decided to add this one in the Java SDK first is, as linked from #648, to support the use cases like having a proxy in front of our server that already checks the Slack signatures: slackapi/java-slack-sdk#689 If the motivation is only for easier testing, we might not add this functionality.
This sounds a good idea but for the above reason, the need to disable the verification in production on the Bolt app side can be valid. We can trust users decisions and have some clear notice in the document like we do for the Java SDK: https://slack.dev/java-slack-sdk/guides/bolt-basics#customize-the-built-in-middleware-list |
|
We are still discussing the naming |
mwbrooks
left a comment
There was a problem hiding this comment.
Looks good to me!
Do we want to update the documentation to mention this new option?
| signingSecret?: HTTPReceiverOptions['signingSecret']; | ||
| endpoints?: HTTPReceiverOptions['endpoints']; | ||
| processBeforeResponse?: HTTPReceiverOptions['processBeforeResponse']; | ||
| requestVerification?: HTTPReceiverOptions['requestVerification']; |
There was a problem hiding this comment.
I immediately thought of signatureVerification as well. But requestVerification also makes sense to me.
|
@seratch thanks for the information and clarification! Much appreciated |
|
Resolved conflicts ✅ |
Summary
This pull request resolves #648 by introducing a new option
signatureVerification: booleaninApp,HTTPReceiver, andExpressReceiver. You can verify if the option works with the following example apps:Requirements (place an
xin each[ ])