mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-27 05:17:19 +00:00
fix(security): report truncated OSV downloads and state what a warn verdict means
A truncated chunked OSV download raises http.client.IncompleteRead, an HTTPException rather than an OSError, so it skipped the .part cleanup and the error line; the handler now catches both. The runtime check's warn summary no longer claims the mirror scan tracks every warning, since host findings and images outside the mirror never reach it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
43bef02d2c
commit
20381538dc
3 files changed
+16
-2
No files matched your search
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import http.client
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
@@ -82,6 +83,18 @@ class TestFetchDatabases(_Root):
|
||||
self.assertIn("osv Ubuntu: timed out", errors)
|
||||
self.assertEqual(list(ubuntu.iterdir()), [])
|
||||
|
||||
def test_a_truncated_chunked_osv_download_leaves_no_zip_and_is_reported(self):
|
||||
def fetch(url, destination):
|
||||
destination.write_bytes(b"trunc")
|
||||
raise http.client.IncompleteRead(b"trunc", 1024)
|
||||
|
||||
errors = database.fetch_databases(P, self.root, ["osv"], None, fetch)
|
||||
ubuntu = self.root / "osv" / "osv-scalibr" / "Ubuntu"
|
||||
self.assertTrue(
|
||||
any(error.startswith("osv Ubuntu: IncompleteRead") for error in errors)
|
||||
)
|
||||
self.assertEqual(list(ubuntu.iterdir()), [])
|
||||
|
||||
|
||||
class TestStale(_Root):
|
||||
def test_a_missing_database_is_stale(self):
|
||||
|
||||
Reference in new issue
Block a user