From c183635a7f22ce35fd1f112516335c39fe9fd00b Mon Sep 17 00:00:00 2001 From: Roman Sirokov Date: Tue, 13 Oct 2026 16:25:27 +0300 Subject: [PATCH 1/2] test(release): pin the blank key path and the named-but-missing key file Two rules the gate's own docs lean on had no test that could fail. `env_path` strips its value, so a whitespace-only ROCM_CLI_SIGNING_PUBLIC_KEY_PATH is blank and falls through to the inline PEM. `verify_pinned_keys.rs` pins " " and "\t\n" on the Rust side and its doc says the blank case "matches the Python gate exactly", but the gate's own self-test only covered "". Changing `not value.strip()` to `not value` left --self-test green; a padded secret would then resolve to Path(" ") and verify a release against a key that does not exist, while the Rust cross-check still compared the PEM. `resolve_signing_key`'s docstring promises a named key path that does not exist is an error from `verify_signature` rather than a fall-through, and the resolution case leaves its key absent on purpose to lean on that. Nothing drove it through `main`, so deleting the `is_file` check left the whole self-test green. The new case intercepts verification at the subprocess boundary, so the mutant is caught by the run *succeeding* -- the fail-open itself -- rather than by whatever cargo happens to report. Both mutations now fail --self-test. Signed-off-by: Roman Sirokov --- scripts/release_readiness.py | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/scripts/release_readiness.py b/scripts/release_readiness.py index 549558f180..1c7fdc8280 100644 --- a/scripts/release_readiness.py +++ b/scripts/release_readiness.py @@ -775,6 +775,42 @@ def _assert_main_refuses_without_a_key(dist: Path) -> None: ) +def _assert_main_rejects_a_named_missing_key(dist: Path, missing: Path) -> None: + """A named key file that is not there must stop the run, by name. + + `resolve_signing_key`'s docstring promises a path that does not exist is "an + error from `verify_signature`, not a reason to fall through to the next + source", and the resolution case above leaves its key absent on purpose to + lean on that. Nothing drove it through `main`, so deleting the `is_file` + check in `verify_signature` left the whole self-test green: verification + would then hand a nonexistent `--public-key` to `cargo xtask verify` and the + operator would be told their signatures failed, rather than that the key + they named is missing -- or, worse, a future `key_args` change could drop + the flag and verify against the inline PEM instead. + + Verification is intercepted so the mutant is caught here rather than by + whatever `cargo` happens to say: with the check gone this run *succeeds*, + which is precisely the fail-open being pinned. + """ + code, _stdout, stderr, argvs = _run_main_verifying(dist, "--require-signatures") + if code is None: + raise ReadinessError( + "main accepted a --require-signatures run whose signing key path names " + f"a file that does not exist ({missing}); a named key that is absent " + "must fail the run, not be verified against" + ) + if "public key does not exist" not in stderr: + raise ReadinessError( + "main failed, but not on the missing key file -- the case no longer " + f"pins what it claims. stderr was: {stderr.strip()!r}" + ) + if argvs: + raise ReadinessError( + "verification was invoked before the named key was checked for " + f"existence: {argvs!r}" + ) + + def _run_main_verifying( dist: Path, *flags: str, verification_fails: bool = False ) -> tuple[int | None, str, str, list[list[str]]]: @@ -1324,6 +1360,28 @@ def run_self_test(root: Path) -> None: f"expected the key path to win over the inline PEM, got {path_source}" ) + # A whitespace-only path is blank, not a named key: `env_path` strips the + # value, so it falls through to the inline PEM. `verify_pinned_keys.rs` + # (`resolve_ci_public_key`) pins the same shapes on the Rust side and its + # doc says it matches "the Python gate exactly"; without this case that + # claim rests on nothing, and dropping the `.strip()` here would turn a + # padded secret into `Path(" ")` and verify the release against a key + # that does not exist, while Rust still used the PEM. + for blank in (" ", "\t\n"): + blank_key, blank_source = run_with_env( + { + SIGNING_PUBLIC_KEY_ENV: inline_pem, + SIGNING_PUBLIC_KEY_PATH_ENV: blank, + }, + lambda: resolve_signing_key(None), + ) + if blank_key is not None or SIGNING_PUBLIC_KEY_ENV not in blank_source: + raise ReadinessError( + f"a whitespace-only {SIGNING_PUBLIC_KEY_PATH_ENV} ({blank!r}) must " + "fall through to the inline PEM the way verify_pinned_keys.rs " + f"promises, got {blank_key!r} / {blank_source}" + ) + explicit = root / "explicit-public-key.pem" explicit_key, explicit_source = run_with_env( { @@ -1380,6 +1438,17 @@ def run_self_test(root: Path) -> None: } run_with_env(no_key_env, lambda: _assert_main_refuses_without_a_key(gate_dist)) print("release readiness self-test: main refuses without a key ok") + + # Naming a key file that is not there is different from naming none: it + # must stop the run by name rather than fall through to another key. + # `key_path` is the one the resolution case above deliberately never + # created, so this drives the same absent path all the way through `main`. + run_with_env( + {**no_key_env, SIGNING_PUBLIC_KEY_PATH_ENV: key_path}, + lambda: _assert_main_rejects_a_named_missing_key(gate_dist, key_path), + ) + print("release readiness self-test: main rejects a named missing key ok") + # A key that exists on disk, because this case lets the real # `verify_signature` run and it rejects a named key that is not a file. # `key_path` above stays absent on purpose, to pin that a named-but- From 15e22580e0b9056dcfe34d9041ad14c9bc3522c3 Mon Sep 17 00:00:00 2001 From: Roman Sirokov Date: Tue, 13 Oct 2026 16:26:10 +0300 Subject: [PATCH 2/2] docs(ci): stop calling the signing public key a dormant input The env block in release.yml and nightly.yml listed ROCM_CLI_SIGNING_PUBLIC_KEY_PEM under a comment reading "Production trust gate - dormant until the owner sets ROCM_CLI_REQUIRE_PRODUCTION_TRUST". That was true before this change: requiring signatures only checked that a .sig sidecar existed, so the key was unused unless the production-trust gate was switched on. It is not true now. Every readiness step in both workflows passes --require-signatures, and that flag now means the signature must actually verify, so the secret is the trust root every release and nightly depends on. An owner reading the old comment would conclude the secret was unused and could be removed, which would fail every release run - and fail it the hard way, since GitHub expands an unset secret to an empty string that the gate reads as "no key". Move the key out of the dormant block and say plainly that it is required, noting it is the public half only. The remaining four inputs really are dormant, so that comment stays with them. No behaviour change: the env map is identical, only its order and comments move. Signed-off-by: Roman Sirokov --- .github/workflows/nightly.yml | 8 +++++++- .github/workflows/release.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ed4e52cf20..9cd3e4517e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,6 +10,13 @@ permissions: env: CARGO_TERM_COLOR: always + # REQUIRED, not dormant: every readiness step below runs --require-signatures, + # which now means signatures must actually verify, so this is the public key + # the nightly is verified against. Removing or blanking the secret fails every + # nightly run — GitHub expands an unset secret to the empty string, which the + # gate treats as "no key" and rejects. It is the public half only; the private + # signing key stays step-scoped. + ROCM_CLI_SIGNING_PUBLIC_KEY_PEM: ${{ secrets.ROCM_CLI_SIGNING_PUBLIC_KEY_PEM }} # Production trust gate — dormant until the owner sets the repository variable # ROCM_CLI_REQUIRE_PRODUCTION_TRUST (e.g. "1") and provides the trust inputs # below. While the variable is unset/falsy, release_readiness.py skips @@ -18,7 +25,6 @@ env: # enabling the gate, the recipe-index inputs also require a step that # materializes the hosted index + its .sig into the workspace. ROCM_CLI_REQUIRE_PRODUCTION_TRUST: ${{ vars.ROCM_CLI_REQUIRE_PRODUCTION_TRUST }} - ROCM_CLI_SIGNING_PUBLIC_KEY_PEM: ${{ secrets.ROCM_CLI_SIGNING_PUBLIC_KEY_PEM }} ROCM_CLI_METADATA_PUBLIC_KEY_PEM: ${{ secrets.ROCM_CLI_METADATA_PUBLIC_KEY_PEM }} ROCM_CLI_MODEL_RECIPE_INDEX_PATH: ${{ vars.ROCM_CLI_MODEL_RECIPE_INDEX_PATH }} ROCM_CLI_MODEL_RECIPE_INDEX_PUBLIC_KEY_PATH: ${{ vars.ROCM_CLI_MODEL_RECIPE_INDEX_PUBLIC_KEY_PATH }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6415cd23a1..139e4fc4ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,13 @@ permissions: env: CARGO_TERM_COLOR: always + # REQUIRED, not dormant: every readiness step below runs --require-signatures, + # which now means signatures must actually verify, so this is the public key + # the release is verified against. Removing or blanking the secret fails every + # release run — GitHub expands an unset secret to the empty string, which the + # gate treats as "no key" and rejects. It is the public half only; the private + # signing key stays step-scoped. + ROCM_CLI_SIGNING_PUBLIC_KEY_PEM: ${{ secrets.ROCM_CLI_SIGNING_PUBLIC_KEY_PEM }} # Production trust gate — dormant until the owner sets the repository variable # ROCM_CLI_REQUIRE_PRODUCTION_TRUST (e.g. "1") and provides the trust inputs # below. While the variable is unset/falsy, release_readiness.py skips @@ -22,7 +29,6 @@ env: # enabling the gate, the recipe-index inputs also require a step that # materializes the hosted index + its .sig into the workspace. ROCM_CLI_REQUIRE_PRODUCTION_TRUST: ${{ vars.ROCM_CLI_REQUIRE_PRODUCTION_TRUST }} - ROCM_CLI_SIGNING_PUBLIC_KEY_PEM: ${{ secrets.ROCM_CLI_SIGNING_PUBLIC_KEY_PEM }} ROCM_CLI_METADATA_PUBLIC_KEY_PEM: ${{ secrets.ROCM_CLI_METADATA_PUBLIC_KEY_PEM }} ROCM_CLI_MODEL_RECIPE_INDEX_PATH: ${{ vars.ROCM_CLI_MODEL_RECIPE_INDEX_PATH }} ROCM_CLI_MODEL_RECIPE_INDEX_PUBLIC_KEY_PATH: ${{ vars.ROCM_CLI_MODEL_RECIPE_INDEX_PUBLIC_KEY_PATH }}