Installation and Bot reject ISO 8601 timestamps with a negative UTC offset or a Z suffix
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 4k
- Fork
- 874
- Merge trung bình
- 13 giờ 22 phút
- Pull request đã merge (30 ngày)
- 64
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của slackapi/python-slack-sdk
-
`WebClient` raises `JSONDecodeError` instead of `SlackApiError` on a malformed JSON body when retry handlers are setCó thể đã có người làm @agustin18 đã nhận 13 ngày trước. Đang mởbug semver:major web-client
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
slackapi/python-slack-sdk#2070 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SignatureVerifier.is_valid raises instead of returning False for a malformed timestamp, signature or bodyCó thể đã có người làm @AmyScript đã nhận 12 ngày trước. Đang mởbug security semver:patch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 57/100
slackapi/python-slack-sdk#2067 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 42/100
slackapi/python-slack-sdk#2066 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add missing Web API methods that are documented on docs.slack.dev to WebClientCó thể đã có người làm @zimeg đã nhận 19 ngày trước. Đang mởenhancement web-client
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
slackapi/python-slack-sdk#2014 · 2 bình luận · 2 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chat_postMessage silently forwards thread_id to the API, so a threaded reply posts to the channelCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởauto-triage-skip enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
slackapi/python-slack-sdk#1923 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của slackapi/python-slack-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bad-antics/lateralus-lang#1623 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
fossguild/thelifesnake#82 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Unfitted DialectClassifier crashes with a confusing ValueError: raise a clear "not fitted" errorĐang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
omarelshamy25x/shamy-arabic-nlp#111 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pietbarber/Manage2Soar#1189 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG: write_netcdf fails on Tutorial 3 BEM output with pandas CategoricalDtype DOF coordinatesCó thể đã có người làm @dtgaebe đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
sandialabs/WecOptTool#467 ·