py/bitbox02: list_backups returns tz aware timestamps
What changed, and why it matters
This commit fixes a timezone display bug in the Python library and demo script for the BitBox02 hardware wallet. Backup timestamps were being returned without timezone information, so Python treated them as local time and could show the wrong time to the user. The fix makes the timestamps explicitly UTC. There is no security vulnerability here—only a user-interface accuracy issue.
No security action required. Treat as a routine bugfix/UI correction.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change replaces datetime.utcfromtimestamp() with datetime.fromtimestamp(…, timezone.utc) in list_backups(), so returned datetime objects are timezone-aware UTC. The send_message.py demo script is updated to use astimezone() instead of localize() on an already-UTC-aware datetime. This corrects timestamp display but does not alter firmware behavior, cryptography, authentication, or device integrity checks.
Changed components
py/bitbox02/bitbox02/bitbox02/bitbox02.pypy/send_message.pyInspect captured patch +5 / −5
diff --git a/py/bitbox02/CHANGELOG.md b/py/bitbox02/CHANGELOG.md
index e277e2e..a1fcd1e 100644
--- a/py/bitbox02/CHANGELOG.md
+++ b/py/bitbox02/CHANGELOG.md
@@ -1,10 +1,10 @@
# Changelog
## [Unreleased]
-
-# 7.1.0
- Add `btc_xpubs()` to fetch multiple xpubs at once
- Bitcoin: add support for OP_RETURN outputs
+- Add `change_password()`
+- Backups: return non-naive timestamps with UTC timezone
# 7.0.0
- get_info: add optional device initialized boolean to returned tuple
diff --git a/py/bitbox02/bitbox02/bitbox02/bitbox02.py b/py/bitbox02/bitbox02/bitbox02/bitbox02.py
index ebe3f7f..007f042 100644
--- a/py/bitbox02/bitbox02/bitbox02/bitbox02.py
+++ b/py/bitbox02/bitbox02/bitbox02/bitbox02.py
@@ -5,7 +5,7 @@
import os
import sys
import time
-from datetime import datetime
+from datetime import datetime, timezone
from typing import Optional, List, Dict, Tuple, Any, Generator, Union, Sequence
from typing_extensions import TypedDict
@@ -240,7 +240,7 @@ class BitBox02(BitBoxCommonAPI):
request.list_backups.CopyFrom(backup.ListBackupsRequest())
response = self._msg_query(request, expected_response="list_backups")
for info in response.list_backups.info:
- utcdate = datetime.utcfromtimestamp(info.timestamp)
+ utcdate = datetime.fromtimestamp(info.timestamp, timezone.utc)
yield (info.id, info.name, utcdate)
def restore_backup(self, backup_id: str) -> None:
diff --git a/py/send_message.py b/py/send_message.py
index 6875806..c5baaf2 100755
--- a/py/send_message.py
+++ b/py/send_message.py
@@ -243,7 +243,7 @@ class SendMessage:
return
fmt = "%Y-%m-%d %H:%M:%S %z"
for i, (backup_id, backup_name, date) in enumerate(backups):
- date = local_timezone.localize(date)
+ date = date.astimezone(local_timezone)
date_str = date.strftime(fmt)
print(f"[{i+1}] Backup Name: {backup_name}, Time: {date_str}, ID: {backup_id}")
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.