Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo: Do not use naive datetimes with tuf API #513

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions repo/tuf_on_ci/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import shutil
import sys
from datetime import datetime
from datetime import UTC, datetime
from filecmp import cmp
from tempfile import TemporaryDirectory
from urllib import request
Expand All @@ -19,7 +19,7 @@


def expiry_check(dir: str, role: str, timestamp: int):
ref_time = datetime.fromtimestamp(timestamp)
ref_time = datetime.fromtimestamp(timestamp, UTC)
md = Metadata.from_file(os.path.join(dir, f"{role}.json"))
expiry = md.signed.expires
if ref_time > expiry:
Expand Down Expand Up @@ -94,7 +94,7 @@ def client(
if time is not None:
# HACK: replace reference time with ours: initial root has been loaded
# already but that is fine: the expiry check only happens during refresh
ref_time = datetime.fromtimestamp(time)
ref_time = datetime.fromtimestamp(time, UTC)
updater._trusted_set.reference_time = ref_time
ref_time_string = f" at reference time {ref_time}"

Expand Down
Loading