@rightkit/release 0.6.79 → 0.6.81
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/acceptance-lines.mjs +18 -15
- package/acceptance-lines.test.mjs +979 -0
- package/acceptance-result.mjs +58 -1
- package/bin/darwin/rightkit-swap +0 -0
- package/bin/darwin/rightkit-swap.sha256 +1 -0
- package/bin/rightkit-gate.mjs +29 -5
- package/cargo-license-notices.mjs +5 -1
- package/cli/right-release.mjs +0 -0
- package/gate-release-admission.mjs +1 -1
- package/install-app.mjs +20 -1
- package/local-publish.mjs +14 -8
- package/ownership-mandatory-set.json +120 -0
- package/package.json +10 -11
- package/publish-cargo.mjs +7 -3
- package/publish-local-npm.mjs +75 -35
- package/rightkit-registry-resolver.mjs +12 -2
- package/rightkit-versions.json +159 -91
- package/seam-broker.mjs +30 -10
- package/shell-contract.mjs +36 -0
- package/swap-helper-bundle.mjs +16 -0
- package/unit-gate.mjs +4 -2
package/acceptance-result.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { createHash } from "node:crypto";
|
|
|
12
12
|
import { execFileSync } from "node:child_process";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
import { ACCEPTANCE_RESULT_SCHEMA, judgeFileHashes } from "./acceptance-admission.mjs";
|
|
15
|
-
import { CONTRACT_FILE } from "./acceptance-lines.mjs";
|
|
15
|
+
import { CONTRACT_FILE, readAcceptanceLines } from "./acceptance-lines.mjs";
|
|
16
16
|
|
|
17
17
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
18
18
|
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
@@ -43,8 +43,65 @@ export function buildAcceptanceResult({ launch, verdict, contractText, judgeFile
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The record from an acceptance-run.mjs output folder (rightkit.acceptance-run/1, `<out>/verdict.json`), the run that accepts a gate today: the seven fixture
|
|
48
|
+
* cases, NN13 and the real build, judged together. The thirteen lines are that verdict's, each with the contract's sentence; `pass` needs the whole verdict
|
|
49
|
+
* to pass, the real build included; the judge files are the ones the run recorded; the commit is the real build's (a checkout of the release commit),
|
|
50
|
+
* and the launch facts (host, gate, times) are the real build's own. `claims` must be the real build's (claimsOfRealBuild).
|
|
51
|
+
*/
|
|
52
|
+
export function buildFromAcceptanceRun({ run, launch, contractLines, contractText, tree, claims }) {
|
|
53
|
+
const lines = run?.verdict?.lines ?? []; const byId = new Map(lines.map((l) => [l.id, l]));
|
|
54
|
+
const realOk = run?.realBuild && Array.isArray(run.verdict?.realBuild) && run.verdict.realBuild.length > 0 && run.verdict.realBuild.every((l) => l.verdict === "pass");
|
|
55
|
+
const base = buildAcceptanceResult({ launch: { ...launch, commit: run?.realBuild?.commit ?? null }, verdict: { lines: contractLines.map((c) => ({ id: c.id, text: c.text, verdict: byId.get(c.id)?.verdict ?? "not run" })), pass: run?.verdict?.pass === true && realOk === true }, contractText, judgeFiles: run?.judgeFiles ?? {}, tree, claims });
|
|
56
|
+
return { ...base, casesSha256: run?.casesSha256 ?? null, realBuild: { repository: run?.realBuild?.repository ?? null, lines: (run?.verdict?.realBuild ?? []).map((l) => ({ id: l.id, verdict: l.verdict })) } };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The real build's broker claims: receipts written during its run (absent from its `before/receipts.txt`) whose signed gate commit is the real build's commit. */
|
|
60
|
+
export function claimsOfRealBuild({ receiptsDir, before, commit, read = (f) => fs.readFileSync(f, "utf8"), list = (d) => fs.readdirSync(d) }) {
|
|
61
|
+
const claims = [];
|
|
62
|
+
for (const name of list(receiptsDir)) {
|
|
63
|
+
if (!name.endsWith(".json") || before.has(name)) continue;
|
|
64
|
+
let doc; try { doc = JSON.parse(read(path.join(receiptsDir, name))); } catch { continue; }
|
|
65
|
+
if (doc?.provenance?.payload?.gate?.commit !== commit) continue; // a fixture case's job, or another repository's on the shared broker
|
|
66
|
+
const c = claimOf(doc); if (c) claims.push(c);
|
|
67
|
+
}
|
|
68
|
+
return claims;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function mainAcceptanceRun(argv, out) {
|
|
72
|
+
const opt = (name) => { const i = argv.indexOf(name); return i < 0 ? null : argv[i + 1]; };
|
|
73
|
+
const acceptDir = opt("--acceptance"); const receiptsDir = opt("--receipts"); const outDir = opt("--out");
|
|
74
|
+
if (!acceptDir || !receiptsDir || !outDir) { out("usage: acceptance-result.mjs --acceptance <acceptance-run.mjs output folder> --receipts <broker receipts dir> --out <result dir>"); return 2; }
|
|
75
|
+
const run = JSON.parse(fs.readFileSync(path.join(acceptDir, "verdict.json"), "utf8"));
|
|
76
|
+
if (run?.schema !== "rightkit.acceptance-run/1") { out(`acceptance-result REFUSED: ${path.join(acceptDir, "verdict.json")} is not a rightkit.acceptance-run/1 record`); return 1; }
|
|
77
|
+
if (!run.realBuild?.commit || !run.realBuild?.repository) { out("acceptance-result REFUSED: the acceptance run has no real build; a gate release is judged with it"); return 1; }
|
|
78
|
+
const realDir = path.join(acceptDir, "real-build");
|
|
79
|
+
const launch = JSON.parse(fs.readFileSync(path.join(realDir, "launch.json"), "utf8"));
|
|
80
|
+
let before = new Set(); try { before = new Set(fs.readFileSync(path.join(realDir, "before", "receipts.txt"), "utf8").split(/\r?\n/).filter(Boolean)); } catch { /* none */ }
|
|
81
|
+
const claims = claimsOfRealBuild({ receiptsDir, before, commit: run.realBuild.commit });
|
|
82
|
+
const tree = String(execFileSync("git", ["-C", run.realBuild.repository, "rev-parse", `${run.realBuild.commit}^{tree}`], { encoding: "utf8", windowsHide: true })).trim();
|
|
83
|
+
const contractText = String(fs.readFileSync(CONTRACT_FILE));
|
|
84
|
+
const result = buildFromAcceptanceRun({ run, launch, contractLines: readAcceptanceLines(contractText), contractText, tree, claims });
|
|
85
|
+
return writeResult({ result, claims, launch, outDir, out });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function writeResult({ result, claims, launch, outDir, out }) {
|
|
89
|
+
fs.mkdirSync(path.join(outDir, "job-claims"), { recursive: true });
|
|
90
|
+
for (const c of claims) fs.writeFileSync(path.join(outDir, "job-claims", `${c.id}.json`), c.bytes);
|
|
91
|
+
const gatePath = launch.gate?.path; const sealed = result.gate.sealedSha256;
|
|
92
|
+
if (gatePath && sealed) {
|
|
93
|
+
const m = SEALED_FOLDER.exec(String(gatePath)); const folder = String(gatePath).slice(0, m.index + m[0].length - 1); const beside = `${folder}.manifest.txt`;
|
|
94
|
+
fs.mkdirSync(path.join(outDir, "gate-seal"), { recursive: true });
|
|
95
|
+
for (const [from, to] of [[beside, "manifest.txt"], [path.join(folder, "trusted-gate-source.json"), "trusted-gate-source.json"]]) { try { fs.copyFileSync(from, path.join(outDir, "gate-seal", to)); } catch { /* the admission names what is missing */ } }
|
|
96
|
+
}
|
|
97
|
+
fs.writeFileSync(path.join(outDir, "acceptance-result.json"), `${JSON.stringify(result, null, 2)}\n`);
|
|
98
|
+
out(`acceptance-result written: ${path.join(outDir, "acceptance-result.json")} (${result.lines.filter((l) => l.verdict === "pass").length} of ${result.lines.length} lines pass, ${claims.length} broker claim(s), pass ${result.pass})`);
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
46
102
|
/** `node acceptance-result.mjs ...` (see the head of this file). Exit 0 when the result is written, whether or not the run passed: the verdict is in the record. */
|
|
47
103
|
export function main(argv = process.argv.slice(2), { out = console.log } = {}) {
|
|
104
|
+
if (argv.includes("--acceptance")) return mainAcceptanceRun(argv, out);
|
|
48
105
|
const opt = (name) => { const i = argv.indexOf(name); return i < 0 ? null : argv[i + 1]; };
|
|
49
106
|
const runDir = opt("--run"); const repo = opt("--repo"); const receiptsDir = opt("--receipts"); const outDir = opt("--out");
|
|
50
107
|
if (!runDir || !repo || !receiptsDir || !outDir) { out("usage: acceptance-result.mjs --run <run dir> --repo <dir> --receipts <broker receipts dir> --out <result dir> [acceptance-lines.mjs options]"); return 2; }
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d6670e755e3c857aac3b7395a692b2760754b64b00cc4ab793db02db8fc4128d rightkit-swap
|
package/bin/rightkit-gate.mjs
CHANGED
|
@@ -2358,11 +2358,27 @@ async function runStages(o, args, root, git, io) {
|
|
|
2358
2358
|
if (ok && ds) ok = await stageSidecarsOnce({ o, ds, root, git, configs: sidecarConfigs, appDir, cli, commonDir, commit, tree, stage, executor });
|
|
2359
2359
|
else for (const config of ok ? sidecarConfigs : []) if (!await rightRelease(stage, ["stage-sidecar", "--config", path.join(root, config)])) { ok = false; break; }
|
|
2360
2360
|
if (ok && admissionAfterStaging) {
|
|
2361
|
-
|
|
2362
|
-
|
|
2361
|
+
// Every Cargo workspace of the app must have a receipt naming its target: an app of several workspaces (CodeRight: engine, src-tauri, qa-e2e) whose
|
|
2362
|
+
// sidecar staging compiled only one still has no target for the others, and the dry-run refused it with RK_SPLIT_TARGET_UNRESOLVED (Mac, 2026-11-26).
|
|
2363
|
+
let appWorkspaces = [];
|
|
2364
|
+
try { appWorkspaces = Object.entries(await snapshotCargoWorkspaces({ git, ds, root })).filter(([dir]) => appDir === "." || dir === appDir || dir.startsWith(`${appDir}/`)).map(([, checkout]) => checkout); } catch { appWorkspaces = []; }
|
|
2365
|
+
const uncovered = appWorkspaces.filter((w) => !ds.carriedOutputs?.has(w));
|
|
2366
|
+
if (ds.carriedOutputs?.size && uncovered.length === 0) ok = await admissionDryRun("after the sidecars were staged, before the app compiles");
|
|
2367
|
+
else o.out(`${tag} [compile] release admission dry-run skipped here: no broker receipt names the Cargo target of ${uncovered.length ? uncovered.map((w) => path.relative(root, w).replaceAll("\\", "/") || ".").join(", ") : "the app"} yet; the package stage's build runs the same admission rows at its start`);
|
|
2363
2368
|
}
|
|
2364
2369
|
let compiledDirs = []; let compiledBins = null; let qualifyOwed = []; let limitedEvidence = [];
|
|
2365
|
-
const reportOutputs = (dirs, bins = null
|
|
2370
|
+
const reportOutputs = (dirs, bins = null, byCargoDir = []) => {
|
|
2371
|
+
compiledDirs = [...dirs]; compiledBins = bins;
|
|
2372
|
+
// The compile's broker output folder of each Cargo workspace joins the door run's known outputs (keyed by checkout workspace, as the stage
|
|
2373
|
+
// carriers file theirs): the package stage's map hands them to its first resolution (stage-seam.mjs carriedOutputDir knownOutputDirs).
|
|
2374
|
+
// A folder a stage carrier already recorded for that workspace stays: it is the one the app's own build used.
|
|
2375
|
+
if (!ds) return;
|
|
2376
|
+
let checkoutReal = root; try { checkoutReal = fs.realpathSync.native(root); } catch { /* as given */ }
|
|
2377
|
+
for (const [cargoDir, dir] of byCargoDir) {
|
|
2378
|
+
const key = path.join(checkoutReal, ...(cargoDir === "." ? [] : cargoDir.split("/")));
|
|
2379
|
+
if (!ds.carriedOutputs?.has(key)) (ds.carriedOutputs ??= new Map()).set(key, dir);
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2366
2382
|
if (ok) ok = (await (o.runCompile ?? (() => main(ds ? ["--all", "--commit", commit, "--snapshot", ds.path] : ["--all"], { ...io, cwd: root, readStdin: () => "", ...(ds ? { snapshotLock: ds.lock, classAEarlier: true, seamScope: appDir === "." ? null : [appDir], snapshotLedger: ds.ledger?.entries ?? [], onCompileLedger: (entries) => { ds.compileAdmitted = entries; }, onDirectReceipt: (r) => { directReceipt = r; }, onCompileOutputs: reportOutputs, onQualifyOwed: (list) => { qualifyOwed = list; }, onLimitedEvidence: (list) => { limitedEvidence = list; } } : {}) })))({ reportOutputs })) === 0;
|
|
2367
2383
|
if (directReceipt) extra = { ...extra, direct: directReceipt };
|
|
2368
2384
|
// What the plan left to the qualify stage is recorded with the compile, so qualification can prove it is not lost (rightkit#1332, #1333).
|
|
@@ -3188,7 +3204,7 @@ async function committedCargoManifests({ o, git, root, commit, scopeDirs, extraW
|
|
|
3188
3204
|
const npm = discoverNpmUnits({ root, tracked, readFile, exists });
|
|
3189
3205
|
const closure = tools.closureOf({ scopeDirs, npmUnits: npm, rustUnits: inventory.units, readFile: readCommitted });
|
|
3190
3206
|
// Workspaces the unit's own compile builds beside its closure (a crate's consumer rows under ci/consumers/): bound when the commit tracks their manifest.
|
|
3191
|
-
const extra = extraWorkspaces.filter((dir) => fileSet.has(`${dir}/Cargo.toml`));
|
|
3207
|
+
const extra = extraWorkspaces.filter((dir) => fileSet.has(dir === "." ? "Cargo.toml" : `${dir}/Cargo.toml`));
|
|
3192
3208
|
const workspaces = [...new Set([...inventory.units.filter((u) => closure.rust.has(u.name)).map((u) => u.cargoDir), ...extra])].sort();
|
|
3193
3209
|
o.out(`rightkit-gate: Cargo output scope ${scopeDirs.join(", ")}: ${workspaces.length} workspace(s) (${workspaces.join(", ") || "none"}); dependency directories ${closure.dependencyDirs.join(", ")}`);
|
|
3194
3210
|
return { manifests: workspaces.map((dir) => path.posix.join(dir, "Cargo.toml")), hasCargo: allManifests.length > 0 };
|
|
@@ -3430,6 +3446,11 @@ async function runUnitSnapshot(o, args, root, git, io, option) {
|
|
|
3430
3446
|
try { consumerScope = [...new Set((JSON.parse(fs.readFileSync(path.join(ds.path, "ci", "gate.config.json"), "utf8")).rust?.[match[2]]?.consumerRows ?? []).map((row) => path.posix.dirname(String(row.manifestPath))))]; }
|
|
3431
3447
|
catch { consumerScope = []; }
|
|
3432
3448
|
}
|
|
3449
|
+
// The gate package's package stage on the Mac builds and signs its swap helper from crates/rightkit-fs (local-publish.mjs prepareSwapHelper), so that
|
|
3450
|
+
// Cargo workspace is bound beside the package's own (0.6.80 on the Mac: RK_CARGO_UNBOUND_WORKSPACE "resolved (none)" for the helper build).
|
|
3451
|
+
// rightkit-fs is a member of the repository's one Cargo workspace (the root Cargo.toml), so the workspace bound is the root ".", not the crate's folder:
|
|
3452
|
+
// binding "crates/rightkit-fs" left the root manifest out of the walk and bound the crate folder, which Cargo never resolves to (0.6.81 on the Mac).
|
|
3453
|
+
if (selector === "npm:@rightkit/release" && o.platform === "darwin") consumerScope = [...new Set([...consumerScope, "."])];
|
|
3433
3454
|
const bound = option("--to") === "check" || privateUnit.private ? { env: {}, cleanup() {} } : await bindUnitCargo({ o, git, root, ds, executor, which, scopeDirs: [path.posix.dirname(manifest)], extraWorkspaces: consumerScope, ...(toolRun ? { onlyWorkspaces: [path.posix.dirname(manifest)] } : {}) });
|
|
3434
3455
|
if (bound.refusal) { o.err(`${tag} BLOCKED: RK_SNAPSHOT_OUTPUT_UNPINNED: ${bound.refusal}; nothing ran`); return 1; }
|
|
3435
3456
|
if (bound.note) o.out(`${tag} ${bound.note}`);
|
|
@@ -5873,7 +5894,10 @@ export async function main(argv, io = {}) {
|
|
|
5873
5894
|
note: (text) => o.out(`${tag} built programs: ${text}`),
|
|
5874
5895
|
});
|
|
5875
5896
|
const outputWorkspaces = (snapshotBroker ? scanResult.scans.map((r) => r.snapshotEvidence?.outputDir) : Object.values(targetDirs ?? {})).filter(Boolean).map((dir) => [dir]);
|
|
5876
|
-
|
|
5897
|
+
// Each broker row's output folder with its Cargo workspace (repository-relative), so a later stage of the same door run can resolve that workspace's
|
|
5898
|
+
// target before its own first Cargo call (a multi-workspace app's package admission, CodeRight on the Mac 0.6.80: RK_SPLIT_TARGET_UNRESOLVED).
|
|
5899
|
+
const outputsByCargoDir = snapshotBroker ? scanResult.scans.flatMap((r) => { const unit = unitByName.get(rustUnitOfScanId(r.id, known)); const dir = r.snapshotEvidence?.outputDir; return typeof unit?.cargoDir === "string" && typeof dir === "string" && dir ? [[unit.cargoDir, dir]] : []; }) : [];
|
|
5900
|
+
o.onCompileOutputs?.(outputWorkspaces.map(([dir]) => dir), builtBins, outputsByCargoDir);
|
|
5877
5901
|
o.out(`${tag} class B keying: ${ROW_DIGEST_STATS.misses} row digest(s) computed in ${(ROW_DIGEST_STATS.ms / 1000).toFixed(1)} s, ${ROW_DIGEST_STATS.hits} reused`);
|
|
5878
5902
|
if (snapshotBroker) o.out(`${tag} broker compile: ${new Set(scanResult.scans.map((r) => r.snapshotEvidence?.requestId).filter(Boolean)).size} carried request(s) with verified signed receipts (${scanResult.scans.filter((r) => r.snapshotEvidence).length} scan row(s)); no direct receipt on a broker host`);
|
|
5879
5903
|
else {
|
|
@@ -149,7 +149,11 @@ export function generateCargoNotices({ appRoot, config, flags = {}, check = fals
|
|
|
149
149
|
if (entry.manifestPath !== undefined && !exists(path.resolve(appRoot, entry.manifestPath))) fail(`legal.cargoNotices.manifestPath ${entry.manifestPath}${where} does not exist`);
|
|
150
150
|
}
|
|
151
151
|
const outputs = options.manifests.map((entry) => {
|
|
152
|
-
|
|
152
|
+
// Absolute paths: the managed runner hands the command to the broker, which runs it with no working directory of the app's (rightkit#1718),
|
|
153
|
+
// so an app-relative --config or template would be read from wherever cargo happens to start.
|
|
154
|
+
const absolute = { ...options, template: path.resolve(appRoot, options.template) };
|
|
155
|
+
const absoluteEntry = { ...entry, ...(entry.config !== undefined ? { config: path.resolve(appRoot, entry.config) } : {}), ...(entry.manifestPath !== undefined ? { manifestPath: path.resolve(appRoot, entry.manifestPath) } : {}) };
|
|
156
|
+
const result = run(cargoAboutArgs(absolute, absoluteEntry), { cwd: appRoot, env, encoding: "utf8", maxBuffer: 256 * 1024 * 1024 });
|
|
153
157
|
const where = entry.label ? ` for ${entry.label}` : "";
|
|
154
158
|
if (result?.error) fail(`cargo about could not start${where} (${result.error.message}); install cargo-about on the build host`);
|
|
155
159
|
if (result?.status !== 0) fail(`cargo about${where} exited ${result?.status ?? "without status"}${result?.stderr ? `:\n${String(result.stderr).trim()}` : ""}`);
|
package/cli/right-release.mjs
CHANGED
|
File without changes
|
|
@@ -192,7 +192,7 @@ export function main(argv = process.argv.slice(2), { out = console.log } = {}) {
|
|
|
192
192
|
const f = result.facts;
|
|
193
193
|
// --record <file>: the record a credentialed upload step reads (scripts/ci/upload.mjs gateAdmissionProblem). Written only here, only when admitted.
|
|
194
194
|
if (opt("--record")) fs.writeFileSync(opt("--record"), `${JSON.stringify({ schema: "rightkit.gate-release-admission/1", ok: true, unit: GATE_PACKAGE, version: f.version, archiveSha256: f.archiveSha256, commit: opt("--commit"), host: f.host, sealedSha256: f.sealedSha256, jobsVerified: f.jobsVerified, signedSteps: f.signedSteps, nnBasis: f.nnBasis }, null, 2)}\n`);
|
|
195
|
-
out(`gate-release-admission OK: host ${f.host}, sealed gate ${f.sealedSha256}, archive ${f.archiveSha256}; ${f.jobsVerified} of ${f.jobsListed} listed broker job(s) verified, in step(s) ${f.signedSteps.join(", ")}; sealed launch(es) proven from signed claims: ${f.launchesProven.join(", ")}`);
|
|
195
|
+
out(`gate-release-admission OK: host ${f.host}, sealed gate ${f.sealedSha256}, archive ${f.archiveSha256}; ${f.jobsVerified} of ${f.jobsListed} listed broker job(s) verified, in step(s) ${(f.signedSteps ?? []).join(", ") || "none named"}; sealed launch(es) proven from signed claims: ${(f.launchesProven ?? []).join(", ") || "none named (an acceptance result: its claims are the release commit's real build)"}`);
|
|
196
196
|
out(` every other assertion of the verdict rests on: ${f.nnBasis ?? "not stated"} (the signed claims prove those launches ran on that host's broker for this gate, with that command, result and commit; they do not re-derive the rest)`);
|
|
197
197
|
return 0;
|
|
198
198
|
}
|
package/install-app.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { detachWithRetry } from "./hdiutil-detach.mjs";
|
|
|
7
7
|
import { previousPathOf } from "./in-place-install.mjs";
|
|
8
8
|
import { assertShippedSwapHelperSigned } from "./swap-helper-bundle.mjs";
|
|
9
9
|
import { installAppWindows, InstallAppWindowsError } from "./install-app-windows.mjs";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
10
11
|
import fs from "node:fs";
|
|
11
12
|
import os from "node:os";
|
|
12
13
|
import path from "node:path";
|
|
@@ -253,13 +254,31 @@ function coded(code, message) {
|
|
|
253
254
|
// A helper that exists must be code-signed (#258): an unsigned one is a typed SWAP_HELPER_UNSIGNED error naming the fix,
|
|
254
255
|
// never a silent downgrade. No helper at all keeps the documented journaled two-rename fallback, which is logged
|
|
255
256
|
// (`swap-fallback`, then `replaced {swap}`).
|
|
257
|
+
/**
|
|
258
|
+
* The committed helper reaches a Mac without its executable bit when the gate package was packed on Windows (no mode bits there; 0.6.81), and an
|
|
259
|
+
* installed gate's folder is read-only. Such a helper runs as a private copy with mode 0755 under the temporary folder, named by its sha256; the
|
|
260
|
+
* copy keeps the embedded code signature, which was checked on the shipped file. An executable helper, or any failure here, runs as it is.
|
|
261
|
+
*/
|
|
262
|
+
export function runnableHelper(helper, { fsImpl = fs, tmp = os.tmpdir() } = {}) {
|
|
263
|
+
try {
|
|
264
|
+
if (process.platform === "win32" || (fsImpl.statSync(helper).mode & 0o111) !== 0) return helper;
|
|
265
|
+
const bytes = fsImpl.readFileSync(helper);
|
|
266
|
+
const copy = path.join(tmp, `rightkit-swap-${createHash("sha256").update(bytes).digest("hex").slice(0, 16)}`);
|
|
267
|
+
let ready = false;
|
|
268
|
+
try { ready = fsImpl.readFileSync(copy).equals(bytes) && (fsImpl.statSync(copy).mode & 0o111) !== 0; } catch { ready = false; }
|
|
269
|
+
if (!ready) { fsImpl.writeFileSync(copy, bytes, { mode: 0o755 }); fsImpl.chmodSync(copy, 0o755); }
|
|
270
|
+
return copy;
|
|
271
|
+
} catch { return helper; }
|
|
272
|
+
}
|
|
273
|
+
|
|
256
274
|
export function createSwapPaths({ env = process.env, resolve = resolveSwapHelper, execFileSync = nodeExecFileSync, assertSigned = assertShippedSwapHelperSigned } = {}) {
|
|
257
275
|
const checked = new Set();
|
|
258
276
|
return (a, b) => {
|
|
259
277
|
const helper = resolve({ env });
|
|
260
278
|
if (!helper) throw coded("ENOHELPER", `${SWAP_HELPER_NAME} helper not found`);
|
|
261
279
|
if (!checked.has(helper)) { assertSigned({ file: helper, execFileSync }); checked.add(helper); }
|
|
262
|
-
|
|
280
|
+
const program = runnableHelper(helper);
|
|
281
|
+
try { execFileSync(program, [a, b], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }); }
|
|
263
282
|
catch (error) {
|
|
264
283
|
const text = `${error?.stderr || ""}`.trim();
|
|
265
284
|
if (error?.code === "ENOENT" || error?.code === "EACCES") throw coded("ENOHELPER", `${helper} cannot run: ${error.code}`);
|
package/local-publish.mjs
CHANGED
|
@@ -267,7 +267,12 @@ const defaultReadJson = (file) => { try { return JSON.parse(fs.readFileSync(file
|
|
|
267
267
|
|
|
268
268
|
async function defaultRegistryHas({ kind, name, version }) {
|
|
269
269
|
if (kind === "npm") {
|
|
270
|
-
|
|
270
|
+
// npm is a .cmd shim on Windows, which Node starts only through cmd.exe: started directly it never ran and the error was empty (0.6.81 on the
|
|
271
|
+
// Dell, the first npm unit packaged there). The arguments are a validated package name, a version and a fixed URL.
|
|
272
|
+
const args = ["view", `${name}@${version}`, "version", "--prefer-online", "--registry", "https://registry.npmjs.org/"];
|
|
273
|
+
const view = process.platform === "win32"
|
|
274
|
+
? spawnSync(process.env.ComSpec || "cmd.exe", ["/d", "/s", "/c", "npm", ...args], { encoding: "utf8", windowsHide: true })
|
|
275
|
+
: spawnSync("npm", args, { encoding: "utf8", windowsHide: true });
|
|
271
276
|
const out = `${view.stdout ?? ""}${view.stderr ?? ""}`;
|
|
272
277
|
if (!view.error && view.status === 0) return (view.stdout ?? "").trim() === version;
|
|
273
278
|
if (/E404|404 Not Found/i.test(out)) return false;
|
|
@@ -675,11 +680,11 @@ function assertLocalHost(deps, workspaceRoot, kind, { qualifyOnly = false, unit
|
|
|
675
680
|
const platform = deps.platform ?? process.platform;
|
|
676
681
|
if (!(deps.localBuildGranted ?? localBuildGranted)(workspaceRoot)) refuse(`--local needs the local-build grant: a committed ${LOCAL_BUILD_FILE} (allow "build-test-publish") naming this repository at ${workspaceRoot}`);
|
|
677
682
|
if (!Object.hasOwn(LOCAL_HOST_POLICIES, platform)) refuse(`--local runs on the Mac (host policy: darwin-only), Windows (host policy: win32-only) or a Linux direct origin (linux-direct); this host is ${platform}`);
|
|
678
|
-
//
|
|
679
|
-
//
|
|
680
|
-
//
|
|
681
|
-
|
|
682
|
-
if (kind === "npm" && platform !== "darwin" && !
|
|
683
|
+
// A qualification reads no registry token (the upload is publish.yml), so the Mac, Windows and a Linux direct origin all qualify every npm
|
|
684
|
+
// package, @rightkit/release included: off the Mac its Developer-ID-signed helper is built and signed hosted (publish.yml build-swap/sign-swap)
|
|
685
|
+
// and is left out of the content digest (pack-digest exclusionsFor). Host uploads are retired (host-upload-refusal.mjs), so --local without
|
|
686
|
+
// --qualify-only stays refused off the Mac as before; the direct npm upload is `right-release publish-local npm` (publish-local-npm.mjs).
|
|
687
|
+
if (kind === "npm" && platform !== "darwin" && !qualifyOnly) refuse(`publish npm --local uploads only through publish-local npm; on ${platform} it qualifies (--qualify-only, the gate's unit stages)`);
|
|
683
688
|
return platform;
|
|
684
689
|
}
|
|
685
690
|
|
|
@@ -973,8 +978,9 @@ async function* publishUnitStages(parsed, deps, batch) {
|
|
|
973
978
|
const cleanup = () => fs.rmSync(scratch, { recursive: true, force: true });
|
|
974
979
|
try {
|
|
975
980
|
let artifactFile; const packCommands = [];
|
|
976
|
-
if (kind === "npm" && unit === SWAP_HELPER_PACKAGE && platform
|
|
977
|
-
//
|
|
981
|
+
if (kind === "npm" && unit === SWAP_HELPER_PACKAGE && platform === "darwin") {
|
|
982
|
+
// Windows and a Linux direct origin skip this (only the Mac can Developer-ID sign): they pack without the helper and the hosted
|
|
983
|
+
// sign-swap job binds the sealed one.
|
|
978
984
|
// #258: the package ships a Developer-ID-signed bin/darwin/rightkit-swap; build, sign and verify it before packing (fails closed). The
|
|
979
985
|
// helper and its signing receipt are written into the unit's own directory of the snapshot (packages/release/bin/darwin, both ignored by
|
|
980
986
|
// packages/release/.gitignore): declared stage outputs of this stage, recorded by the gate's stage-output ledger (stage-ledger.mjs) like
|
|
@@ -686,6 +686,126 @@
|
|
|
686
686
|
"M3": "ViewRight has no supervised app engine or restart-surviving app jobs. Document work stays local, and rightkit-ocr owns its worker.",
|
|
687
687
|
"M7": "ViewRight has no product local service. rightkit-daemon supplies roots under M6, the shell owns single-instance handoff, and opt-in control belongs to rightkit-qa."
|
|
688
688
|
}
|
|
689
|
+
},
|
|
690
|
+
"pulse": {
|
|
691
|
+
"issue": "bogusyogi/pulse#643",
|
|
692
|
+
"source": "Pulse's .rightkit/ownership-exceptions.json entries that still apply after the RightKit port (bogusyogi/pulse#643), each tracked by its RightKit issue and approved by Adrian 2026-11-07",
|
|
693
|
+
"profile": "desktop",
|
|
694
|
+
"note": "Expiring ownership exceptions ratified for Pulse. Each expires 2026-11-30; the code moves into RightKit through the named issue or the entry is renewed with a fresh approval.",
|
|
695
|
+
"exceptions": [
|
|
696
|
+
{
|
|
697
|
+
"capability": "dependency-allowlist",
|
|
698
|
+
"package": "RightKit dependency allowlist",
|
|
699
|
+
"path": "engine/Cargo.toml",
|
|
700
|
+
"issue": "bogusyogi/rightkit#846",
|
|
701
|
+
"expires": "2026-11-30",
|
|
702
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"capability": "os-credential-store",
|
|
706
|
+
"package": "RightKitSwift",
|
|
707
|
+
"path": "ios/Sources/Approvals/ApprovalKey.swift",
|
|
708
|
+
"issue": "bogusyogi/rightkit#1038",
|
|
709
|
+
"expires": "2026-11-30",
|
|
710
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
"capability": "os-credential-store",
|
|
714
|
+
"package": "RightKitSwift",
|
|
715
|
+
"path": "mac/Notch/Sources/Agent/ChatUnlockPanel.swift",
|
|
716
|
+
"issue": "bogusyogi/rightkit#1038",
|
|
717
|
+
"expires": "2026-11-30",
|
|
718
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"capability": "theme-ui",
|
|
722
|
+
"package": "@rightkit/theme",
|
|
723
|
+
"path": "mac/Notch/Sources/Launcher/ClipboardStripView.swift",
|
|
724
|
+
"issue": "bogusyogi/rightkit#847",
|
|
725
|
+
"expires": "2026-11-30",
|
|
726
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"capability": "dependency-allowlist",
|
|
730
|
+
"package": "RightKit dependency allowlist",
|
|
731
|
+
"path": "membrane/engine/crates/membrane-runtime/Cargo.toml",
|
|
732
|
+
"issue": "bogusyogi/rightkit#846",
|
|
733
|
+
"expires": "2026-11-30",
|
|
734
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"capability": "search",
|
|
738
|
+
"package": "rightkit-search",
|
|
739
|
+
"path": "membrane/engine/crates/membrane-runtime/src/ledger/query.rs",
|
|
740
|
+
"issue": "bogusyogi/rightkit#851",
|
|
741
|
+
"expires": "2026-11-30",
|
|
742
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"capability": "dependency-allowlist",
|
|
746
|
+
"package": "RightKit dependency allowlist",
|
|
747
|
+
"path": "membrane/engine/crates/membrane/Cargo.toml",
|
|
748
|
+
"issue": "bogusyogi/rightkit#846",
|
|
749
|
+
"expires": "2026-11-30",
|
|
750
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"capability": "dependency-allowlist",
|
|
754
|
+
"package": "RightKit dependency allowlist",
|
|
755
|
+
"path": "rightkit-mesh-ffi/Cargo.toml",
|
|
756
|
+
"issue": "bogusyogi/rightkit#849",
|
|
757
|
+
"expires": "2026-11-30",
|
|
758
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"capability": "dependency-allowlist",
|
|
762
|
+
"package": "RightKit dependency allowlist",
|
|
763
|
+
"path": "rightkit-mesh-ffi/ios-netwatch/Cargo.toml",
|
|
764
|
+
"issue": "bogusyogi/rightkit#849",
|
|
765
|
+
"expires": "2026-11-30",
|
|
766
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"capability": "qa-evidence",
|
|
770
|
+
"package": "@rightkit/qa",
|
|
771
|
+
"path": "scripts/qa/win-installed/link-uia.mjs",
|
|
772
|
+
"issue": "bogusyogi/rightkit#1046",
|
|
773
|
+
"expires": "2026-11-30",
|
|
774
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"capability": "local-services",
|
|
778
|
+
"package": "rightkit-daemon",
|
|
779
|
+
"path": "swift/RightKitHub/Sources/RightKitEngineClient/AttachedTransport.swift",
|
|
780
|
+
"issue": "bogusyogi/rightkit#852",
|
|
781
|
+
"expires": "2026-11-30",
|
|
782
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"capability": "windows-native-overlay-renderer",
|
|
786
|
+
"package": "rightkit-overlay-win",
|
|
787
|
+
"path": "windows/src/clip_strip.rs",
|
|
788
|
+
"issue": "bogusyogi/rightkit#914",
|
|
789
|
+
"expires": "2026-11-30",
|
|
790
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"capability": "theme-ui",
|
|
794
|
+
"package": "@rightkit/theme",
|
|
795
|
+
"path": "windows/src/clip_strip/draw.rs",
|
|
796
|
+
"issue": "bogusyogi/rightkit#847",
|
|
797
|
+
"expires": "2026-11-30",
|
|
798
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
"capability": "windows-native-overlay-renderer",
|
|
802
|
+
"package": "rightkit-overlay-win",
|
|
803
|
+
"path": "windows/src/shot.rs",
|
|
804
|
+
"issue": "bogusyogi/rightkit#914",
|
|
805
|
+
"expires": "2026-11-30",
|
|
806
|
+
"approvedBy": "Adrian D'Souza, 2026-11-07: \"for now, you can test with ownership exception but eventually we do the whole port\""
|
|
807
|
+
}
|
|
808
|
+
]
|
|
689
809
|
}
|
|
690
810
|
},
|
|
691
811
|
"amendments": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/release",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.81",
|
|
4
4
|
"description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -87,16 +87,10 @@
|
|
|
87
87
|
"!gate/*.test.mjs",
|
|
88
88
|
"!standalone-clone-evidence.json",
|
|
89
89
|
"!refusals.json",
|
|
90
|
-
"!provenance-real-receipt.fixture.json"
|
|
90
|
+
"!provenance-real-receipt.fixture.json",
|
|
91
|
+
"acceptance-lines.test.mjs"
|
|
91
92
|
],
|
|
92
93
|
"sideEffects": false,
|
|
93
|
-
"scripts": {
|
|
94
|
-
"test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs acceptance-cases.test.mjs rule-verdict-cache.test.mjs class-b-dispatch.test.mjs remember-reads.test.mjs sidecar-source.test.mjs caller-levers.test.mjs class-a-cache-history.test.mjs gate-fixed-levers.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
|
|
95
|
-
"test:registry-parity": "node registry-parity.mjs --allow-unpublished",
|
|
96
|
-
"test:signer:windows": "node sign-release-manifest.integration.mjs",
|
|
97
|
-
"prepublishOnly": "pnpm test:signer:windows && pnpm test:registry-parity",
|
|
98
|
-
"verify:standalone": "node standalone-clone-verify.mjs"
|
|
99
|
-
},
|
|
100
94
|
"publishConfig": {
|
|
101
95
|
"registry": "https://registry.npmjs.org/",
|
|
102
96
|
"access": "public"
|
|
@@ -106,9 +100,14 @@
|
|
|
106
100
|
"url": "git+https://github.com/bogusyogi/rightkit.git",
|
|
107
101
|
"directory": "packages/release"
|
|
108
102
|
},
|
|
109
|
-
"packageManager": "pnpm@12.16.1",
|
|
110
103
|
"dependencies": {
|
|
111
104
|
"@rightkit/outdated": "0.3.0",
|
|
112
105
|
"smol-toml": "1.9.1"
|
|
106
|
+
},
|
|
107
|
+
"scripts": {
|
|
108
|
+
"test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs acceptance-cases.test.mjs rule-verdict-cache.test.mjs class-b-dispatch.test.mjs remember-reads.test.mjs sidecar-source.test.mjs caller-levers.test.mjs class-a-cache-history.test.mjs gate-fixed-levers.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs publish-local-npm.test.mjs shell-contract-hub-window.test.mjs cargo-license-notices-paths.test.mjs rightkit-freshness-direct.test.mjs swap-helper-committed.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
|
|
109
|
+
"test:registry-parity": "node registry-parity.mjs --allow-unpublished",
|
|
110
|
+
"test:signer:windows": "node sign-release-manifest.integration.mjs",
|
|
111
|
+
"verify:standalone": "node standalone-clone-verify.mjs"
|
|
113
112
|
}
|
|
114
|
-
}
|
|
113
|
+
}
|
package/publish-cargo.mjs
CHANGED
|
@@ -16,8 +16,12 @@ import { formatPreflight, PREFLIGHT_FAIL } from "./preflight.mjs";
|
|
|
16
16
|
import { cargoManifestState } from "./cargo-manifest-text.mjs";
|
|
17
17
|
|
|
18
18
|
const FORBIDDEN_PACKAGE_PATH = /(^|\/)(?:\.env(?:\.[^/]*)?|target(?:\/.*)?|node_modules(?:\/.*)?|[^/]+\.(?:p8|p12|pem|key))$/i;
|
|
19
|
+
// A PEM private key is its header followed by key data: a line of base64, after a line break or after an escaped "\n" inside a string literal (a key
|
|
20
|
+
// pasted into code or JSON). The header alone is a format marker, as in code that checks an uploaded key's shape (rightkit-remote-gateway push_key.rs:
|
|
21
|
+
// valid_p8 compares the text with the BEGIN/END markers); it holds no key and is not flagged, so no exemption record is needed for it.
|
|
22
|
+
export const PEM_PRIVATE_KEY = /-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----(?:\r?\n|(?:\\r)?\\n)[A-Za-z0-9+/=]{40,}/;
|
|
19
23
|
export const SECRET_PATTERNS = [
|
|
20
|
-
|
|
24
|
+
PEM_PRIVATE_KEY,
|
|
21
25
|
/\bAKIA[0-9A-Z]{16}\b/,
|
|
22
26
|
/\bgh[pousr]_[A-Za-z0-9_]{20,}\b/,
|
|
23
27
|
/\bnpm_[A-Za-z0-9]{30,}\b/,
|
|
@@ -166,11 +170,11 @@ const RECORD_KEYS = Object.freeze(["path", "sha256", "kind", "note"]);
|
|
|
166
170
|
const RECORD_NOTE_PLACEHOLDER = "<what it holds and why it is safe>";
|
|
167
171
|
const ENV_TEMPLATE = /(^|\/)\.env(?:\.[^/]*)?\.(?:example|sample|template)$/i;
|
|
168
172
|
// Labels of SECRET_PATTERNS, index for index.
|
|
169
|
-
const SECRET_PATTERN_LABELS = Object.freeze(["a PEM private key
|
|
173
|
+
const SECRET_PATTERN_LABELS = Object.freeze(["a PEM private key", "an AWS access key id (AKIA)", "a GitHub token (gh*_)", "an npm token (npm_)"]);
|
|
170
174
|
// Credential shapes that are never a placeholder, matched in env templates besides SECRET_PATTERNS. Every expression is linear:
|
|
171
175
|
// each quantified class is followed by a delimiter it cannot match or by the end of the match.
|
|
172
176
|
const TEMPLATE_SHAPES = Object.freeze([
|
|
173
|
-
[
|
|
177
|
+
[PEM_PRIVATE_KEY, "a PEM private key"],
|
|
174
178
|
[/github_pat_[A-Za-z0-9_]{22,}/, "a GitHub fine-grained token (github_pat_)"],
|
|
175
179
|
[/sk_live_[A-Za-z0-9]{16,}/, "a Stripe live key (sk_live_)"],
|
|
176
180
|
[/xox[abprs]-[A-Za-z0-9-]{10,}/, "a Slack token (xox*-)"],
|