Skip to content

feat(runtime): pin the Node 24.21.0 server runtime with an offline CI check - #24087

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/node-rt-runtime-pin
Oct 1, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/node-rt-runtime-pin

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​263 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​261
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​623 $\color{#cf222e}{\Huge{\mathbf{−}}}$​25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​598

ELI5

Orca will run its headless and remote server on one exact Node version: the one Electron embeds, 24.21.0 today. This adds the table that records that version and the checksum of the official Node download for each platform, plus a CI check that fails if Electron is bumped without updating the table.

What Changed

  • src/shared/node-runtime-pin.ts:
    • NODE_RUNTIME_PIN: Node 24.21.0, Electron 43.7.5, N-API 10, and the hash of the headers tarball.
    • SERVER_TARGETS: the 8 server targets, now the only list. ORCAD_BUN_TARGETS is removed and its consumers use this list.
    • NODE_RUNTIME_ASSETS: the archive name, archive sha256, and executable sha256 and size for each target. Every target uses an official nodejs.org build except linux-arm64-musl, which comes from unofficial-builds.
  • config/scripts/update-node-runtime-pin.mjs --version X: regenerates the table. It fetches SHASUMS256.txt, verifies the official signature with gpg when gpg is installed, downloads and extracts each archive, and hashes the executable.
  • config/scripts/check-node-runtime-pin.mjs: an offline check in static_analysis and pnpm lint. It verifies that:
    • the lockfile's Electron version matches the pin;
    • the pin's Node major matches engines.node;
    • the assets cover exactly the 8 targets, with a valid archive name for each.
  • No behaviour change: orcad still ships Bun, and nothing downloads Node yet.

Why

This is the first step of the Node runtime plan, where orcad and the SSH relay run on a pinned Node instead of Bun or the host's Node. One table that build scripts, the client materializer and CI all import, following the existing orcad-bun-runtime.ts pattern, avoids having three places that each know the version. What happens when Electron's Node is newer or older than the pin is still an open design question, so the check only enforces the parts that hold either way.

Linked Issue

Part of the Node runtime plan (Phase 1). Related: #23525.

Visual Proof

N/A. It adds build and CI metadata and changes no runtime behaviour.

Testing

  • pnpm run check:node-runtime-pin passes, and unit tests cover the checker and the updater.

  • pnpm tc, oxlint and the changed-code gate pass.

  • Checked every archive hash against the live SHASUMS files. Independently downloaded linux-x64: the archive hash, executable hash and size match.

  • Not yet run: the gpg signature path, because gpg isn't installed on the machine that generated the table. Regenerate with gpg before relying on it.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

m4air added 2 commits September 30, 2026 01:48
… check

Add src/shared/node-runtime-pin.ts (NODE_RUNTIME_PIN, SERVER_TARGETS,
NODE_RUNTIME_ASSETS for all 8 server targets plus the headers tarball),
generated by config/scripts/update-node-runtime-pin.mjs from the nodejs.org
and unofficial-builds SHASUMS. check-node-runtime-pin.mjs verifies, with no
network, that the pin tracks the locked Electron, matches engines.node's
major, and covers exactly SERVER_TARGETS; it runs in the static analysis job.

ORCAD_BUN_TARGETS consumers now read SERVER_TARGETS so there is one target
list; orcad's Bun runtime and build output are unchanged.
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 1/5

[High risk] Reorganizes runtime configuration and adds offline consistency checks.

The PR is not safe to merge until pin regeneration stops executing insufficiently authenticated downloads and refuses to write a pin when official signature verification is skipped.

Findings

  1. P1 Security Unsigned download is executed ▶
  2. P1 Security Failed verification still writes pin ▶
  3. P2 Design reference is missing ▶

Summary

The PR adds a shared Node runtime pin and eight-target asset table, a networked regeneration script, and an offline CI/lint consistency check. Existing Bun target consumers move to the shared target list. The regeneration path needs stronger checksum trust checks before the pin is relied on.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Official and unofficial SHASUMS] --> B[Pin updater]
  B --> C[Download and hash archives]
  C --> D[Execute matching-host binary]
  C --> E[Write shared pin table]
  E --> F[Offline CI consistency check]
Loading

Reviews (1) · Last reviewed commit: "fix(runtime): reject a pinned archive th..."

