AccessToken omits `iat` claim despite documentation listing it
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
The report identifies AccessToken._generate_payload() and the base Jwt.payload property as the payload-generation entry points. Read those methods and the Access Token documentation to establish whether iat should be present, then inspect related tests. Done means the maintainers clarify the expected behavior and align the SDK or documentation, with a regression test if the SDK changes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
In twilio-python version 9.12.0, an Access Token generated using AccessToken and SyncGrant does not contain the iat (issued-at) claim.
I inspected the generated JWT payload and the installed SDK source code. The payload contains jti, iss, sub, nbf, exp, and grants, but no iat.
However, Twilio's documentation lists iat among the claims expected in a correctly formed Access Token.
Could the maintainers clarify whether this omission is intentional, and whether the SDK or documentation should be updated for consistency?
I have not demonstrated an authentication or authorization failure. This report is intended to clarify the observed behavior rather than claim a security vulnerability.
Code snippet
import os
import json
import base64
from twilio.jwt.access_token import AccessToken
from twilio.jwt.access_token.grants import SyncGrant
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
api_key = os.environ["TWILIO_API_KEY"]
api_secret = os.environ["TWILIO_API_KEY_SECRET"]
service_sid = os.environ["SYNC_SERVICE_SID"]
token = AccessToken(
account_sid,
api_key,
api_secret,
identity="bb-test-identity",
ttl=600,
)
token.add_grant(SyncGrant(service_sid=service_sid))
jwt = token.to_jwt()
if isinstance(jwt, bytes):
jwt = jwt.decode("utf-8")
payload_part = jwt.split(".")[1]
payload_part += "=" * (-len(payload_part) % 4)
payload = json.loads(base64.urlsafe_b64decode(payload_part))
print("Payload claim names:", sorted(payload.keys()))
print("iat present:", "iat" in payload)
Actual behavior
With twilio-python 9.12.0, the generated Access Token payload did not include iat.
The inspected source shows that AccessToken._generate_payload() adds jti and grants, while the base Jwt.payload property adds iss and exp, and conditionally adds nbf and sub. Neither method explicitly adds iat.
My local Sync tests otherwise behaved as expected: permitted reads succeeded, and unauthorized reads and writes were rejected.
Expected behavior
I expected the SDK's behavior to be consistent with the published Access Token documentation, which describes iat as the token's issue timestamp.
If iat is required, the SDK should include it in the generated payload. If it is optional, the documentation should clarify this distinction.
References:
twilio-python version
9.12.0
Python version
3.14.7
Logs or error messages
No authentication error observed. The issue was identified by inspecting the generated JWT payload and the installed SDK source code. The token payload did not contain an iat claim.
Additional context
Environment: Kali Linux under WSL, using a Python virtual environment.
The Sync service had ACLs enabled. Tests using authorized and unauthorized test identities behaved as expected.
I also inspected the installed SDK's JWT payload-generation methods and found no explicit iat claim generation in those methods.
I have not established a security impact or confirmed that Twilio rejects these tokens. I am requesting clarification about whether this is intentional SDK behavior or a documentation inconsistency.
Could the maintainers clarify the expected behavior and, if appropriate, add a regression test?
- Ngôn ngữ chính
- Python
- Star
- 2.1k
- Fork
- 821
- Merge trung bình
- 9 giờ 33 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Có Dockerfile hoặc 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 twilio/twilio-python
-
Docs: "Handling Exceptions" should mention that network errors are not `TwilioRestException`Có thể đã có người làm @henricop đã nhận 13 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
twilio/twilio-python#986 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Clearer diagnostic when an API Key SID is passed without `account_sid`Có thể đã có người làm @saryeljaramany đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
twilio/twilio-python#985 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TokenPagination.next_page_async() makes a sync request and fails with an async http clientCó thể đã có người làm @sebxt đã nhận 31 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
twilio/twilio-python#976 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AsyncTwilioHttpClient does not JSON-serialize request bodies for application/json endpoints (sync client does) → 400 on JSON-body v2 endpointsCó thể đã có người làm @Steve0x2a đã nhận 77 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
twilio/twilio-python#932 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
twilio/twilio-python#930 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của twilio/twilio-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Harden tools/pr_threads.sh: pass all printed thread fields through the deterministic sanitizerĐang mởarea:cli area:security enhancement priority:medium size:small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
RonaldHensbergen/composable-data-stack#1338 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:stdlib effort:S impact:med platform:linux type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
automated endpoint-dead needs-curation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
almanac-data/climate-almanac#139 ·
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 82/100
UKGovernmentBEIS/inspect_ai#6695 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày