From 6ec4fd7258053e0fbc4341451717dd8dc961aa96 Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Fri, 27 Nov 2026 22:55:24 +0000 Subject: [PATCH] fix: admit bounded receiver telemetry without trusting it --- Tests/test_deployment.py | 9 +++++++++ Tools/Deployment/website_release.py | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Tests/test_deployment.py b/Tests/test_deployment.py index 0686bbb..efef0d1 100644 --- a/Tests/test_deployment.py +++ b/Tests/test_deployment.py @@ -47,6 +47,15 @@ class SignedReleaseTests(unittest.TestCase): def test_external_smoke_target_refused(self): with self.assertRaises(Exception):release.response_bytes('https://example.invalid/',64) def test_valid_compressed_release(self):self.assertEqual(self.verify(self.bundle())['product'],'PlotDirector.Website') + def test_receiver_telemetry_does_not_change_signed_release(self): + bundle=self.bundle();(bundle/'transfer-metrics.json').write_text('{"bytes":0}') + self.assertEqual(self.verify(bundle)['product'],'PlotDirector.Website') + def test_receiver_telemetry_symlink_refused(self): + bundle=self.bundle();(bundle/'transfer-metrics.json').symlink_to(bundle/'authorization.json') + with self.assertRaises(Exception):self.verify(bundle) + def test_receiver_telemetry_size_bounded(self): + bundle=self.bundle();(bundle/'transfer-metrics.json').write_bytes(b'x'*16385) + with self.assertRaises(Exception):self.verify(bundle) def test_wrong_product(self): with self.assertRaises(Exception):self.verify(self.bundle(product='PlotLine')) def test_tampered_payload(self): diff --git a/Tools/Deployment/website_release.py b/Tools/Deployment/website_release.py index 54e4de3..842a39b 100644 --- a/Tools/Deployment/website_release.py +++ b/Tools/Deployment/website_release.py @@ -46,7 +46,12 @@ def prepare(source,output,release,key,public): print(json.dumps(auth)) def verify(source,work,public): source=Path(source).resolve();work=Path(work) - require({p.name for p in source.iterdir()}==BUNDLE,'Unexpected bundle members') + members={p.name for p in source.iterdir()} + require(members in (BUNDLE,BUNDLE|{'transfer-metrics.json'}),'Unexpected bundle members') + # The restricted SSH receiver adds bounded, untrusted telemetry. It cannot + # authorize payloads and is never interpreted as configuration or a hook. + if 'transfer-metrics.json' in members: + snapshot(source/'transfer-metrics.json',work/'untrusted-transfer-metrics.json',16384) for name in ('authorization.json','authorization.sig'):snapshot(source/name,work/name,16384) auth=signed_json(work/'authorization.json',work/'authorization.sig',public) require(auth['format']==1 and re.fullmatch('[a-f0-9]{40}',auth['source_commit']),'Invalid authorization')