Comment on lines +258 to +262
if (target === currentTarget()) {
const reported = run(executablePath, [
'-p',
'`${process.version} ${process.versions.napi}`'
]).trim()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Unsigned download is executed. On a linux-arm64-musl developer host, the updater checks the downloaded Node executable against a checksum from the same unsigned, unofficial source, then runs it here. If that source is compromised, it can supply both a malicious executable and a matching checksum, causing code execution during pin regeneration. Avoid running the executable without an independent trust check.

How this was verified: The linux-arm64-musl asset uses unsigned unofficial checksums, and a matching host runs the extracted executable.

try {
const shasumsPath = join(workDir, 'SHASUMS256.txt')
await download(nodeRuntimeReleaseUrl('official', 'SHASUMS256.txt', version), shasumsPath)
await verifyOfficialShasums(version, workDir, shasumsPath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Failed verification still writes pin. If gpg is unavailable or the release keyring cannot be fetched, signature verification returns false, but this call ignores the result. Regeneration then writes hashes from the unverified official SHASUMS file, and the offline CI check cannot detect that the hashes were not authenticated. Require successful signature verification before writing the pin.

How this was verified: Both verification-skip paths return false, while the caller continues to consume the checksums and write the table.

@@ -0,0 +1,134 @@
/**
* The one Node runtime Orca runs outside Electron (docs/reference/node-runtime-design.html, D1).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Design reference is missing. This comment points readers to docs/reference/node-runtime-design.html for the Node version policy, but that document is absent from the repository. Add the document or replace the reference with an available explanation so future pin updates have a policy to follow.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The change adds shared Node runtime pin data for eight server targets and a script that generates the pin block from Node release artifacts. It adds an offline check for pin consistency with package and lockfile metadata, and runs that check in lint and static analysis. ORCAD code and scripts now use the shared server-target definitions.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 60201

This change adds a pinned Node runtime definition and checks that keep it consistent with the repository. The runtime behavior does not change, because nothing downloads Node yet. The one concern is that the pin generator can write hashes without verifying the release signature. Regenerate the pin with GPG available before relying on it.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 60201

The runtime migration is not activated, and current packaging still uses Bun. However, the manual updater can generate trusted pin data without completing release-signature verification. HTTPS, checksum comparisons, and explicit signature-failure rejection limit exposure, but do not eliminate this authentication gap.

Retained concerns

  • Low · security · observed: The added updater permits release-signature verification to be skipped without blocking executable validation or shared pin publication. Consequently, the generated hashes can inherit only the download origin's TLS trust rather than authenticated release provenance.
Security review details

Security Blast Radius

  • inferred — During an unsigned generation run, control of both an accepted checksum response and its matching archive could affect an individual target or all targets served by that origin. Official metadata also supplies headers; the currently committed unofficial scope is linux-arm64-musl. This requires defeating or controlling the trusted HTTPS delivery path, not merely choosing an arbitrary version.
  • inferred — A substituted current-platform executable could execute during manual regeneration before pin publication. The immediate affected boundary is the invoking host process; propagation to production runtime execution is not demonstrated because this PR does not activate Node materialization.

Security Findings and Attack Paths

  • observed — The retained finding concerns a fail-open authentication transition: missing GPG or a failed keyring download returns false, but the caller continues. Explicit signature rejection does stop generation. The added workflow therefore distinguishes a bad signature from unavailable authentication, allowing the latter to reach shared pin publication.

Trust Boundaries and Controls

  • observed — HTTPS and archive checksum matching remain controls even when official signature verification is skipped. They do not independently authenticate a manifest and archive compromised together. The unofficial checksum list is fetched without the official signature control, so successful official verification does not authenticate unofficial assets.

Resilience and Maintainability Implications

  • observed — The offline gate rejects malformed or inconsistent pin metadata, but has no authentication-result input. It therefore cannot enforce recovery from a generation run that skipped signature verification, even when every checksum and target entry is structurally valid.

Hardening Proposals

  • proposed — Require successful official release authentication before extraction, executable validation, or pin publication. Treat unavailable verification as a generation failure rather than a warning.
  • proposed — Define an explicit authentication policy for unofficial assets before future runtime consumers inherit this contract, distinguishing deliberate TLS-only trust from independently authenticated provenance.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 12 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: pinning the Node 24.21.0 server runtime and adding an offline CI check.
Description check ✅ Passed The description is substantially complete. It includes the ELI5, changes, rationale, linked issue, visual proof, testing, and agent-boundary sections. The Review, Notes, and full Checklist sections ar…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 16.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 12 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: bcb638ca-cf87-4b58-8c6b-186080cd1441

📥 Commits

Reviewing files that changed from the base of the PR and between b99462a and 6020197.

📒 Files selected for processing (14)
  • .github/workflows/pr.yml
  • config/scripts/build-orcad-template.mjs
  • config/scripts/check-node-runtime-pin.mjs
  • config/scripts/check-node-runtime-pin.test.mjs
  • config/scripts/orcad-artifact-version.test.mjs
  • config/scripts/orcad-template-test-fixture.mjs
  • config/scripts/orcad-watcher-package.mjs
  • config/scripts/update-node-runtime-pin.mjs
  • config/scripts/update-node-runtime-pin.test.mjs
  • config/scripts/verify-packaged-orcad-template.cjs
  • package.json
  • src/main/orcad/orcad-artifact-identity.ts
  • src/shared/node-runtime-pin.ts
  • src/shared/orcad-bun-runtime.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment on lines +188 to +195
async function verifyOfficialShasums(version, workDir, shasumsPath) {
if (!gpgAvailable()) {
console.warn(
'\n!!! WARNING: gpg is not installed, so SHASUMS256.txt was NOT signature-verified.\n' +
'!!! Its hashes are trusted over TLS only. Install gpg and rerun before committing a pin.\n'
)
return false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🛡️ Detected with Advanced Tier | 🟡 Minor | ⚡ Quick win

Security Misconfiguration

Reachability: Internal
Exploitability: Difficult
CWE: CWE-345

Fail by default when the generator cannot verify the SHASUMS256.txt signature. main ignores the false result from verifyOfficialShasums, so the script can write pin data after signature verification was skipped. Throw unless the user passes an explicit --allow-unverified opt-out.

View in Security blast radius

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues — the pinned hashes check out against the live SHASUMS files. Three small suggestions inline.

Reviewed changes

This PR adds the shared Node runtime pin and its offline consistency gate, with no runtime behaviour change:

  • src/shared/node-runtime-pin.ts (new) — SERVER_TARGETS (8 targets), ORCAD_TEMPLATE_TARGETS, NODE_RUNTIME_PIN (Node 24.21.0 / Electron 43.7.5 / NAPI 10 / headers hash), the generated NODE_RUNTIME_ASSETS table, and the nodeRuntimeReleaseUrl / nodeRuntimeExecutablePath helpers.
  • config/scripts/update-node-runtime-pin.mjs (new) — network regenerator that fetches SHASUMS256.txt (optional gpg verify), downloads/extracts/hashes each target, and rewrites the @generated block.
  • config/scripts/check-node-runtime-pin.mjs (new) — offline gate over the Electron pin, lockfile, engines.node, napi, headers, and the 8 assets' names/hashes/sizes.
  • src/shared/orcad-bun-runtime.ts — drops ORCAD_BUN_TARGETS / ORCAD_TEMPLATE_TARGETS; OrcadBunTarget aliased to ServerTarget.
  • Consumer repointing + wiring — build/watcher/verify scripts and orcad-artifact-identity.ts moved to SERVER_TARGETS; check:node-runtime-pin wired into lint and the static_analysis job.

I verified locally that pnpm run tc:node, pnpm run check:node-runtime-pin, and both new test files pass, and confirmed every archiveSha256 (plus the Windows node.exe hashes) against the live official and unofficial SHASUMS files. linux-x64-musl is correctly marked official (nodejs.org does publish it, with a different hash than unofficial) and linux-arm64-musl correctly unofficial.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@@ -0,0 +1,134 @@
/**
* The one Node runtime Orca runs outside Electron (docs/reference/node-runtime-design.html, D1).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This JSDoc treats docs/reference/node-runtime-design.html as the authority for decision D1, but no such file exists: docs/reference/ is entirely .md, and there are no .html files anywhere under docs/. config/scripts/check-node-runtime-pin.mjs:59 cites the same path. The deferred-design rationale is unfollowable until the doc is added or the reference is corrected to where D1 actually lives.

NODE_RUNTIME_PIN,
SERVER_TARGETS
} from '../../src/shared/node-runtime-pin.ts'
import { nodeDistArchiveName } from './update-node-runtime-pin.mjs'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gate's own header says the updater owns the network and this check is static/offline, yet it imports nodeDistArchiveName from the 340-line network client — pulling build-orcad-bun.mjs and the download/extract tooling into every pnpm lint and static_analysis run. The archive-name mapping is shared contract (nodeRuntimeReleaseUrl and nodeRuntimeExecutablePath already live in node-runtime-pin.ts); moving NODE_DIST_PLATFORMS/nodeDistArchiveName there would keep this gate dependency-light and give later phases the same table.

Comment on lines +33 to +35
for (const target of SERVER_TARGETS) {
expect(nodeDistArchiveName('24.21.0', target)).not.toContain('undefined')
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not.toContain('undefined') passes for any mapping that isn't literally the string undefined, so a wrong platform suffix (e.g. mapping linux-arm64-glibc to linux-x64) would still pass. Asserting the exact expected archive name per target would make this pin the mapping instead of smoke-testing it.

@OrcaWin
OrcaWin merged commit 3135fbb into main Oct 1, 2026
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant