@rightkit/release 0.6.52 → 0.6.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/adapter-env.mjs +16 -105
- package/admission-host.mjs +14 -1
- package/bin/darwin/rightkit-swap +0 -0
- package/bin/rightkit-gate.mjs +585 -404
- package/broker-admission.mjs +122 -2
- package/build-launch.mjs +52 -58
- package/build-release.mjs +2 -2
- package/cargo-ledger.mjs +24 -5
- package/cargo-target-shim.mjs +54 -23
- package/cargo-target.mjs +2 -2
- package/carried-adapter-run.mjs +7 -8
- package/carried-cargo-run.mjs +1 -1
- package/ci-compile-admission.mjs +1 -1
- package/clippy-route.mjs +65 -18
- package/compile-inputs.mjs +91 -15
- package/cross-targets.mjs +5 -3
- package/deps-cargo-lock.mjs +1 -1
- package/deterministic-scans.mjs +789 -259
- package/development.mjs +33 -7
- package/direct-receipt.mjs +3 -5
- package/feature-coverage.mjs +45 -9
- package/feature-partition.mjs +204 -0
- package/feature-sets.mjs +113 -0
- package/gate-acceptance.mjs +187 -115
- package/gate-seam.mjs +352 -0
- package/gate-serve.mjs +34 -2
- package/gate-stages.mjs +6 -2
- package/ghsa-audit.mjs +19 -4
- package/heavy-command.mjs +5 -4
- package/install-tauri-authenticode.mjs +73 -4
- package/ios-dev.mjs +3 -3
- package/ios-package-recipe.mjs +6 -6
- package/linux-setup.mjs +3 -2
- package/local-publish.mjs +113 -17
- package/lock-identity.mjs +24 -100
- package/managed-cargo.mjs +3 -3
- package/managed-root-guard.mjs +2 -2
- package/managed-roots.mjs +3 -3
- package/native-adapters.mjs +41 -244
- package/native-helpers.mjs +1 -1
- package/ownership-mandatory-set.json +16 -0
- package/pack-digest.mjs +1 -1
- package/package-recipe-targets.mjs +19 -11
- package/package.json +2 -2
- package/publication-gate.mjs +29 -6
- package/publish-cargo.mjs +4 -5
- package/publish-local-cargo.mjs +77 -1
- package/qualification-verify.mjs +76 -49
- package/receipt-signature.mjs +104 -0
- package/recipe-build.mjs +15 -2
- package/release-switch-registry.json +4 -0
- package/release-switch-scan.mjs +13 -10
- package/rightkit-versions.json +184 -170
- package/scan-digest.mjs +43 -14
- package/seam-broker.mjs +168 -0
- package/snapshot-check.mjs +4 -1
- package/snapshot-dependency-reuse.mjs +1 -1
- package/snapshot-metadata.mjs +24 -35
- package/snapshot.mjs +328 -49
- package/stage-commands.mjs +59 -5
- package/stage-ledger.mjs +2 -2
- package/{carried-cargo.mjs → stage-seam.mjs} +118 -70
- package/stage-sidecar.mjs +9 -7
- package/tauri-bundle-marker.mjs +5 -2
- package/tauri-locked.mjs +1 -1
- package/tool-build.mjs +8 -6
- package/unit-gate.mjs +40 -10
- package/broker-handshake.mjs +0 -160
- package/broker-wire.mjs +0 -278
- package/build-ownership.mjs +0 -1578
- package/cargo-shapes.mjs +0 -332
- package/cargo-width.mjs +0 -49
- package/carrier-census.mjs +0 -124
- package/clippy-equivalence.mjs +0 -202
- package/freshness-census.mjs +0 -405
- package/handle-revocation.mjs +0 -100
- package/handle-revocation.rust-vector.json +0 -1
- package/handle-revocation.vectors.json +0 -53
- package/legion-freeze-consumer.mjs +0 -241
- package/linux-qualifier.mjs +0 -83
- package/native-tool-planning.mjs +0 -94
- package/owner-process-proof.mjs +0 -14
- package/ownership-mark.mjs +0 -191
- package/ownership-recover.mjs +0 -78
- package/pnpm-adapter-grammar.mjs +0 -226
- package/provenance-verify.mjs +0 -413
- package/snapshot-broker.mjs +0 -808
- package/snapshot-request.mjs +0 -722
- package/unit-list-compile.mjs +0 -356
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ The module imports node builtins only (preflight runs with no `node_modules`), r
|
|
|
38
38
|
|
|
39
39
|
`release-switch-scan.mjs` proves that release code cannot use an environment variable, argument, settings key or build flag to select a test mode, data root, executable, library, model or identity. The runtime half is `rightkit_daemon::mode`: a build without the `test-mode` cargo feature reads no override selector at all. Registry: `release-switch-registry.json` (forbidden features, the `RIGHTKIT-TEST-MODE-COMPILED` marker, deny names with their class). Apps add their own deny names under `releaseSwitches.forbid`. Selector classes: S1 test activation, S2 authority or identity override, S3 executable/library/model, S4 internal state or data root (S1-S4: forbidden, no allow-list), S5 user-content location (allowed, user gesture), S6 diagnostics/tuning (allowed, bounded value).
|
|
40
40
|
|
|
41
|
-
1. **Feature closure (authoritative)** - `release.mjs` runs `cargo tree -e features,no-dev --locked --target <triple>` in the app repository (`resolveFeatureClosure`; forwards the build command's `--features`/`--no-default-features`; manifest resolves `targets.<os>.cargoManifest` -> `releaseSwitches.manifest` -> `src-tauri/Cargo.toml` -> `Cargo.toml` and must exist; features are also read from package.json scripts the hooks run (up to three levels) plus `releaseSwitches.features`; no manifest fails with `release-switch-manifest-missing` unless the app sets `releaseSwitches.rust: false` (the only skip); a cargo failure fails a real release, a dry run reports it) and passes it to `featureClosureFindings(...)` and `commandSwitchFindings(argv)` refuse `test-mode`, `qa-native`, `dev-native`, `qa-control`, `dev-inspect` anywhere in the resolved graph (finding id `forbidden-feature <name>`). The binary marker below is secondary evidence only. `qa-build-features.mjs` also lists `test-mode` as a forbidden feature, including on a non-optional `rightkit-daemon` dependency. Two daemon host features are declarations rather than bans: `rightkit-daemon` `remote` is refused (`remote-feature-undeclared`) unless the app sets `releaseSwitches.remoteHost: true`, and the loopback feature `remote-loopback` (CodeRight's loopback HTTP + bearer host) is refused (`remote-loopback-undeclared`) unless the app sets `releaseSwitches.remoteLoopback: true`. Neither declaration covers the other; a `remote` reached only through `remote-loopback` in the `cargo tree` indentation is judged by the loopback rule, any other path to `remote` (a direct request, `testing`) still needs `remoteHost`, and a tree without indentation counts every `remote` as direct. Both values must be booleans.
|
|
41
|
+
1. **Feature closure (authoritative)** - `release.mjs` runs `cargo tree -e features,no-dev --locked --target <triple>` in the app repository (`resolveFeatureClosure`; forwards the build command's `--features`/`--no-default-features`; manifest resolves `targets.<os>.cargoManifest` -> `releaseSwitches.manifest` -> `src-tauri/Cargo.toml` -> `Cargo.toml` and must exist; features are also read from package.json scripts the hooks run (up to three levels) plus `releaseSwitches.features`; no manifest fails with `release-switch-manifest-missing` unless the app sets `releaseSwitches.rust: false` (the only skip); a cargo failure fails a real release, a dry run reports it) and passes it to `featureClosureFindings(...)` and `commandSwitchFindings(argv)` refuse `test-mode`, `qa-native`, `dev-native`, `qa-control`, `dev-inspect` anywhere in the resolved graph (finding id `forbidden-feature <name>`). The binary marker below is secondary evidence only. `qa-build-features.mjs` also lists `test-mode` as a forbidden feature, including on a non-optional `rightkit-daemon` dependency. Two daemon host features are declarations rather than bans: `rightkit-daemon-remote` `remote` (rightkit-daemon's own `remote` until rightkit-daemon 0.7.0; its `link` and `relay` features are no host) is refused (`remote-feature-undeclared`) unless the app sets `releaseSwitches.remoteHost: true`, and the `rightkit-daemon` loopback feature `remote-loopback` (CodeRight's loopback HTTP + bearer host) is refused (`remote-loopback-undeclared`) unless the app sets `releaseSwitches.remoteLoopback: true`. Neither declaration covers the other; a `remote` reached only through `remote-loopback` in the `cargo tree` indentation is judged by the loopback rule, any other path to `remote` (a direct request, `testing`) still needs `remoteHost`, and a tree without indentation counts every `remote` as direct. Both values must be booleans.
|
|
42
42
|
2. **Inventory completeness** - `sourceSwitchFindings` walks app source (Rust, TS/JS, Swift, C; not tests, fixtures, `node_modules`, `target`) and rejects an environment read whose name is not in `switches.json` (`unregistered-read`), a non-literal read in a file not listed under `dynamicReads` (`dynamic-read`), an S1-S4 entry without `compiledOut` (`not-compiled-out`), and a malformed inventory (`inventory-invalid`). Argument flags are enforced for deny-listed flags only.
|
|
43
43
|
3. **Binary** - `scanSwitchPaths` / `bufferSwitchFindings` over Mach-O, PE and ELF files: the marker (`test-mode-capability`) and any deny name from S1-S4 (`release-switch-names`), each as Latin-1 and UTF-16LE. The receipt holds the sha256 and size of every scanned file; the caller adds source commit, target triple and resolved features.
|
|
44
44
|
|
|
@@ -447,6 +447,10 @@ Safeguards on the managed Windows package step (a temporary bridge until the bro
|
|
|
447
447
|
|
|
448
448
|
Only a target directory under a managed root (`resolveManagedRoots`: `RIGHTKIT_DATA_ROOT`, `RIGHTKIT_MANAGED_ROOT`, `RIGHTKIT_EXTERNAL_ROOT`, `RIGHTKIT_CONTROL_ROOT`, the legacy `D:\.rightkit-managed` / `/Volumes/D/.rightkit-managed`) is staged. Any other directory outside the app still fails closed: `the Cargo target directory <dir> is outside the app, so <path> cannot be addressed by an app-relative path; point CARGO_TARGET_DIR inside the app or declare the artifact paths yourself`.
|
|
449
449
|
|
|
450
|
+
### Required files (`targets.<platform>.requiredFiles`)
|
|
451
|
+
|
|
452
|
+
Optional `targets.win.requiredFiles` / `targets.mac.requiredFiles`: a non-empty list of app-relative file paths (no absolute path, no `..`) on a `winPackage` or `macPackage` target. After every `prepare` step has run (so sidecars staged by `stageSidecars` or `stage-sidecar` already exist) and before the Tauri build, recipe-build checks that each is a file and fails with `RECIPE_BUILD_REQUIRED_FILES_MISSING` naming every missing path. Absent key: nothing is checked. Digest pins stay with the catalog and `stage-sidecar`.
|
|
453
|
+
|
|
450
454
|
### macOS updater tarball from `macPackage`
|
|
451
455
|
|
|
452
456
|
`targets.mac.macPackage.updater: true` (or an app-relative `.tar.gz` path) adds a `create-mac-updater` command at the front of
|
|
@@ -798,6 +802,7 @@ Any app that ships more than the ffmpeg sidecar (MailRight: `mailright-engine`,
|
|
|
798
802
|
- **`remote` NSIS installers:** `extract: "bin/smartctl.exe", extractKind: "nsis", memberSha256: "<member sha256>"` (memberSha256 required) runs 7-Zip (`7z` on PATH, `7z.exe` under Program Files on win32; `RIGHTKIT_SEVEN_ZIP` or `deps.sevenZip` overrides) as `x -y -o<tmp> <installer> <member>` after the installer digest passes, verifies the member sha256, and stages it. A missing 7-Zip, failed extraction or any digest mismatch fails closed naming the installer sha, member, expected and actual digests. The receipt row records `memberSha256`, `archiveSha256`, `member` and `extractKind`.
|
|
799
803
|
- **`ffmpeg` mixed variants, fetch and probes (#491):** `variants: { ffmpeg: "export-ass" }` lets one entry take the export-ass ffmpeg with the decode ffprobe (a tool not named uses `variant`). `sources: { ffmpeg: { url, sha256, member }, ffprobe: {...} }` downloads the bytes the catalog only pins: the archive is digest-checked, the member is unpacked and its sha256 must equal the APPROVED catalog row's content digest, so a swapped archive can never stage. A source may instead be a local path (#692): `sources: { ffmpeg: { path: "../vendor/ffmpeg-lgpl", member?: "ffmpeg" } }` (also per arch: `{ aarch64: { path }, x86_64: { path } }`). `path` is relative to the app root and may step out of it; it names the binary itself or a directory holding `<tool>[.exe]` or `bin/<tool>[.exe]` (`member` renames the file). Nothing is downloaded and there is no archive digest, but the file must still equal the APPROVED catalog row content digest (`STAGE_SIDECAR_HASH_MISMATCH` otherwise); notices, probe and universal lipo are unchanged; a missing file is `STAGE_SIDECAR_BINARY_NOT_FOUND`. `probe: true` runs `-version` and `-encoders` on a staged binary this host can run: the configuration must say `--disable-gpl` and `--disable-nonfree` and must not enable GPL, nonfree, libx264, libx265, libxvid or libfdk-aac, and ffmpeg may not list those encoders (`STAGE_SIDECAR_FFMPEG_PROBE_FAILED`; another architecture or OS is recorded as `skipped-cross-target`). The catalog has no Windows `export-ass` row yet (only `export-ass-zimg`); that row belongs to the rightkit-ffmpeg crate.
|
|
800
804
|
- **`native-library` (plan item 2.8):** `{ kind: "native-library", library: "onnxruntime" | "directml" | "pdfium" | "whisper-cpp" | "ggml" | "sherpa-onnx", version, catalog, resourceDir?, licenseDir?, cacheDir?, as?, files?, companions?, source?: { dir }, platforms? }` stages the `approved` or `pinned` rows of `native-libraries.json` for the target (every serving row, or the `files` named) into `resourceDir`, with their notices and a receipt row per file. The bytes come from the row's digest-pinned archive or, for a row with no archive (the macOS whisper.cpp, ggml and sherpa-onnx builds), from `source: { dir }`; an archive file must match the whole-file sha256 and the content digest, a `source.dir` file the content digest (a re-signed copy passes, changed code does not, and a thin row refuses a universal Mach-O), and the staged bytes are checked again after the copy. A row's `companions` (the Windows onnxruntime row names DirectML) are staged beside it with a `companionOf` receipt row; `companions: false` opts out, and a file another entry also writes into `resourceDir` is refused before anything is written. A row with `hostProof: "never-run"` stages with a warning (stderr on the CLI) and carries the marker into the receipt. `kind: "onnxruntime"` stays the alias of `native-library` with `library: "onnxruntime"`. See `docs/STAGE-SIDECAR.md`.
|
|
805
|
+
- **`ffmpeg` without `sources`:** an entry with no `sources` and no `stage` command stages each tool from the catalog row's own pinned archive (`archive.url`, `archive.sha256`, `archive.member`; the digest is checked before use and the member against the row's content digest), as `native-library` does. A row with no archive is left to the app's own staging. A config that names `sources` behaves as above.
|
|
801
806
|
- **`ffmpeg` `resourceDir`:** `{ kind: "ffmpeg", resourceDir: "src-tauri/resources/runtime", ... }` stages `<resourceDir>/ffmpeg[.exe]` and `ffprobe[.exe]` (no target triple, not an externalBin; an already-staged file that matches its row is made executable) from the same approved rows, notices, `sources`, probe and universal lipo merge as the externalBin layout; `bundleDir` and `resourceDir` cannot be combined.
|
|
802
807
|
- **`universal-apple-darwin` for `ffmpeg`, `onnxruntime` and `native-library` (#492):** each arch row is staged thin under `.right-release/slices/<triple>/` and the files are lipo-merged into `<stageDir>/<tool>-universal-apple-darwin` (onnxruntime, native-library and an ffmpeg `resourceDir` entry: into `resourceDir`), requiring both archs and every row approved (onnxruntime and native-library also accept `pinned`). A macOS `universal` native-library row is staged once and checked with `lipo -archs`, with no merge. For `ffmpeg`, `{arch}`, `{triple}` and `{stageDir}` in the `stage` command's arguments name the slice (it runs once per slice), `sources` need the per-arch form `{ ffmpeg: { aarch64: {...}, x86_64: {...} } }`, one source offer lists both slices, and the receipt rows carry `slices`. A merged file identical to the staged one is not rewritten.
|
|
803
808
|
|
package/adapter-env.mjs
CHANGED
|
@@ -1,108 +1,44 @@
|
|
|
1
1
|
// The request environment of a carried adapter call (rustright#190; rustright-cli shims.rs adapter_environment, rustright-policy adapter.rs
|
|
2
2
|
// check_environment). A `rustright run <adapter> -- <args>` request carries exactly the variables named by RUSTRIGHT_ADAPTER_ENV (a comma
|
|
3
|
-
// list), each set in the client's own environment
|
|
4
|
-
//
|
|
5
|
-
// attested request digest the gate recomputes (snapshot-request.mjs snapshotRequestCore).
|
|
3
|
+
// list), each set in the client's own environment. The door (build-launch.mjs) sets RUSTRIGHT_ADAPTER_ENV for a step from the env the step itself declares
|
|
4
|
+
// (`adapterEnvLaunch`); the seam sends the step's environment to the client unchanged (stage-seam.mjs runStageAdapter).
|
|
6
5
|
//
|
|
7
|
-
//
|
|
8
|
-
// (
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
// What the gate no longer judges (plan section 4, "no adapter grammar"): whether a name is reserved or registered. The client refuses a reserved name before it
|
|
7
|
+
// sends (shims.rs adapter_environment, `is_reserved_env_key`), and the broker refuses a reserved or unregistered key, a signing-material key and a handoff path
|
|
8
|
+
// that is not absolute (RK_ADAPTER_ENV_DENIED, admission_impl.rs `admit_adapter` -> adapter.rs `check_environment`). What stays here is what no one else refuses:
|
|
9
|
+
// signing material and the signing-file path never ride the request, and the comma list the gate builds itself must be able to carry what it names.
|
|
11
10
|
export const ADAPTER_ENV_VAR = "RUSTRIGHT_ADAPTER_ENV";
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* RA-08: the path of the transient Android signing-properties file (android-release.mjs ANDROID_SIGNING_PROPERTIES_ENV). It is a typed FILE handoff of the provisioned signer session (native-adapters.mjs
|
|
15
|
-
* `signingFileProblem`, `nativeSigningFileRefusal`), never an adapter request environment:
|
|
16
|
-
*
|
|
14
|
+
* `signingFileProblem`, `nativeSigningFileRefusal`), never an adapter request environment: the door refuses a step that declares it, the carrier's client never receives it, and
|
|
15
|
+
* `RUSTRIGHT_ADAPTER_ENV` never names it. Only the path exists in the environment of a direct host's own Gradle; the file holds the secrets.
|
|
17
16
|
*/
|
|
18
17
|
export const SIGNING_FILE_ENV = "RIGHTKIT_ANDROID_SIGNING_PROPERTIES";
|
|
19
18
|
export const ADAPTER_ENV_SIGNING_FILE = "RK_ADAPTER_ENV_SIGNING_FILE";
|
|
20
19
|
/** Whether `key` names the signing-properties file handoff (case-insensitive, as RustRight compares). */
|
|
21
20
|
export const isSigningFileEnvKey = (key) => String(key).toUpperCase() === SIGNING_FILE_ENV;
|
|
22
21
|
|
|
23
|
-
export const ADAPTER_ENV_RESERVED = "RK_ADAPTER_ENV_RESERVED";
|
|
24
22
|
export const ADAPTER_ENV_UNSET = "RK_ADAPTER_ENV_UNSET";
|
|
25
23
|
export const ADAPTER_ENV_INVALID = "RK_ADAPTER_ENV_INVALID";
|
|
26
24
|
|
|
27
|
-
// rustright-policy adapter.rs RESERVED_ENV_KEYS and RESERVED_ENV_PREFIXES at rustright 7b24288, compared upper-case. The prefix list still holds
|
|
28
|
-
// RIGHTKIT_ (marked legacy, "removed by task L-1"): until RustRight drops it, a RIGHTKIT_* name is refused by the broker and cannot be registered.
|
|
29
|
-
const RESERVED_EXACT = new Set([
|
|
30
|
-
"PATH", "PATHEXT", "HOME", "USERPROFILE", "TMPDIR", "TMP", "TEMP", "SYSTEMROOT", "COMSPEC", "SHELL", "BASH_ENV", "ENV", "PYTHONPATH", "PYTHONHOME",
|
|
31
|
-
"PYTHONSTARTUP", "PYTHONUSERBASE", "PYTHONEXECUTABLE", "PYTHONINSPECT", "PYTHONSAFEPATH", "NODE_OPTIONS", "NODE_PATH", "RUBYOPT", "RUBYLIB", "GEM_HOME",
|
|
32
|
-
"GEM_PATH", "PERL5LIB", "PERL5OPT", "PERLLIB", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "JDK_JAVA_OPTIONS", "CLASSPATH", "GOFLAGS", "GOROOT", "DOTNET_ROOT",
|
|
33
|
-
"DOTNET_STARTUP_HOOKS", "DOTNET_ADDITIONAL_DEPS", "ERL_FLAGS", "ERL_AFLAGS", "ERL_ZFLAGS", "ELIXIR_ERL_OPTIONS",
|
|
34
|
-
]);
|
|
35
|
-
const RESERVED_PREFIXES = ["RUSTRIGHT_", "RIGHTKIT_", "LD_", "DYLD_", "CARGO", "RUST", "SCCACHE", "COR_", "CORECLR_", "DOTNET_HOST"];
|
|
36
|
-
|
|
37
25
|
/**
|
|
38
26
|
* GB-06 (BROKER-CONTRACT section 16): signing material never rides an adapter request. RustRight reserves `TAURI_SIGNING_*` (the empty value that suppresses signing included), the legacy
|
|
39
|
-
* `TAURI_PRIVATE_KEY` and `TAURI_KEY_PASSWORD` (adapter.rs RESERVED_ENV_PREFIXES)
|
|
40
|
-
*
|
|
41
|
-
*
|
|
27
|
+
* `TAURI_PRIVATE_KEY` and `TAURI_KEY_PASSWORD` (adapter.rs RESERVED_ENV_PREFIXES), so the client and the broker refuse a request that names one. The gate refuses a step that declares one WITH a value
|
|
28
|
+
* before anything is launched, so the secret is never in a process environment the gate hands to the client, and a name the recipe sets EMPTY (it only suppresses signing in a direct session) is not
|
|
29
|
+
* forwarded rather than refused. Signing, the updater seal and their read-back stay in the provisioned signer session, so a carried Tauri build runs unsigned and RightKit seals outside the broker.
|
|
42
30
|
*/
|
|
43
31
|
export const SIGNING_ENV_PREFIXES = Object.freeze(["TAURI_SIGNING_", "TAURI_PRIVATE_KEY", "TAURI_KEY_PASSWORD"]);
|
|
44
32
|
export const ADAPTER_ENV_SIGNING = "RK_ADAPTER_ENV_SIGNING";
|
|
45
33
|
/** Whether `key` is signing material (case-insensitive, as RustRight compares). */
|
|
46
34
|
export const isSigningEnvKey = (key) => { const upper = String(key).toUpperCase(); return SIGNING_ENV_PREFIXES.some((prefix) => upper.startsWith(prefix)); };
|
|
47
|
-
/** `env` without any signing variable: what a carried call's client process receives (the client forwards only what RUSTRIGHT_ADAPTER_ENV names, but it never needs these to exist). */
|
|
48
|
-
export function withoutSigningEnv(env) {
|
|
49
|
-
const out = { ...env };
|
|
50
|
-
for (const key of Object.keys(out)) if (isSigningEnvKey(key) || isSigningFileEnvKey(key)) delete out[key];
|
|
51
|
-
return out;
|
|
52
|
-
}
|
|
53
35
|
|
|
54
36
|
/**
|
|
55
37
|
* The signed-artifact handoff (GB-05; adapter.rs QA_HANDOFF_ENV): the sign step's two outputs reach a consumer under exactly these two names. They are
|
|
56
|
-
* not secrets and not broker-owned
|
|
57
|
-
*
|
|
38
|
+
* not secrets and not broker-owned; the broker exempts exactly these two from the reserved RIGHTKIT_ prefix, requires them registered in the adapter's `env`
|
|
39
|
+
* and requires an absolute path with no `..` (adapter.rs check_environment).
|
|
58
40
|
*/
|
|
59
41
|
export const QA_HANDOFF_ENV = Object.freeze(["RIGHTKIT_QA_APP_BINARY", "RIGHTKIT_QA_SIGNING_EVIDENCE"]);
|
|
60
|
-
export const isQaHandoffKey = (key) => QA_HANDOFF_ENV.includes(String(key).toUpperCase());
|
|
61
|
-
export const ADAPTER_ENV_UNREGISTERED = "RK_ADAPTER_ENV_UNREGISTERED";
|
|
62
|
-
export const ADAPTER_ENV_HANDOFF_PATH = "RK_ADAPTER_ENV_HANDOFF_PATH";
|
|
63
|
-
|
|
64
|
-
/** Whether the broker refuses `key` in a request environment (adapter.rs is_reserved_env_key, case-insensitive; the QA handoff names are exempt). */
|
|
65
|
-
export function isReservedAdapterEnvKey(key) {
|
|
66
|
-
const upper = String(key).toUpperCase();
|
|
67
|
-
if (isQaHandoffKey(upper)) return false;
|
|
68
|
-
return upper === "" || upper.includes("=") || RESERVED_EXACT.has(upper) || RESERVED_PREFIXES.some((prefix) => upper.startsWith(prefix)) || isSigningEnvKey(upper);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The candidate registration manifest of the request-environment keys, per adapter (GB-04): the inventory of every non-reserved key the gate's planners
|
|
73
|
-
* send, by step. Each adapter's registration must list exactly these in its `env`; the installed registration must equal this manifest, and a key outside
|
|
74
|
-
* it refuses at planning, before any process. `pnpm` is the reference registration RustRight published (docs/contracts/adapter-argv.fixtures.json
|
|
75
|
-
* `adapter.env`); `node` takes the same keys (a step script reads the test knob and the signed handoff); `swift` takes none (the gate sends no environment
|
|
76
|
-
* to a SwiftPM job).
|
|
77
|
-
* RK_ISOLATED_CHECKOUT test knob of a broker-admitted test row (right-suite-contract.test.mjs, release-exports.test.mjs): "1" runs it from an isolated checkout
|
|
78
|
-
* RIGHTKIT_QA_APP_BINARY / RIGHTKIT_QA_SIGNING_EVIDENCE the signed-artifact handoff (GB-05), set by the sign step only
|
|
79
|
-
*/
|
|
80
|
-
export const ADAPTER_ENV_MANIFEST = Object.freeze({
|
|
81
|
-
"rightkit-pnpm": Object.freeze(["RK_ISOLATED_CHECKOUT", ...QA_HANDOFF_ENV]),
|
|
82
|
-
"rightkit-node": Object.freeze(["RK_ISOLATED_CHECKOUT", ...QA_HANDOFF_ENV]),
|
|
83
|
-
"rightkit-swift": Object.freeze([]),
|
|
84
|
-
// GB-51: the native-tool adapters take no request environment (a step's own environment is refused before launch, naming the key).
|
|
85
|
-
"rightkit-xcodegen": Object.freeze([]), "rightkit-xcodebuild": Object.freeze([]), "rightkit-gradle": Object.freeze([]), "rightkit-cmake": Object.freeze([]),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Why the broker would refuse this request environment for an adapter whose registration lists `registered` (adapter.rs `check_environment`), or null: a
|
|
90
|
-
* reserved key (broker-controlled, loader or interpreter path), a signed-artifact handoff key whose value is not an absolute path with no `..`, and any key the
|
|
91
|
-
* registration does not list. One refusal names every unregistered key and the registered set; nothing is dropped silently.
|
|
92
|
-
*/
|
|
93
|
-
export function adapterEnvRefusal(env, registered) {
|
|
94
|
-
const keys = Object.keys(env ?? {});
|
|
95
|
-
const reserved = keys.find((key) => isReservedAdapterEnvKey(key));
|
|
96
|
-
if (reserved !== undefined) return { code: ADAPTER_ENV_RESERVED, message: `environment key ${JSON.stringify(reserved)} is broker-controlled or redirects code loading, so no adapter request may carry it (reserved: RUSTRIGHT_*, RIGHTKIT_* except the two signed-artifact handoff names, CARGO*, RUST*, PATH, loader and interpreter-path variables)` };
|
|
97
|
-
const listed = new Set((registered ?? []).map(String));
|
|
98
|
-
for (const key of keys) {
|
|
99
|
-
const value = String(env[key]);
|
|
100
|
-
if (isQaHandoffKey(key) && listed.has(key) && !(isAbsolutePath(value) && !value.split(/[\\/]/).includes(".."))) return { code: ADAPTER_ENV_HANDOFF_PATH, message: `environment key ${JSON.stringify(key)} must be an absolute path with no '..' (the signed artifact's exact path)` };
|
|
101
|
-
}
|
|
102
|
-
const unregistered = keys.filter((key) => !listed.has(key));
|
|
103
|
-
if (unregistered.length === 0) return null;
|
|
104
|
-
return { code: ADAPTER_ENV_UNREGISTERED, message: `environment key(s) ${unregistered.map((k) => JSON.stringify(k)).join(", ")} are not registered for this adapter (registered: ${[...listed].sort().join(", ") || "none"}); register the key in the adapter's \`env\` (the candidate manifest is ADAPTER_ENV_MANIFEST) or remove it from the step; nothing is dropped to make the call pass` };
|
|
105
|
-
}
|
|
106
42
|
|
|
107
43
|
function fail(code, message) {
|
|
108
44
|
const error = new Error(`${code}: ${message}`);
|
|
@@ -110,16 +46,15 @@ function fail(code, message) {
|
|
|
110
46
|
throw error;
|
|
111
47
|
}
|
|
112
48
|
|
|
113
|
-
const isAbsolutePath = (value) => path.isAbsolute(value) || path.posix.isAbsolute(value) || path.win32.isAbsolute(value);
|
|
114
49
|
const validName = (name) => typeof name === "string" && name !== "" && !/[,=\0\s]/.test(name);
|
|
115
50
|
const validValue = (value) => typeof value === "string" && !value.includes("\0");
|
|
116
51
|
|
|
117
52
|
/**
|
|
118
53
|
* What the door adds to a carried adapter step's launch environment for the env the step declares: `{}` for none (no RUSTRIGHT_ADAPTER_ENV at
|
|
119
|
-
* all), else RUSTRIGHT_ADAPTER_ENV naming exactly the step's variables, plus those variables with their values. A
|
|
120
|
-
* cannot ride a comma list, a declared name with no value, or a value that is not a string is refused with a coded error.
|
|
54
|
+
* all), else RUSTRIGHT_ADAPTER_ENV naming exactly the step's variables, plus those variables with their values. A signing-material name with a value, the signing-file handoff, a name that
|
|
55
|
+
* cannot ride a comma list, a declared name with no value, or a value that is not a string is refused with a coded error. Reserved and unregistered names are the client's and the broker's to refuse.
|
|
121
56
|
*/
|
|
122
|
-
export function adapterEnvLaunch(stepEnv
|
|
57
|
+
export function adapterEnvLaunch(stepEnv) {
|
|
123
58
|
// GB-06: signing material is never forwarded. A signing variable the step declares with a value is material and refuses the step at planning (the name, never the value, is reported); one the
|
|
124
59
|
// recipe sets EMPTY only suppresses signing in a direct session, carries nothing, and is not forwarded (the carried build runs unsigned; the seal is made outside the broker).
|
|
125
60
|
const declared = Object.keys(stepEnv ?? {});
|
|
@@ -132,34 +67,10 @@ export function adapterEnvLaunch(stepEnv, { registered = null } = {}) {
|
|
|
132
67
|
const launch = (value) => { if (droppedSigning.length) Object.defineProperty(value, "signingEnvDropped", { value: droppedSigning, enumerable: false }); return value; };
|
|
133
68
|
if (names.length === 0) return launch({});
|
|
134
69
|
for (const name of names) {
|
|
135
|
-
if (isReservedAdapterEnvKey(name)) fail(ADAPTER_ENV_RESERVED, `step env ${JSON.stringify(name)} is broker-controlled or redirects code loading, so no adapter request may carry it (reserved: RUSTRIGHT_*, RIGHTKIT_* except the two signed-artifact handoff names, CARGO*, RUST*, loader and interpreter-path variables)`);
|
|
136
70
|
if (!validName(name)) fail(ADAPTER_ENV_INVALID, `step env name ${JSON.stringify(name)} cannot be forwarded to an adapter`);
|
|
137
71
|
const value = stepEnv[name];
|
|
138
72
|
if (value === undefined || value === null) fail(ADAPTER_ENV_UNSET, `step env ${name} is declared but has no value`);
|
|
139
73
|
if (!validValue(String(value))) fail(ADAPTER_ENV_INVALID, `step env ${name} has a value that cannot be forwarded`);
|
|
140
74
|
}
|
|
141
|
-
// GB-04: judged against the adapter's registration (its `env`) before anything is launched; one refusal names every unregistered key.
|
|
142
|
-
if (registered !== null) {
|
|
143
|
-
const refusal = adapterEnvRefusal(Object.fromEntries(names.map((name) => [name, String(stepEnv[name])])), registered);
|
|
144
|
-
if (refusal) fail(refusal.code, refusal.message);
|
|
145
|
-
}
|
|
146
75
|
return launch({ [ADAPTER_ENV_VAR]: names.join(","), ...Object.fromEntries(names.map((name) => [name, String(stepEnv[name])])) });
|
|
147
76
|
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* The map the RustRight client forwards for a call run with `env` (shims.rs adapter_environment): each name in RUSTRIGHT_ADAPTER_ENV, its value
|
|
151
|
-
* from `env`. A reserved name, or a named variable that is not set, is refused (the client refuses the same two ways).
|
|
152
|
-
*/
|
|
153
|
-
export function forwardedAdapterEnv(env) {
|
|
154
|
-
const raw = env?.[ADAPTER_ENV_VAR] ?? "";
|
|
155
|
-
const forwarded = {};
|
|
156
|
-
for (const name of String(raw).split(",").map((part) => part.trim()).filter(Boolean)) {
|
|
157
|
-
if (isSigningFileEnvKey(name)) fail(ADAPTER_ENV_SIGNING_FILE, `${ADAPTER_ENV_VAR} names ${name}, the signing-properties file handoff: its path is never forwarded as an adapter request environment`);
|
|
158
|
-
if (isSigningEnvKey(name)) fail(ADAPTER_ENV_SIGNING, `${ADAPTER_ENV_VAR} names ${name}, which is signing material and is never forwarded to an adapter (signing stays in the provisioned signer session)`);
|
|
159
|
-
if (isReservedAdapterEnvKey(name)) fail(ADAPTER_ENV_RESERVED, `${ADAPTER_ENV_VAR} names ${name}, which is broker-controlled and cannot be forwarded to an adapter`);
|
|
160
|
-
const value = env[name];
|
|
161
|
-
if (value === undefined) fail(ADAPTER_ENV_UNSET, `${ADAPTER_ENV_VAR} names ${name}, which is not set`);
|
|
162
|
-
forwarded[name] = String(value);
|
|
163
|
-
}
|
|
164
|
-
return forwarded;
|
|
165
|
-
}
|
package/admission-host.mjs
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// env, spawn and file system, and says NOT RUN with its reason when the probe cannot run on this host (a Windows probe on a Mac).
|
|
4
4
|
// NOT RUN is never a pass. Real-credential acceptance runs on the Mac and the Dell; the unit tests use fakes.
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
|
+
import os from "node:os";
|
|
6
7
|
import path from "node:path";
|
|
8
|
+
import { PROTECTED_SECRETS, protectedSecretStoreCommand } from "./protected-credentials.mjs";
|
|
7
9
|
import { brokerManagedHost } from "./cargo-contract.mjs";
|
|
8
10
|
import { CredentialProviderError, providerPlatformOf, updaterCredentialProvider } from "./credential-provider.mjs";
|
|
9
11
|
import { ManagedHostEnvSecretError, isManagedHost } from "./managed-host-secrets.mjs";
|
|
@@ -227,10 +229,21 @@ export const HOST_ROWS = Object.freeze([
|
|
|
227
229
|
run(ctx) {
|
|
228
230
|
if (!signsUpdater(ctx)) return { na: "the target does not sign updater artifacts" };
|
|
229
231
|
if (providerPlatformOf(ctx.hostPlatform) !== ctx.platform) return { notRun: `the updater credential provider is resolved on the ${ctx.platform === "win" ? "Windows" : "Mac"} host that signs` };
|
|
230
|
-
|
|
232
|
+
let provider;
|
|
233
|
+
try { provider = updaterCredentialProvider({ env: ctx.env, hostPlatform: ctx.hostPlatform }).file; } catch (error) {
|
|
231
234
|
if (error instanceof CredentialProviderError) return [error.message];
|
|
232
235
|
throw error;
|
|
233
236
|
}
|
|
237
|
+
// The key itself, not only the provider: a Windows host with the provider enrolled and no key stored passed this row and failed after the whole build,
|
|
238
|
+
// at sign-updater ("invalid credential: not found"; HeardRight on the Dell, 2026-11-10). `status` reports presence only and never reads the secret.
|
|
239
|
+
if (ctx.hostPlatform === "win32") {
|
|
240
|
+
const account = os.userInfo().username;
|
|
241
|
+
const asked = ctx.spawn(provider, ["status", "--namespace", PROTECTED_SECRETS["updater-signing-key"].keychain, "--account", account], { encoding: "utf8", windowsHide: true, shell: false });
|
|
242
|
+
let present = null;
|
|
243
|
+
try { present = JSON.parse(String(asked.stdout ?? "")).present; } catch { present = null; }
|
|
244
|
+
if (present === false) return [`the updater signing key is not in this host's credential store (account ${account}); store it once with: ${protectedSecretStoreCommand("updater-signing-key", "win32", { provider, env: ctx.env })}`];
|
|
245
|
+
if (present !== true) return [`the credential provider could not report whether the updater signing key is stored (exit ${asked.status ?? "unavailable"})`];
|
|
246
|
+
}
|
|
234
247
|
return undefined;
|
|
235
248
|
},
|
|
236
249
|
},
|
|
Binary file
|