[SDK] Stamp generated certificates with aware UTC datetimes - #154
Merged
Merged
Conversation
datetime.utcnow() returns a naive datetime holding UTC numbers, which reads as local time to anything that later calls .timestamp() on it — a silent offset equal to the host's UTC offset, invisible on a UTC machine. Python 3.12 already warns on it, and cryptography has been steering callers off naive datetimes, so certificate generation would eventually stop working rather than merely warn. Nothing changes today: cryptography treats a naive datetime as UTC, and utcnow() supplied UTC numbers, so the two mistakes cancelled. Verified under TZ=America/New_York with -W error::DeprecationWarning that generation is silent and that both certificates carry aware UTC bounds, a 1825-day span, and a signature that verifies against the CA. Signed-off-by: Honglin Cao <hocao@nvidia.com>
V2arK
force-pushed
the
honglin/aware-cert-datetimes
branch
from
September 17, 2026 14:43
9fed11d to
97b9e51
Compare
anandj91
approved these changes
Sep 17, 2026
Contributor
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
datetime.utcnow()returns a naive datetime holding UTC numbers. Anything thatlater calls
.timestamp()on such a value gets it interpreted as local time, sothe result is off by the host's UTC offset — silently, and invisibly on a UTC
machine:
Python 3.12 already emits a
DeprecationWarningfor it, andcryptographyhasbeen steering callers off naive datetimes, so certificate generation would
eventually fail rather than merely warn.
No behaviour change today
cryptographytreats a naive datetime as UTC, andutcnow()supplied UTCnumbers, so the two mistakes cancelled out. This only removes the coincidence.
Test plan
generate_ca_client_triplet()run underTZ=America/New_Yorkwith-W error::DeprecationWarning, so any surviving warning fails the check:DeprecationWarningraised under-W error2026-09-17T14:42:14+00:00..2031-09-16T14:42:14+00:00,tzinfo=UTCtzinfo=UTCnotBefore