Repository navigation
fix: SslCheck rejected requests with a matching verification token - #1589
Open
sahiljagtap08 wants to merge 1 commit into
Open
sahiljagtap08 wants to merge 1 commit into
sahiljagtap08 wants to merge 1 commit into
Conversation
When an App was built with verification_token, the ssl_check middleware returned 401 for requests whose token matched and 200 for requests whose token did not. A request without a token field raised KeyError. The helper returned True on a match while the caller treated True as an error. - Return the error response only when the token is missing or wrong - Use body.get() so a missing token is rejected instead of crashing - Add sync and async tests covering matching, wrong, and missing tokens
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an
ApporAsyncAppis built withverification_token, theSslCheckmiddleware got the check backwards:ssl_checkrequest whose token matched returned 401tokenfield raisedKeyError, which became a 500The helper returned
Trueon a match, while the caller treatedTrueas the error case. The existing tests never setverification_token, so this was not covered.Changes in
slack_bolt/middleware/ssl_check/:body.get()so a missing token is rejected instead of crashing.Testing
Added
test_ssl_check_with_verification_tokento bothtests/scenario_tests/test_ssl_check.pyandtests/scenario_tests_async/test_ssl_check.py. Each covers a matching token (200), a wrong token (401), and a missing token (401). The sync test fails onmainand passes with this change. Ran./scripts/format.sh,./scripts/lint.sh,./scripts/run_mypy.sh, and the ssl_check test files.Category
Requirements
./scripts/install_all_and_run_tests.shafter making the changes.Fixes #1595