From ee299c0534a1cde08b4406d55f7cde52ee8e9cee Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:40:25 +0200 Subject: [PATCH 01/16] R06: carry host current version in updater process handoff --- .../application_update_process.py | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/runtime_engine/scripture_archive_runtime/application_update_process.py b/runtime_engine/scripture_archive_runtime/application_update_process.py index 6fd50fdc9..75279373e 100644 --- a/runtime_engine/scripture_archive_runtime/application_update_process.py +++ b/runtime_engine/scripture_archive_runtime/application_update_process.py @@ -6,6 +6,8 @@ import subprocess from typing import Callable, Sequence +from .application_update import ApplicationUpdateError, SemVer + class UpdateProcessError(RuntimeError): """Fail-closed updater process orchestration error.""" @@ -24,6 +26,7 @@ class UpdaterProcessPlan: updater_executable: Path installed_executable: Path staging_root: Path + current_version: str parent_pid: int def argv(self) -> tuple[str, ...]: @@ -32,6 +35,8 @@ def argv(self) -> tuple[str, ...]: "--scripture-archive-apply", "--wait-pid", str(self.parent_pid), + "--current-version", + self.current_version, "--installed-executable", str(self.installed_executable), "--staging-root", @@ -76,6 +81,7 @@ def build_updater_process_plan( updater_executable: Path, installed_executable: Path, staging_root: Path, + current_version: str, parent_pid: int | None = None, ) -> UpdaterProcessPlan: """Build a fixed host-side process handoff. @@ -91,6 +97,10 @@ def build_updater_process_plan( updater = _require_plain_file(Path(updater_executable), label="updater executable") installed = _require_plain_file(Path(installed_executable), label="installed executable") staging = _require_plain_directory(Path(staging_root), label="staging root") + try: + SemVer.parse(current_version) + except ApplicationUpdateError as exc: + raise UpdateProcessError("current version must be valid semantic version") from exc if updater.parent != installed.parent: raise UpdateProcessError("updater executable must be packaged beside the installed application") @@ -110,6 +120,7 @@ def build_updater_process_plan( updater_executable=updater, installed_executable=installed, staging_root=staging, + current_version=current_version, parent_pid=effective_parent_pid, ) @@ -155,23 +166,38 @@ def launch_updater_process( return pid -def parse_trusted_updater_argv(argv: Sequence[str]) -> tuple[int, Path, Path]: - """Parse only the fixed updater command generated by ``UpdaterProcessPlan``. +def parse_trusted_updater_argv(argv: Sequence[str]) -> tuple[int, Path, Path, str]: + """Parse only the fixed updater command generated by UpdaterProcessPlan. - This is intentionally not a general CLI parser. Exact positional shape, - marker and flag order are part of the host/updater contract; extra flags or - duplicated options fail closed. The updater must subsequently apply the - same filesystem validation and durable-authority verification as its core. + Exact positional shape, marker and flag order are part of the host/updater + contract. The current version is supplied only by the running packaged host; + extra flags, duplicate options, and malformed semantic versions fail closed. """ values = tuple(argv) - if len(values) != 7: + if len(values) != 9: raise UpdateProcessError("invalid updater command shape") - marker, wait_flag, wait_value, installed_flag, installed_value, staging_flag, staging_value = values + ( + marker, + wait_flag, + wait_value, + version_flag, + current_version, + installed_flag, + installed_value, + staging_flag, + staging_value, + ) = values if marker != "--scripture-archive-apply": raise UpdateProcessError("invalid updater command marker") if wait_flag != "--wait-pid": raise UpdateProcessError("invalid updater wait flag") + if version_flag != "--current-version": + raise UpdateProcessError("invalid updater current-version flag") + try: + SemVer.parse(current_version) + except ApplicationUpdateError as exc: + raise UpdateProcessError("invalid updater current version") from exc if installed_flag != "--installed-executable": raise UpdateProcessError("invalid installed executable flag") if staging_flag != "--staging-root": @@ -186,4 +212,4 @@ def parse_trusted_updater_argv(argv: Sequence[str]) -> tuple[int, Path, Path]: raise UpdateProcessError("invalid installed executable path") if not staging_value or "\x00" in staging_value: raise UpdateProcessError("invalid staging root path") - return parent_pid, Path(installed_value), Path(staging_value) + return parent_pid, Path(installed_value), Path(staging_value), current_version From eda092cda7556297fba535db87f22fb51bec1a16 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:40:47 +0200 Subject: [PATCH 02/16] R06: bind updater runner version to fixed host handoff --- .../scripture_archive_runtime/application_update_runner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime_engine/scripture_archive_runtime/application_update_runner.py b/runtime_engine/scripture_archive_runtime/application_update_runner.py index b923237eb..787d87d08 100644 --- a/runtime_engine/scripture_archive_runtime/application_update_runner.py +++ b/runtime_engine/scripture_archive_runtime/application_update_runner.py @@ -98,7 +98,9 @@ def execute_trusted_updater( if not callable(dependency): raise ApplicationUpdateError(f"{label} is required") - parent_pid, installed_executable, staging_root = parse_trusted_updater_argv(argv) + parent_pid, installed_executable, staging_root, handoff_version = parse_trusted_updater_argv(argv) + if handoff_version != current_version: + raise ApplicationUpdateError("trusted updater current version does not match host handoff") wait_for_exit(parent_pid) result = consume( From 0130964f615ab346b28726d1685f2d663d49e0e8 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:40:50 +0200 Subject: [PATCH 03/16] R06: pass packaged host version to updater plan --- .../scripture_archive_platform/desktop_host/updater_launch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py index c2c19f9dd..841a38f71 100644 --- a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py +++ b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py @@ -33,6 +33,7 @@ def packaged_updater_path(installed_executable: Path) -> Path: def launch_packaged_updater( staging_root: str | os.PathLike[str], *, + current_version: str, current_executable: str | os.PathLike[str] | None = None, verify_same_publisher: PublisherVerifier = verify_same_publisher_authenticode, build_plan: PlanBuilder = build_updater_process_plan, @@ -40,7 +41,7 @@ def launch_packaged_updater( ) -> int: """Verify and launch only the canonical same-publisher sibling updater. - The browser supplies none of these values. The installed executable defaults to + The browser supplies none of these values, including ``current_version``. The installed executable defaults to the currently running packaged process, the updater path is mechanically derived beside it, and the existing Authenticode authority must positively prove that current host and updater share a valid signer before #245's fixed process plan is @@ -67,5 +68,6 @@ def launch_packaged_updater( updater_executable=updater, installed_executable=installed, staging_root=Path(staging_root), + current_version=current_version, ) return launch_process(plan) From 5acf1e5eb531842353d168f97beedcd2e05d7924 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:40:53 +0200 Subject: [PATCH 04/16] R06: bind updater launch to running host version --- .../scripture_archive_platform/desktop_host/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/main.py b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/main.py index ccaa3a57d..b6a4ac055 100644 --- a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/main.py +++ b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/main.py @@ -98,7 +98,10 @@ def main() -> int: ) selector.bind_window(window) pending_layer.bind_apply_execution( - lambda: launch_packaged_updater(staging_root), + lambda: launch_packaged_updater( + staging_root, + current_version=CURRENT_APPLICATION_VERSION, + ), window.destroy, ) logging.info("Starting EdgeChromium WebView; frontend=%s log=%s", front, log_path) From e5788e3a03bfa12c0672be8c6b873f333eef69b1 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:40:56 +0200 Subject: [PATCH 05/16] R06: use running host version in updater entrypoint --- .../desktop_host/updater_main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_main.py b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_main.py index c4d04f1f9..a58f261f9 100644 --- a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_main.py +++ b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_main.py @@ -9,7 +9,6 @@ from scripture_archive_platform.desktop_host.authenticode import ( verify_same_publisher_authenticode, ) -from scripture_archive_platform.desktop_host.version import CURRENT_APPLICATION_VERSION from runtime_engine.scripture_archive_runtime.application_update_process import ( parse_trusted_updater_argv, ) @@ -27,10 +26,10 @@ def _resolve_packaged_installed_sibling( argv: Sequence[str], *, updater_executable: Path, -) -> tuple[Path, Path]: +) -> tuple[Path, Path, str]: """Bind direct invocation to the exact app sibling of this updater executable.""" - _, installed_argument, _ = parse_trusted_updater_argv(tuple(argv)) + _, installed_argument, _, current_version = parse_trusted_updater_argv(tuple(argv)) updater = Path(updater_executable) updater_meta = updater.lstat() if stat.S_ISLNK(updater_meta.st_mode) or not stat.S_ISREG(updater_meta.st_mode): @@ -47,7 +46,7 @@ def _resolve_packaged_installed_sibling( installed = installed_argument.resolve(strict=True) if installed != expected_installed: raise ValueError("installed application is not the canonical updater sibling") - return installed, updater + return installed, updater, current_version def run_updater( @@ -62,13 +61,15 @@ def run_updater( Direct invocation is bound to the exact application sibling mechanically derived from this updater's own executable identity. That installed app and this updater must also share a valid publisher before the runner can consume any apply handoff. - The runner independently verifies installed app versus staged candidate again. + The running host carries its current semantic version in the fixed process handoff, + so an older same-publisher sibling updater remains usable after the app executable updates. + The runner independently revalidates that handoff version and the staged candidate. """ if not callable(execute) or not callable(verifier): return UPDATER_FAILED try: - installed, updater = _resolve_packaged_installed_sibling( + installed, updater, current_version = _resolve_packaged_installed_sibling( tuple(argv), updater_executable=Path(sys.executable if updater_executable is None else updater_executable), ) @@ -76,7 +77,7 @@ def run_updater( return UPDATER_FAILED execute( tuple(argv), - current_version=CURRENT_APPLICATION_VERSION, + current_version=current_version, verify_same_publisher=verifier, ) except Exception: From 0e6d1dfd98d5319fe2e01ed3f8f7bb82408c1f79 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:42:07 +0200 Subject: [PATCH 06/16] R06: regress fixed updater current-version process contract --- .../tests/test_application_update_process.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/runtime_engine/tests/test_application_update_process.py b/runtime_engine/tests/test_application_update_process.py index ddb75ba75..3ddaf1910 100644 --- a/runtime_engine/tests/test_application_update_process.py +++ b/runtime_engine/tests/test_application_update_process.py @@ -5,6 +5,8 @@ import tempfile import unittest +CURRENT_VERSION = "1.0.0" + from scripture_archive_runtime.application_update_process import ( UpdateProcessError, build_updater_process_plan, @@ -39,6 +41,7 @@ def test_build_plan_binds_sibling_packaged_updater_current_pid_and_fixed_argv(se updater_executable=updater, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) self.assertEqual(plan.parent_pid, os.getpid()) self.assertEqual(plan.updater_executable, updater.resolve()) @@ -51,6 +54,8 @@ def test_build_plan_binds_sibling_packaged_updater_current_pid_and_fixed_argv(se "--scripture-archive-apply", "--wait-pid", str(os.getpid()), + "--current-version", + CURRENT_VERSION, "--installed-executable", str(app.resolve()), "--staging-root", @@ -67,6 +72,7 @@ def test_build_plan_rejects_external_updater(self) -> None: updater_executable=external, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) def test_build_plan_rejects_current_app_as_updater(self) -> None: @@ -76,6 +82,7 @@ def test_build_plan_rejects_current_app_as_updater(self) -> None: updater_executable=app, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) def test_build_plan_rejects_symlinked_updater_target_and_staging(self) -> None: @@ -92,6 +99,7 @@ def test_build_plan_rejects_symlinked_updater_target_and_staging(self) -> None: updater_executable=updater_link, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) with self.assertRaisesRegex(UpdateProcessError, "real directory"): build_updater_process_plan( @@ -107,6 +115,7 @@ def test_build_plan_rejects_foreign_parent_pid(self) -> None: updater_executable=updater, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, parent_pid=os.getpid() + 1, ) @@ -116,6 +125,7 @@ def test_launch_is_shell_free_fixed_cwd_and_returns_child_pid(self) -> None: updater_executable=updater, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) seen: dict[str, object] = {} @@ -141,6 +151,7 @@ def test_launch_wraps_process_failure(self) -> None: updater_executable=updater, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) def broken_popen(*args, **kwargs): @@ -155,22 +166,26 @@ def test_parser_accepts_only_fixed_host_contract(self) -> None: updater_executable=updater, installed_executable=app, staging_root=staging, + current_version=CURRENT_VERSION, ) - pid, parsed_app, parsed_staging = parse_trusted_updater_argv(plan.argv()[1:]) + pid, parsed_app, parsed_staging, parsed_version = parse_trusted_updater_argv(plan.argv()[1:]) self.assertEqual(pid, os.getpid()) self.assertEqual(parsed_app, app.resolve()) self.assertEqual(parsed_staging, staging.resolve()) + self.assertEqual(parsed_version, CURRENT_VERSION) def test_parser_rejects_noncanonical_or_extended_commands(self) -> None: invalid_commands = [ (), ("--scripture-archive-apply",), - ("--wrong", "--wait-pid", "1", "--installed-executable", "a", "--staging-root", "b"), - ("--scripture-archive-apply", "--wait-pid", "01", "--installed-executable", "a", "--staging-root", "b"), + ("--wrong", "--wait-pid", "1", "--current-version", CURRENT_VERSION, "--installed-executable", "a", "--staging-root", "b"), + ("--scripture-archive-apply", "--wait-pid", "01", "--current-version", CURRENT_VERSION, "--installed-executable", "a", "--staging-root", "b"), ( "--scripture-archive-apply", "--wait-pid", "1", + "--current-version", + CURRENT_VERSION, "--installed-executable", "a", "--staging-root", From 21bde901280712ad51561dd978ab1191a88d936f Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:42:36 +0200 Subject: [PATCH 07/16] R06: regress updater runner version-handoff consistency --- .../tests/test_application_update_runner.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/runtime_engine/tests/test_application_update_runner.py b/runtime_engine/tests/test_application_update_runner.py index 87a7551eb..25544a08f 100644 --- a/runtime_engine/tests/test_application_update_runner.py +++ b/runtime_engine/tests/test_application_update_runner.py @@ -28,6 +28,7 @@ def _plan(tmp_path: Path): updater_executable=updater, installed_executable=app, staging_root=staging, + current_version="1.0.0", ) @@ -288,6 +289,26 @@ def consume(*args, **kwargs): ) self.assertFalse(consumed) + def test_runner_rejects_version_mismatch_between_api_and_fixed_handoff(self) -> None: + plan = _plan(self.tmp_path) + waited = False + + def wait_for_exit(parent_pid: int) -> None: + nonlocal waited + waited = True + + with self.assertRaisesRegex( + ApplicationUpdateError, + "does not match host handoff", + ): + execute_trusted_updater( + plan.argv()[1:], + current_version="1.0.1", + verify_same_publisher=lambda installed, staged: True, + wait_for_exit=wait_for_exit, + ) + self.assertFalse(waited) + def test_runner_rejects_malformed_command_before_wait_or_consume(self) -> None: waited = False consumed = False From 6cd04e87264d6ff1c6bb5babd5f0e3026b268422 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:42:39 +0200 Subject: [PATCH 08/16] R06: regress packaged host-owned updater version handoff --- .../repair_overlay/tests/test_packaged_updater_host_launch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py index 5c7f5c36a..aa96b9d6e 100644 --- a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py +++ b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py @@ -82,6 +82,7 @@ def build_plan(**kwargs): updater_executable=kwargs["updater_executable"], installed_executable=kwargs["installed_executable"], staging_root=kwargs["staging_root"], + current_version=kwargs["current_version"], parent_pid=41, ) @@ -91,6 +92,7 @@ def launch(plan): pid = launch_packaged_updater( self.staging, + current_version=CURRENT_VERSION, current_executable=self.current, verify_same_publisher=verify, build_plan=build_plan, @@ -102,6 +104,7 @@ def launch(plan): self.assertEqual(self.updater, events[1][1]["updater_executable"]) self.assertEqual(self.current, events[1][1]["installed_executable"]) self.assertEqual(self.staging, events[1][1]["staging_root"]) + self.assertEqual(CURRENT_VERSION, events[1][1]["current_version"]) self.assertEqual("launch", events[2][0]) def test_negative_or_failed_publisher_proof_never_builds_process_plan(self): From 1c0c1fe7364f4828b2c1cabf976d7a8f5bd61942 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:42:42 +0200 Subject: [PATCH 09/16] R06: prove updater survives main-app version advancement --- .../tests/test_packaged_updater_entrypoint.py | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/lanes/dev1/repair_overlay/tests/test_packaged_updater_entrypoint.py b/lanes/dev1/repair_overlay/tests/test_packaged_updater_entrypoint.py index 053dd0a73..5e25bb26f 100644 --- a/lanes/dev1/repair_overlay/tests/test_packaged_updater_entrypoint.py +++ b/lanes/dev1/repair_overlay/tests/test_packaged_updater_entrypoint.py @@ -9,7 +9,7 @@ UPDATER_OK, run_updater, ) -from scripture_archive_platform.desktop_host.version import CURRENT_APPLICATION_VERSION +HOST_CURRENT_VERSION = "0.6.2" class PackagedUpdaterEntrypointTests(unittest.TestCase): @@ -28,11 +28,13 @@ def setUp(self) -> None: def tearDown(self) -> None: self.temp.cleanup() - def argv(self, installed: Path | None = None) -> tuple[str, ...]: + def argv(self, installed: Path | None = None, current_version: str = HOST_CURRENT_VERSION) -> tuple[str, ...]: return ( "--scripture-archive-apply", "--wait-pid", "41", + "--current-version", + current_version, "--installed-executable", str(self.installed if installed is None else installed), "--staging-root", @@ -64,9 +66,33 @@ def verifier(installed: Path, updater: Path) -> bool: self.assertEqual(len(execute_calls), 1) forwarded, kwargs = execute_calls[0] self.assertEqual(forwarded, argv) - self.assertEqual(kwargs["current_version"], CURRENT_APPLICATION_VERSION) + self.assertEqual(kwargs["current_version"], HOST_CURRENT_VERSION) self.assertIs(kwargs["verify_same_publisher"], verifier) + def test_entrypoint_forwards_newer_running_host_version_without_embedded_version_authority(self) -> None: + calls = [] + result = run_updater( + self.argv(current_version="0.7.0"), + execute=lambda argv, **kwargs: calls.append((tuple(argv), kwargs)), + verifier=lambda installed, updater: True, + updater_executable=self.updater, + ) + self.assertEqual(result, UPDATER_OK) + self.assertEqual("0.7.0", calls[0][1]["current_version"]) + + def test_invalid_handoff_version_fails_before_verifier_or_executor(self) -> None: + verified = [] + executed = [] + result = run_updater( + self.argv(current_version="0.7"), + execute=lambda *args, **kwargs: executed.append((args, kwargs)), + verifier=lambda *args: verified.append(args) or True, + updater_executable=self.updater, + ) + self.assertEqual(result, UPDATER_FAILED) + self.assertEqual([], verified) + self.assertEqual([], executed) + def test_existing_noncanonical_installed_target_never_reaches_verifier_or_executor(self) -> None: other = self.install / "Other.exe" other.write_bytes(b"other") From e73d678bb765911feccd90f3b4a445b0a9b66e75 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:43:27 +0200 Subject: [PATCH 10/16] R06: correct updater build version-authority evidence --- lanes/dev1/repair_overlay/packaging/build_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lanes/dev1/repair_overlay/packaging/build_windows.ps1 b/lanes/dev1/repair_overlay/packaging/build_windows.ps1 index af756fee0..99b9fdaa5 100644 --- a/lanes/dev1/repair_overlay/packaging/build_windows.ps1 +++ b/lanes/dev1/repair_overlay/packaging/build_windows.ps1 @@ -196,7 +196,7 @@ $updaterManifest = [ordered]@{ size_bytes = $updaterSize sha256 = $updaterHash git_sha = $actualGitSha - application_version_authority = "scripture_archive_platform.desktop_host.version.CURRENT_APPLICATION_VERSION" + application_version_authority = "host-owned UpdaterProcessPlan.current_version + runner exact-handoff equality" authenticode_authority = "scripture_archive_platform.desktop_host.authenticode.verify_same_publisher_authenticode" } $updaterManifest | ConvertTo-Json -Depth 4 | Set-Content -Encoding utf8 $UpdaterManifestPath From 7e1ac3b31f8eb06ac92f8e1646c49d6a76895b54 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:50:12 +0200 Subject: [PATCH 11/16] R06: complete updater process-plan regression call sites --- runtime_engine/tests/test_application_update_process.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime_engine/tests/test_application_update_process.py b/runtime_engine/tests/test_application_update_process.py index 3ddaf1910..cc95ad137 100644 --- a/runtime_engine/tests/test_application_update_process.py +++ b/runtime_engine/tests/test_application_update_process.py @@ -72,7 +72,7 @@ def test_build_plan_rejects_external_updater(self) -> None: updater_executable=external, installed_executable=app, staging_root=staging, - current_version=CURRENT_VERSION, + current_version=CURRENT_VERSION, ) def test_build_plan_rejects_current_app_as_updater(self) -> None: @@ -82,7 +82,7 @@ def test_build_plan_rejects_current_app_as_updater(self) -> None: updater_executable=app, installed_executable=app, staging_root=staging, - current_version=CURRENT_VERSION, + current_version=CURRENT_VERSION, ) def test_build_plan_rejects_symlinked_updater_target_and_staging(self) -> None: @@ -99,13 +99,14 @@ def test_build_plan_rejects_symlinked_updater_target_and_staging(self) -> None: updater_executable=updater_link, installed_executable=app, staging_root=staging, - current_version=CURRENT_VERSION, + current_version=CURRENT_VERSION, ) with self.assertRaisesRegex(UpdateProcessError, "real directory"): build_updater_process_plan( updater_executable=updater, installed_executable=app, staging_root=staging_link, + current_version=CURRENT_VERSION, ) def test_build_plan_rejects_foreign_parent_pid(self) -> None: From 0d6626c47842fb75cc17b336e6ebc7fd588ae615 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:50:14 +0200 Subject: [PATCH 12/16] R06: supply host version in negative updater-launch regressions --- .../repair_overlay/tests/test_packaged_updater_host_launch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py index aa96b9d6e..d56a1f8c6 100644 --- a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py +++ b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py @@ -116,6 +116,7 @@ def test_negative_or_failed_publisher_proof_never_builds_process_plan(self): with self.subTest(verifier=verifier), self.assertRaises(UpdateProcessError): launch_packaged_updater( self.staging, + current_version=CURRENT_VERSION, current_executable=self.current, verify_same_publisher=verifier, build_plan=lambda **kwargs: built.append(kwargs), From e447e2606e083caa856174456dcecab29a408a3a Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:51:41 +0200 Subject: [PATCH 13/16] R06: reconcile host version handoff with launch-authority hardening --- .../desktop_host/updater_launch.py | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py index 841a38f71..630e1ee15 100644 --- a/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py +++ b/lanes/dev1/repair_overlay/scripture_archive_platform/desktop_host/updater_launch.py @@ -64,10 +64,38 @@ def launch_packaged_updater( if not trusted_updater: raise UpdateProcessError("packaged updater same-publisher authenticity is required") + requested_staging = Path(staging_root) plan = build_plan( updater_executable=updater, installed_executable=installed, - staging_root=Path(staging_root), + staging_root=requested_staging, current_version=current_version, ) + if not isinstance(plan, UpdaterProcessPlan): + raise UpdateProcessError("updater process-plan builder returned an invalid plan") + try: + expected_updater = updater.resolve(strict=True) + expected_installed = installed.resolve(strict=True) + expected_staging = requested_staging.resolve(strict=True) + except OSError as exc: + raise UpdateProcessError("packaged updater launch authority could not be rebound") from exc + if ( + plan.updater_executable != expected_updater + or plan.installed_executable != expected_installed + or plan.staging_root != expected_staging + or plan.current_version != current_version + ): + raise UpdateProcessError("updater process plan changed host-owned launch authority") + try: + launch_trusted = bool( + verify_same_publisher(plan.installed_executable, plan.updater_executable) + ) + except Exception as exc: + raise UpdateProcessError( + "packaged updater authenticity could not be reverified before launch" + ) from exc + if not launch_trusted: + raise UpdateProcessError( + "packaged updater same-publisher authenticity changed before launch" + ) return launch_process(plan) From 24b80ce46e5bfc7023a3f24e51df9e80b1ed052e Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:51:44 +0200 Subject: [PATCH 14/16] R06: regress version authority across hardened updater launch --- .../test_packaged_updater_host_launch.py | 76 +++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py index d56a1f8c6..7e8ea7c27 100644 --- a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py +++ b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py @@ -79,9 +79,9 @@ def verify(current, updater): def build_plan(**kwargs): events.append(("plan", kwargs)) return UpdaterProcessPlan( - updater_executable=kwargs["updater_executable"], - installed_executable=kwargs["installed_executable"], - staging_root=kwargs["staging_root"], + updater_executable=kwargs["updater_executable"].resolve(strict=True), + installed_executable=kwargs["installed_executable"].resolve(strict=True), + staging_root=kwargs["staging_root"].resolve(strict=True), current_version=kwargs["current_version"], parent_pid=41, ) @@ -105,7 +105,74 @@ def launch(plan): self.assertEqual(self.current, events[1][1]["installed_executable"]) self.assertEqual(self.staging, events[1][1]["staging_root"]) self.assertEqual(CURRENT_VERSION, events[1][1]["current_version"]) - self.assertEqual("launch", events[2][0]) + self.assertEqual(("verify", self.current.resolve(), self.updater.resolve()), events[2]) + self.assertEqual("launch", events[3][0]) + + def test_process_plan_cannot_substitute_host_owned_launch_paths(self): + external = self.root / "external-updater.exe" + external.write_bytes(b"external") + launched = [] + + def substituted_plan(**kwargs): + return UpdaterProcessPlan( + updater_executable=external, + installed_executable=kwargs["installed_executable"].resolve(), + staging_root=kwargs["staging_root"].resolve(), + current_version=kwargs["current_version"], + parent_pid=41, + ) + + with self.assertRaisesRegex(UpdateProcessError, "changed host-owned launch authority"): + launch_packaged_updater( + self.staging, + current_executable=self.current, + verify_same_publisher=lambda _current, _updater: True, + build_plan=substituted_plan, + launch_process=lambda plan: launched.append(plan) or 1, + ) + self.assertEqual([], launched) + + def test_process_plan_cannot_substitute_host_owned_current_version(self): + launched = [] + + def substituted_plan(**kwargs): + return UpdaterProcessPlan( + updater_executable=kwargs["updater_executable"].resolve(), + installed_executable=kwargs["installed_executable"].resolve(), + staging_root=kwargs["staging_root"].resolve(), + current_version="9.9.9", + parent_pid=41, + ) + + with self.assertRaisesRegex(UpdateProcessError, "changed host-owned launch authority"): + launch_packaged_updater( + self.staging, + current_version=CURRENT_VERSION, + current_executable=self.current, + verify_same_publisher=lambda _current, _updater: True, + build_plan=substituted_plan, + launch_process=lambda plan: launched.append(plan) or 1, + ) + self.assertEqual([], launched) + + def test_publisher_is_reverified_after_plan_before_launch(self): + verdicts = iter((True, False)) + calls = [] + launched = [] + + def verify(current, updater): + calls.append((current, updater)) + return next(verdicts) + + with self.assertRaisesRegex(UpdateProcessError, "changed before launch"): + launch_packaged_updater( + self.staging, + current_executable=self.current, + verify_same_publisher=verify, + launch_process=lambda plan: launched.append(plan) or 1, + ) + self.assertEqual(2, len(calls)) + self.assertEqual([], launched) def test_negative_or_failed_publisher_proof_never_builds_process_plan(self): for verifier in ( @@ -116,7 +183,6 @@ def test_negative_or_failed_publisher_proof_never_builds_process_plan(self): with self.subTest(verifier=verifier), self.assertRaises(UpdateProcessError): launch_packaged_updater( self.staging, - current_version=CURRENT_VERSION, current_executable=self.current, verify_same_publisher=verifier, build_plan=lambda **kwargs: built.append(kwargs), From 767c1da14292112346710e967569d0ec359ee98d Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:54:26 +0200 Subject: [PATCH 15/16] R06: complete hardened updater launch version call sites --- .../repair_overlay/tests/test_packaged_updater_host_launch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py index 7e8ea7c27..c2ad7b03f 100644 --- a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py +++ b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py @@ -125,6 +125,7 @@ def substituted_plan(**kwargs): with self.assertRaisesRegex(UpdateProcessError, "changed host-owned launch authority"): launch_packaged_updater( self.staging, + current_version=CURRENT_VERSION, current_executable=self.current, verify_same_publisher=lambda _current, _updater: True, build_plan=substituted_plan, @@ -167,6 +168,7 @@ def verify(current, updater): with self.assertRaisesRegex(UpdateProcessError, "changed before launch"): launch_packaged_updater( self.staging, + current_version=CURRENT_VERSION, current_executable=self.current, verify_same_publisher=verify, launch_process=lambda plan: launched.append(plan) or 1, @@ -183,6 +185,7 @@ def test_negative_or_failed_publisher_proof_never_builds_process_plan(self): with self.subTest(verifier=verifier), self.assertRaises(UpdateProcessError): launch_packaged_updater( self.staging, + current_version=CURRENT_VERSION, current_executable=self.current, verify_same_publisher=verifier, build_plan=lambda **kwargs: built.append(kwargs), From 4554ac6bb4ad4d9edbe834bf02845b3024abca1b Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Wed, 30 Sep 2026 15:54:53 +0200 Subject: [PATCH 16/16] R06: regress browser cannot inject updater version authority --- .../repair_overlay/tests/test_packaged_updater_host_launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py index c2ad7b03f..d3dc56f56 100644 --- a/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py +++ b/lanes/dev1/repair_overlay/tests/test_packaged_updater_host_launch.py @@ -281,7 +281,7 @@ def test_browser_payload_cannot_supply_process_or_path_authority(self): response = layer.handle( request( APPLY_AND_RESTART_COMMAND, - {"pid": 1, "updater": r"C:\attacker.exe"}, + {"pid": 1, "updater": r"C:\attacker.exe", "current_version": "0.0.0"}, ) ) self.assertFalse(response["ok"])