Supply exact private platform source to sealed checks without private evaluator egress
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
#!/usr/bin/env node
|
||||
import { loadQuixosLock } from "./loader.js";
|
||||
import { parseQuixosLockDocument } from "./parser.js";
|
||||
import { readFile, stat } from "node:fs/promises";
|
||||
|
||||
// A trusted fetcher can inspect the root's declared platform pin without
|
||||
// following authored import paths or evaluating Nix. The input is a fetched
|
||||
// Git blob, not a filesystem tree provided by an author.
|
||||
if (process.argv[2] === "--platform-only") {
|
||||
const filename = process.argv[3];
|
||||
if (process.argv.length !== 4 || !filename || (await stat(filename)).size > 1024 * 1024)
|
||||
throw Error("INVALID_PLATFORM_SOURCE_LOCK");
|
||||
const result = parseQuixosLockDocument(await readFile(filename, "utf8"));
|
||||
if (!result.ok || result.document.kind !== "root") throw Error("INVALID_PLATFORM_SOURCE_LOCK");
|
||||
console.log(JSON.stringify({ repository: result.document.quixos.repository, commit: result.document.quixos.commit }));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const fileName = process.argv[2];
|
||||
if (!fileName || process.argv.length !== 3) {
|
||||
|
||||
Reference in New Issue
Block a user