From ede26cd4229557b4e48d54fbf435f894da1548fd Mon Sep 17 00:00:00 2001 From: Danyang Chen Date: Wed, 2 Dec 2026 13:36:50 +0800 Subject: [PATCH] docs/reuse-audit: record the shipped DSH version and gate the recipe against the pin `shipped-pins.json` still named DSH 0.2.2-rc.1 as the image version while `runtime/ds-bot-upstream.pin.json` pins 0.2.2-rc.5 and the recipe installs exactly that. The inventory in that record was built from the rc.1 tarball (20 files, 76,416 bytes unpacked); the shipped rc.5 tarball is 536 files, 6,230,712 bytes unpacked and was never read file by file. - image_recipe.dsh -> 0.2.2-rc.5, plus dsh_audit_snapshot 0.2.2-rc.1 - audit_status block in the rc.1 record: audited_version, shipped_version, shipped_version_audited false, rc.5 tarball integrity/shasum/size, and a blocker that forbids reading the inventory as an audit of what ships - verify-reuse-audit-pins.py: image_recipe.dsh must equal the pin, the snapshot must name the audited npm version, and the record must not claim the shipped version was audited - tests/test_shipped_licenses.py: same invariants Refs #3493 --- docs/reuse-audit/shipped-pins.json | 29 +++++++++++++++++++--- scripts/verify-reuse-audit-pins.py | 39 +++++++++++++++++++++++++++--- tests/test_shipped_licenses.py | 14 +++++++++++ 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/docs/reuse-audit/shipped-pins.json b/docs/reuse-audit/shipped-pins.json index 9b6de1cf4..fec8cb353 100644 --- a/docs/reuse-audit/shipped-pins.json +++ b/docs/reuse-audit/shipped-pins.json @@ -984,7 +984,27 @@ "gitHead": null, "integrity": "sha512-BCxXCMZDs/VLLh64SwKNw/me7Qx1I7Be4qxWwYVRRm8tJoOB8fL7qg6CmXhSXeUqsKt72t8RaKCX4EN+5nocVg==" } - ] + ], + "audit_status": { + "audited_version": "0.2.2-rc.1", + "shipped_version": "0.2.2-rc.5", + "shipped_version_audited": false, + "shipped_source": "runtime/ds-bot-upstream.pin.json dsh is passed as the DSH_VERSION build-arg by .github/workflows/flybot-runtime-image.yml and installed at runtime/flybot-image/Dockerfile:41", + "audited_npm": { + "tarball": "https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.2-rc.1.tgz", + "file_count": 20, + "unpacked_size_bytes": 76416 + }, + "shipped_npm": { + "tarball": "https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.2-rc.5.tgz", + "integrity": "sha512-cNbp12tLYLUTXaVli7zwwMjzmmEVCD1PRldg4oKtXM4+lFYckcaliMS2PU/FoThB4iAN/fKOSID0nrtRZU4Gjw==", + "shasum": "b540ae0577939a34c43fdc6bf44f034b2de040e5", + "file_count": 536, + "unpacked_size_bytes": 6230712, + "registry_read_date_asia_shanghai": "2026-12-01" + }, + "blocker": "The image installs DSH 0.2.2-rc.5; the file and dependency audit in this record covers 0.2.2-rc.1 (20 files, 76416 bytes unpacked) and 0.2.2-rc.5 (536 files, 6230712 bytes unpacked) was not read file by file. Do not treat this inventory as an audit of what ships, and do not publish a redistributable image." + } }, "vendored_npm_lockfiles": { "runtime/ds-bot-upstream/ds-bot/package-lock.json": { @@ -3139,7 +3159,8 @@ "image_recipe": { "dockerfile": "runtime/flybot-image/Dockerfile", "base": "node:24-bookworm-slim", - "dsh": "0.2.2-rc.1", + "dsh": "0.2.2-rc.5", + "dsh_audit_snapshot": "0.2.2-rc.1", "runtime_apt": [ "ca-certificates", "git", @@ -3161,6 +3182,8 @@ "KaTeX font file attachments were not reviewed file-by-file (KaTeX is listed MIT in DSH notices)", "Whether official Claude Code payloads enter the default image was not proven", "DS-Bot v0.3.6 NOTICE (sha256 4c7d3e4e..., 15557 bytes) was hashed; it was not a complete legal re-read of every new attribution", - "Trademarks and brand assets remain unverified" + "Trademarks and brand assets remain unverified", + "The shipped DSH 0.2.2-rc.5 npm tarball (536 files, 6230712 bytes unpacked, npm integrity sha512-cNbp12tLYLUTXaVli7zwwMjzmmEVCD1PRldg4oKtXM4+lFYckcaliMS2PU/FoThB4iAN/fKOSID0nrtRZU4Gjw==) was not read file by file; this record's file and dependency audit covers 0.2.2-rc.1 only", + "Whether runtime/flybot-image/Dockerfile:102-109 contributes any @deepseek-ai package to the image is unverified: against the vendored tree the same npm command reports 'up to date' and installs none (the five are peerDependencies '*'), so those packages come from the global dsh install and the web profile install" ] } diff --git a/scripts/verify-reuse-audit-pins.py b/scripts/verify-reuse-audit-pins.py index 56a25b284..404b39c1c 100755 --- a/scripts/verify-reuse-audit-pins.py +++ b/scripts/verify-reuse-audit-pins.py @@ -123,9 +123,10 @@ def check_shipped() -> int: errors += 1 else: print(f"OK on-disk {rel}") - npm = ((shipped.get("dsh_0_2_2_rc_1") or {}).get("npm") or {}) - git = ((shipped.get("dsh_0_2_2_rc_1") or {}).get("git") or {}) - kit = ((shipped.get("dsh_0_2_2_rc_1") or {}).get("libreoffice_kit") or {}) + record = shipped.get("dsh_0_2_2_rc_1") or {} + npm = record.get("npm") or {} + git = record.get("git") or {} + kit = record.get("libreoffice_kit") or {} if npm.get("integrity") != DSH_INTEGRITY: print("FAIL: DSH 0.2.2-rc.1 integrity pin drifted") errors += 1 @@ -136,6 +137,38 @@ def check_shipped() -> int: errors += 1 else: print("OK DSH git tag", DSH_TAG_COMMIT, "correspondence still unverified") + pin_path = ROOT / "runtime" / "ds-bot-upstream.pin.json" + if not pin_path.is_file(): + print("FAIL: missing runtime/ds-bot-upstream.pin.json") + errors += 1 + else: + pin_dsh = (json.loads(pin_path.read_text()).get("dsh") or "") + recipe_dsh = ((shipped.get("image_recipe") or {}).get("dsh") or "") + snapshot_dsh = ((shipped.get("image_recipe") or {}).get("dsh_audit_snapshot") or "") + status = record.get("audit_status") or {} + if not pin_dsh: + print("FAIL: upstream pin records no dsh version") + errors += 1 + elif recipe_dsh != pin_dsh: + print(f"FAIL: image_recipe.dsh {recipe_dsh!r} != pin dsh {pin_dsh!r}") + errors += 1 + elif status.get("audited_version") != npm.get("version") or snapshot_dsh != npm.get("version"): + print("FAIL: DSH audit snapshot must name the audited npm version", npm.get("version")) + errors += 1 + elif status.get("shipped_version") != pin_dsh: + print(f"FAIL: DSH audit snapshot shipped_version {status.get('shipped_version')!r} != pin dsh {pin_dsh!r}") + errors += 1 + elif status.get("shipped_version_audited") is not False: + print("FAIL: DSH audit snapshot must not claim the shipped version was audited") + errors += 1 + else: + print( + "OK image recipe DSH", + recipe_dsh, + "matches the pin; audited snapshot", + npm.get("version"), + "records the shipped version as unaudited", + ) if kit.get("license") != LIBREOFFICE_LICENSE or "blocker" not in (kit.get("redistribution") or ""): print("FAIL: libreoffice-kit MPL clearance blocker not recorded") errors += 1 diff --git a/tests/test_shipped_licenses.py b/tests/test_shipped_licenses.py index 7145e8d9b..4916b1d89 100644 --- a/tests/test_shipped_licenses.py +++ b/tests/test_shipped_licenses.py @@ -48,6 +48,20 @@ def test_inventory_records_dsh_pin_mpl_blocker_and_refuses_a_public_image(self): ) self.assertIsNone(npm["gitHead_in_registry_metadata"]) self.assertEqual(npm["direct_dependency_count"], 90) + record = self.shipped["dsh_0_2_2_rc_1"] + recipe = self.shipped["image_recipe"] + pin = json.loads((ROOT / "runtime" / "ds-bot-upstream.pin.json").read_text()) + self.assertEqual(recipe["dsh"], pin["dsh"]) + self.assertEqual(recipe["dsh_audit_snapshot"], npm["version"]) + status = record["audit_status"] + self.assertEqual(status["audited_version"], npm["version"]) + self.assertEqual(status["shipped_version"], pin["dsh"]) + self.assertIs(status["shipped_version_audited"], False) + self.assertEqual( + status["shipped_npm"]["integrity"], + "sha512-cNbp12tLYLUTXaVli7zwwMjzmmEVCD1PRldg4oKtXM4+lFYckcaliMS2PU/FoThB4iAN/fKOSID0nrtRZU4Gjw==", + ) + self.assertIn("0.2.2-rc.5", status["blocker"]) git = self.shipped["dsh_0_2_2_rc_1"]["git"] self.assertEqual(git["commit"], "66491b05e3f05ad35bcdd4f6cd7ed26041d9e3db") self.assertTrue(git["npm_tarball_correspondence"].startswith("unverified"))