Use `git log` for most recent commit's edit time when writing version.json
What changed, and why it matters
This commit changes how SeedSigner records the 'last edit time' in its version.json file. Previously it scanned all source files for the most recent modification time. Now it runs a git command to use the most recent commit timestamp. The main concern is that it uses os.popen(), which executes a shell command, and does not validate the output. In normal use this is benign, but if an attacker can control the working directory or git executable, it could become a command-injection or misleading-metadata issue. There is no direct evidence this is being exploited.
Treat as a low-priority hygiene issue. Replace os.popen() with subprocess.run() using an explicit argument list and validate the returned ISO-8601 timestamp before writing it to version.json. Ensure the build environment controls PATH and the git executable. No urgent patch is required absent evidence of exploitation.
Security signals we found
Use of os.popen() to execute a shell command
Unvalidated external command output written to JSON metadata
Potential command injection if git binary or PATH is attacker-controlled
Build-time metadata change, not cryptographic or seed-handling code
Evidence from the diff
The patch renames get_last_src_edit() to get_last_edit() and replaces a recursive filesystem scan with os.popen(‘git log -1 –format=%cI’). The output is written directly into version_info[‘last_src_edit’]. The use of os.popen() introduces a subprocess/shell-execution surface, and the result is not parsed or sanitized. The code also raises a generic Exception on failure. The change is build-time tooling, not runtime wallet logic, so the security impact is limited. No CVE, advisory, or vendor security disclosure is present in the supplied materials.
Changed components
src/seedsigner/helpers/version.pySeedSigner OS build-time version.json generationInspect captured patch +10 / −4
diff --git a/src/seedsigner/helpers/version.py b/src/seedsigner/helpers/version.py
index 76be03a..5ae8f07 100644
--- a/src/seedsigner/helpers/version.py
+++ b/src/seedsigner/helpers/version.py
@@ -140,7 +140,7 @@ class Version:
@classmethod
- def get_last_src_edit(cls) -> datetime:
+ def get_last_edit(cls) -> datetime:
"""
Recursively scan the src/ directory for the most recent python file edit time.
"""
@@ -194,11 +194,17 @@ if __name__ == "__main__":
CLI to extract the current version and last edit time and write to `src/seedsigner/version.json`.
Used by the SeedSigner OS build process to generate the version.json file.
+
+ Uses the last git commit time (via `git log`) as the last edit time.
"""
version_info = dict(version=Version.get_version())
- last_edit_dt = Version.get_last_src_edit()
- if last_edit_dt:
- version_info["last_src_edit"] = last_edit_dt.isoformat()
+
+ # Run `git log` in the shell to get the last commit time
+ try:
+ last_commit = os.popen("git log -1 --format=%cI").read().strip()
+ version_info["last_src_edit"] = last_commit
+ except Exception as e:
+ raise Exception("Could not get last commit time from git log.") from e
version_file_path = Version._get_version_file_path()
with open(version_file_path, "w") as f:
Why this scored 14/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.