Installation and Bot reject ISO 8601 timestamps with a negative UTC offset or a Z suffix
維護者通常 1 天內回覆
評估
這個 Issue 還沒有評估資料。
描述
What happens
Installation, Bot and the token rotation code accept installed_at (and *_token_expires_at) as an ISO 8601 string. Strings with a positive offset parse correctly, but a negative offset or a Z suffix raises ValueError:
from slack_sdk.oauth.installation_store import Installation
Installation(
user_id="U111",
installed_at="2021-07-14T03:00:17-05:00",
)
# ValueError: Invalid isoformat string: '2021-07-14T03:00:17-05:00+00:00'
Installation(
user_id="U111",
installed_at="2021-07-14T08:00:17Z",
)
# ValueError: Invalid isoformat string: '2021-07-14T08:00:17Z+00:00' (Python 3.11+)
"2021-07-14T17:00:17+09:00" works, so the result depends on the sign of the offset.
What should happen
Any string datetime.fromisoformat can parse should be accepted. Strings without an offset should keep being treated as UTC.
Root cause
_from_iso_format_to_datetime in slack_sdk/oauth/installation_store/internals.py decides whether a string already has an offset by checking for a + character:
if "+" not in iso_datetime_str:
iso_datetime_str += "+00:00"
return datetime.fromisoformat(iso_datetime_str)
For -05:00 or Z there is no +, so a second offset is appended and parsing fails. Parsing first and setting UTC only when tzinfo is None fixes it, which matches how naive datetime values are already handled in _timestamp_to_type since #1970.
- 主要語言
- 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 天內回覆
-
SignatureVerifier.is_valid raises instead of returning False for a malformed timestamp, signature or body可能已有人在做 @AmyScript 於 12 天前認領。 未關閉bug security semver:patch
難度 2/5 1-3 小時 新手友好度 57/100
slackapi/python-slack-sdk#2067 · 2 則留言 · 已指派 1 人 ·
維護者通常 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 天內回覆
-
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 天內回覆