SignatureVerifier.is_valid raises instead of returning False for a malformed timestamp, signature or body
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 57/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
Start with SignatureVerifier.is_valid() and its existing tests, including test_is_valid_none; the issue names the malformed timestamp, signature, and body cases. Confirm each currently raises, then make sure the tests expect False for all three while preserving the missing-value behavior.
由索引模型根據 Issue 內容生成。
描述
SignatureVerifier.is_valid() (and is_valid_request()) returns False for missing values, but three kinds of malformed input from the request raise instead:
from slack_sdk.signature import SignatureVerifier
v = SignatureVerifier("secret")
v.is_valid("body", "abc", "v0=aa") # ValueError: invalid literal for int() with base 10: 'abc'
v.is_valid("body", "1531420618", "v0=é") # TypeError: comparing strings with non-ASCII characters is not supported
v.is_valid(b"\xff\xfe", "1531420618", "v0=aa") # UnicodeDecodeError (body is decoded before the signature is compared)
(For the last two, use a timestamp inside the 5 minute window.)
The timestamp and signature come straight from the X-Slack-Request-Timestamp and X-Slack-Signature headers, so anyone can send them. In bolt-python, RequestVerification.process calls is_valid directly, so such a request does not get the 401 invalid request response; the exception goes through the generic error path in App.dispatch and ends as a 500.
It is not a way around the check, the request is still rejected. But the method is documented as "Verifies if the given signature is valid" and test_is_valid_none already expects False for missing values, so returning False for these seems to be the intended contract.
I have a small fix with tests (catch the three cases in is_valid and return False). Happy to open a PR if that works for you.
Checked on main at b935494.
- 主要語言
- Python
- 星號
- 4k
- 分支
- 874
- 平均合併
- 13 小時 22 分鐘
- 30 天內合併 PR
- 64
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
slackapi/python-slack-sdk 的其他 Issue
-
`WebClient` raises `JSONDecodeError` instead of `SlackApiError` on a malformed JSON body when retry handlers are set可能已有人在做 @agustin18 於 13 天前認領。 未關閉bug semver:major web-client
難度 2/5 1-3 小時 新手友好度 30/100
slackapi/python-slack-sdk#2070 ·
維護者通常 1 天內回覆
-
難度 3/5 半天 新手友好度 42/100
slackapi/python-slack-sdk#2066 ·
維護者通常 1 天內回覆
-
Add missing Web API methods that are documented on docs.slack.dev to WebClient可能已有人在做 @zimeg 於 19 天前認領。 未關閉enhancement web-client
難度 4/5 3-5 天 新手友好度 35/100
slackapi/python-slack-sdk#2014 · 2 則留言 · 2 個 reaction · 已指派 2 人 ·
維護者通常 1 天內回覆
-
Installation and Bot reject ISO 8601 timestamps with a negative UTC offset or a Z suffix可能已有人在做 @hello-ashleyintech 於 44 天前認領。 未關閉auto-triage-stale bug
slackapi/python-slack-sdk#1989 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
chat_postMessage silently forwards thread_id to the API, so a threaded reply posts to the channel可能重新可做 關聯的 PR 已關閉且未合併。 未關閉auto-triage-skip enhancement
難度 4/5 3-5 天 新手友好度 48/100
slackapi/python-slack-sdk#1923 · 2 則留言 ·
維護者通常 1 天內回覆
查看 slackapi/python-slack-sdk 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
plone/plone.observability#114 ·
維護者通常 1 天內回覆
-
area:docs type:docs
難度 2/5 1-3 小時 新手友好度 68/100
jejjohnson/gauss_flows#246 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
netbox status: needs triage type: feature
難度 2/5 1-3 小時 新手友好度 68/100
netbox-community/netbox#23868 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
emeryberger/CSrankings#15757 ·
維護者通常 9 天內回覆