| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…thout a signing secret slack_sdk>=3.43.0 validates the signing secret when a SignatureVerifier is constructed, raising "ValueError: signing_secret must not be empty." App.__init__ eagerly builds the RequestVerification middleware (and thus a SignatureVerifier) for every app, including Socket Mode apps that have no signing secret, so those apps now fail to initialize. Construct the SignatureVerifier lazily on first use instead. Request verification is already skipped for Socket Mode requests, so the verifier is never built for them. HTTP requests still require a valid signing secret as before. Fixes #1535 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1541 +/- ##
=======================================
Coverage 91.37% 91.37%
=======================================
Files 228 228
Lines 7279 7285 +6
=======================================
+ Hits 6651 6657 +6
Misses 628 628 ☔ View full report in Codecov by Harness. |
Sorry, something went wrong.
Add sync and async tests confirming that request verification still raises for an HTTP request when the signing secret is empty, so the lazy verifier cannot be weakened into silently accepting unverified requests. Drop the now-redundant explanatory comments. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
HTTP-mode verification — confirming the fix preserves the empty-secret guard Tested the patched build in HTTP mode (socket_mode_enabled: false) with no SLACK_SIGNING_SECRET set. As intended, the request now reaches the middleware and the verifier raises lazily on first use — HTTP requests still require a non-empty signing secret (the behavior the new test_http_request_with_empty_signing_secret_raises tests lock in), so an unconfigured secret surfaces as a clear error rather than being silently accepted: ValueError: signing_secret must not be empty.
127.0.0.1 - - [REDACTED] "POST /slack/events HTTP/1.1" 500 -
DEBUG:slack_bolt.App:Applying slack_bolt.middleware.ssl_check.ssl_check.SslCheck
DEBUG:slack_bolt.App:Applying slack_bolt.middleware.request_verification.request_verification.RequestVerification
ERROR:slack_bolt.App:Failed to run a middleware (error: signing_secret must not be empty.)
Traceback (most recent call last):
File ".../slack_bolt/app/app.py", line 561, in dispatch
resp = middleware.process(req=req, resp=resp, next=middleware_next)
File ".../slack_bolt/middleware/request_verification/request_verification.py", line 51, in process
if self.verifier.is_valid(body, timestamp, signature):
^^^^^^^^^^^^^
File ".../slack_bolt/middleware/request_verification/request_verification.py", line 32, in verifier
self._verifier = SignatureVerifier(signing_secret=self._signing_secret)
File ".../slack_sdk/signature/__init__.py", line 29, in __init__
self.signing_secret = signing_secret
File ".../slack_sdk/signature/__init__.py", line 41, in signing_secret
raise ValueError("signing_secret must not be empty.")
For Socket Mode (the original #1535 report), the verifier is never constructed and the app starts cleanly. ✅ |
Sorry, something went wrong.
|
HTTP-mode verification — with SLACK_SIGNING_SECRET set The complement to the previous comment: same HTTP setup, but with a valid signing secret configured. The full middleware chain applies cleanly and the verifier builds without error — no regression to HTTP request verification: DEBUG:slack_bolt.App:Applying slack_bolt.middleware.ssl_check.ssl_check.SslCheck DEBUG:slack_bolt.App:Applying slack_bolt.middleware.request_verification.request_verification.RequestVerification DEBUG:slack_bolt.App:Applying slack_bolt.middleware.authorization.single_team_authorization.SingleTeamAuthorization DEBUG:slack_bolt.App:Applying slack_bolt.middleware.ignoring_self_events.ignoring_self_events.IgnoringSelfEvents DEBUG:slack_bolt.App:Applying slack_bolt.middleware.url_verification.url_verification.UrlVerification DEBUG:slack_bolt.App:Applying slack_bolt.middleware.attaching_function_token.attaching_function_token.AttachingFunctionToken |
Sorry, something went wrong.
|
Socket Mode verification — the original #1535 case Confirming Socket Mode (socket_mode_enabled: true) with no signing secret, on slack_sdk==3.43.0 — the exact reproduction from the issue. With the patch, the verifier is never constructed (request verification is skipped for Socket Mode), and the app starts and connects cleanly. No more ValueError: signing_secret must not be empty. ✅ |
Sorry, something went wrong.
There was a problem hiding this comment.
Left a minor comment on the comment but I think this is good to ship 💯 🚀
Sorry, something went wrong.
| def test_http_request_with_empty_signing_secret_raises(self): | ||
| middleware = RequestVerification(signing_secret="") | ||
| req = BoltRequest(body="payload={}", headers={}) | ||
| resp = BoltResponse(status=404) | ||
| with pytest.raises(ValueError): | ||
| middleware.process(req=req, resp=resp, next=next) |
There was a problem hiding this comment.
Nice 💯
Sorry, something went wrong.
| def test_socket_mode_request_skips_verification_without_signing_secret(self): | ||
| middleware = RequestVerification(signing_secret="") | ||
| req = BoltRequest(mode="socket_mode", body="payload={}", headers={}) | ||
| resp = BoltResponse(status=404, body="default") | ||
| resp = middleware.process(req=req, resp=resp, next=next) | ||
| assert resp.status == 200 | ||
| assert resp.body == "next" |
There was a problem hiding this comment.
Praise 🚀
Sorry, something went wrong.
Co-authored-by: William Bergamin <wbergamin@salesforce.com>
|
@WilliamBergamin Immense thanks for the help getting this out - let's merge for a release🚢 💨 |
Sorry, something went wrong.
Sorry, something went wrong.
|
@zimeg, is it now mandatory to pass in the 2nd argument token_verification_enabled=False without a signing_secret? Will self.app = App(token=SLACK_BOT_TOKEN) not work anymore? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This pull request fixes a regression where a Socket Mode app fails to initialize with ValueError: signing_secret must not be empty. when running on slack_sdk>=3.43.0.
Fixes #1535
Testing
This is an init-time regression that only reproduces against slack_sdk>=3.43.0 (the version range bolt-python already allows; CI may resolve an earlier patch). To reproduce and verify manually:
Category
Requirements