Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(security): pin NodeSource bootstrap bytes

Abdurrahman Fakhrulccc927389b79
diff --git a/scripts/install-core.sh b/scripts/install-core.sh
index 497f7a92..0d5c5d3e 100755
--- a/scripts/install-core.sh
+++ b/scripts/install-core.sh
@@ -49,6 +49,10 @@ SERVICE_ATTEMPTED=0
# immutable Git commit and verified before execution. Update both values together.
BUN_BOOTSTRAP_COMMIT="0d9b296af33f2b851fcbf4df3e9ec89751734ba4"
BUN_BOOTSTRAP_SHA256="bab8acfb046aac8c72407bdcce903957665d655d7acaa3e11c7c4616beae68dd"
+# NodeSource's convenience URL is mutable. Pin the reviewed setup script by
+# repository commit and byte digest before giving it root authority.
+NODESOURCE_SETUP_COMMIT="c6e581b0d24e5d043476ddb947d70e6fe10e83c9"
+NODESOURCE_SETUP_SHA256="575583bbac2fccc0b5edd0dbc03e222d9f9dc8d724da996d22754d6411104fd1"
# ---- pretty output (tty + NO_COLOR aware) ----
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
@@ -253,8 +257,19 @@ ensure_node() {
die "this Node release is not supported; select Node 22.12+, 24.x or 26+. The installer will not downgrade a newer runtime."
fi
if command -v apt-get >/dev/null 2>&1; then
- info "installing Node 22 via NodeSource…"
- curl -fsSL https://deb.nodesource.com/setup_22.x | sudo_do -E bash -
+ info "installing Node 22 via pinned NodeSource bootstrap…"
+ command -v sha256sum >/dev/null 2>&1 || die "sha256sum is required to verify the NodeSource bootstrap."
+ local setup actual url
+ setup="$(mktemp)"
+ url="https://raw.githubusercontent.com/nodesource/distributions/$NODESOURCE_SETUP_COMMIT/scripts/deb/setup_22.x"
+ curl -fsSL "$url" -o "$setup" || { rm -f "$setup"; die "NodeSource bootstrap download failed."; }
+ actual="$(sha256sum "$setup" | awk '{print $1}')"
+ [ "$actual" = "$NODESOURCE_SETUP_SHA256" ] || {
+ rm -f "$setup"
+ die "NodeSource bootstrap integrity check failed."
+ }
+ sudo_do -E bash "$setup" || { rm -f "$setup"; die "NodeSource bootstrap failed."; }
+ rm -f "$setup"
sudo_do apt-get install -y -qq nodejs
else
die "install Node 22.12+, 24.x or 26+ (22 recommended) from https://nodejs.org or your distro, then re-run."
diff --git a/scripts/install-supply-chain.test.ts b/scripts/install-supply-chain.test.ts
new file mode 100644
index 00000000..62572158
--- /dev/null
+++ b/scripts/install-supply-chain.test.ts
@@ -0,0 +1,14 @@
+import fs from "node:fs";
+import { describe, expect, it } from "vitest";
+
+describe("installer bootstrap supply chain", () => {
+ const source = fs.readFileSync("scripts/install-core.sh", "utf8");
+
+ it("pins NodeSource setup to an immutable repository commit and SHA-256", () => {
+ expect(source).toMatch(/NODESOURCE_SETUP_COMMIT="[0-9a-f]{40}"/);
+ expect(source).toMatch(/NODESOURCE_SETUP_SHA256="[0-9a-f]{64}"/);
+ expect(source).toContain("raw.githubusercontent.com/nodesource/distributions/$NODESOURCE_SETUP_COMMIT/scripts/deb/setup_22.x");
+ expect(source).toContain('sha256sum "$setup"');
+ expect(source).not.toMatch(/deb\.nodesource\.com\/setup_22\.x\s*\|\s*(?:sudo_do\s+-E\s+)?bash/);
+ });
+});