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 天内回复