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
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

## v0.15.1

This point release fixes a bug introduced in 0.15.

* Fixed datetime handling in test-repository (#512): This
is fallout from python-tuf upgrade in 0.15.0 and resulted in
unexpected test-repository action failure

## v0.15.0

* Fixed repository status page HTML rendering (#430)
Expand Down
2 changes: 1 addition & 1 deletion repo/tuf_on_ci/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.15.0"
__version__ = "0.15.1"
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
2 changes: 1 addition & 1 deletion signer/tuf_on_ci_sign/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from tuf_on_ci_sign.import_repo import import_repo
from tuf_on_ci_sign.sign import sign

__version__ = "0.15.0"
__version__ = "0.15.1"

__all__ = ["delegate", "import_repo", "sign"]
Loading