From 7c17902b1b91bbea92791c5cdfbe76fe51755eee Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 6 Sep 2026 22:07:47 +0200 Subject: [PATCH] Ship the interpreter inside the sealed release Idunn compares the running process's executable inode against the sealed artifact. A shebang script can never satisfy that: the kernel execs the interpreter, so the process's executable is /usr/bin/node and the check correctly reports an executable inode outside the sealed release. That is an integrity property worth keeping, not a check to relax, and it explains why every target with a recipe so far has been Rust. The fix that preserves it is to make the interpreter part of the release: a build step copies the runner image's own node into dist/, it ships as the executable artifact, and the bundle becomes its first argument. The executed inode is then sealed like everything else, and the node version is pinned to the runner image digest rather than being whatever the host happens to have. Costs a ~110 MB binary per release against retain_releases = 3. Cheaper than Node's single-executable tooling and it needs no postject. Co-Authored-By: Claude Opus 5 --- deployment/idunn/recipe.toml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/deployment/idunn/recipe.toml b/deployment/idunn/recipe.toml index d57b13e..ce08b06 100644 --- a/deployment/idunn/recipe.toml +++ b/deployment/idunn/recipe.toml @@ -92,17 +92,40 @@ argv = ["corepack", "pnpm", "bundle"] # The unit runs dist/src/index.js, and Node resolves its imports at runtime, so # the release is the compiled output plus the production dependency tree. These # are the two artifacts; nothing else from the build tree is installed. +[[steps]] +id = "stage-node" +phase = "build" +runner = "node-build" +required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"] +argv = ["node", "-e", "require('fs').copyFileSync(process.execPath, 'dist/node')"] + +# Idunn compares the running process's executable inode against the sealed +# artifact, so the executed inode must live inside the release. A shebang script +# cannot satisfy that: the kernel execs the interpreter, and the process's +# executable is /usr/bin/node rather than anything sealed. Shipping the runner +# image's own node as the executable brings the interpreter inside the seal and +# pins it to the runner image digest, which is a stronger guarantee than +# depending on whatever node the host happens to have. [[artifacts]] -id = "heimdall" +id = "node" +source_kind = "runner-output" +runner = "node-build" +source = "dist/node" +destination = "node" +executable = true + +[[artifacts]] +id = "heimdall-bundle" source_kind = "runner-output" runner = "node-build" source = "dist/heimdall" -destination = "heimdall" -executable = true +destination = "heimdall.mjs" +executable = false [service] -executable_artifact = "heimdall" +executable_artifact = "node" arguments = [ + { kind = "literal", value = "heimdall.mjs" }, { kind = "literal", value = "--state-root" }, { kind = "binding", name = "state_root" }, ]