Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ name: release
# (prepack writes its npm-shrinkwrap.json; pack:check verifies it and that nothing
# in the published tree has an install script), writes an SBOM per package,
# uploads them as an artifact. No id-token, no secrets.
# Every job runs Harden-Runner in block mode with its own allow list.
# version, build, publish and tag run on Linux with Harden-Runner in block mode, each with
# its own allow list.
# publish downloads the tarballs, attests them and publishes with npm trusted publishing.
# No checkout, no install, no cache, runs in the protected "npm" environment,
# with Harden-Runner blocking every host outside its allow list (as in tag).
Expand All @@ -16,6 +17,7 @@ name: release
# standalone after a turno-browser release, the standalone executables (standalone.yml),
# built from the tarball that was published and uploaded to its GitHub release. It
# runs after npm has the version, so a failure here never holds back the npm release.
# Its build job runs on macOS, where Harden-Runner can only audit (see standalone.yml).
on:
push:
branches: [main]
Expand Down
22 changes: 17 additions & 5 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ name: standalone
# npm (scripts/standalone-build.mjs). Three jobs, so the one that can write never runs project code:
# build on macOS (the macOS executables are signed ad hoc there), every target from the
# same packed package and the pinned Node.js; uploads the archives and SHA256SUMS
# as an artifact. No id-token, no secrets.
# as an artifact. No id-token, no secrets. Harden-Runner only audits it: GitHub's
# macOS runners do not support block mode.
# smoke on each platform: the executable answers --version and an MCP initialize
# (scripts/standalone-smoke.mjs). Windows is experimental and may fail.
# (scripts/standalone-smoke.mjs). Windows is experimental and may fail. Harden-Runner
# blocks on Linux and audits on macOS and Windows.
# release attests the archives and uploads them with SHA256SUMS to the GitHub release
# turno-browser@<version>. Skipped in a dry run, which keeps them in the run's artifact.
# turno-browser@<version>, with Harden-Runner blocking every host outside its allow
# list. Skipped in a dry run, which keeps them in the run's artifact.
# Signing: the macOS executables are signed ad hoc and the Windows one is not signed, so
# Gatekeeper and SmartScreen warn on a browser download (the docs say what to do). Developer ID
# signing and notarization, or Authenticode, would sign each executable in the build job before
Expand Down Expand Up @@ -61,6 +64,15 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
steps:
# Audit mode only: on GitHub's macOS runners Harden-Runner can log connections but not
# block them (block mode is Linux only). The job holds no write credential: contents: read,
# no id-token, no secrets. The Node.js archives it embeds are checked against the SHA-256
# in standalone-node.json and the packages against pnpm-lock.yaml or npm-shrinkwrap.json;
# the Node.js and pnpm it runs with (setup-node, action-setup) are pinned by action SHA
# but not checksummed.
- uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
Expand Down Expand Up @@ -121,10 +133,10 @@ jobs:
permissions:
contents: read # check out the smoke script
steps:
# Block mode on Linux; on GitHub's macOS and Windows runners Harden-Runner can only audit.
- uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
if: runner.os == 'Linux'
with:
egress-policy: block
egress-policy: ${{ runner.os == 'Linux' && 'block' || 'audit' }}
allowed-endpoints: >
github.com:443
api.github.com:443
Expand Down
18 changes: 14 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,20 @@ laptop, with npm trusted publishing: there is no long-lived npm token. One job r
and packs the tarballs; a separate job, in a protected environment that a maintainer approves,
attests and publishes those same tarballs without checking out the repository, installing
anything or using a cache, so no project or dependency code runs where the publishing
credential lives. Every release job can reach only the hosts on its allow list. `turno-cli`
and `turno-browser` ship an `npm-shrinkwrap.json`, so `npm install --global` installs the
exact dependency tree that CI tested, and nothing in it runs an install script. Each GitHub
release carries a CycloneDX SBOM. Details: [docs/RELEASING.md](docs/RELEASING.md).
credential lives. The release jobs on Linux (the version pull request, tests and packing,
publishing, tagging, the upload of the standalone archives) can reach only the hosts on their
allow list (Harden-Runner in block mode). The job that builds the standalone turno-browser
executables runs on macOS, where Harden-Runner can only log connections, not block them: it
holds no write credential, checks the Node.js archives it embeds against a pinned SHA-256 and
installs packages against their lockfile integrity, and a separate Linux job with an allow list
attests and uploads its archives. The Node.js and pnpm that job runs with come from
actions/setup-node and pnpm/action-setup, pinned by commit SHA but not checked against a
checksum. `turno-cli` and `turno-browser` ship an `npm-shrinkwrap.json`, so
`npm install --global` from the registry and the Homebrew formula (`npm ci` in the package
folder) install the exact dependency tree that CI tested, and nothing in it runs an install
script. Installing a downloaded tarball (`npm install --global ./turno-cli-<version>.tgz`) does
not: npm then ignores the shrinkwrap and resolves the dependencies again. Each GitHub release
carries a CycloneDX SBOM. Details: [docs/RELEASING.md](docs/RELEASING.md).

To verify what you installed:

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/(docs)/get-started/install.es.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ turno version
`turno upgrade` actualiza turno después con la misma herramienta que lo instaló. CI instala la versión empaquetada con cada una de estas en macOS y Linux y la ejecuta.

- El paquete no ejecuta scripts de instalación, así que pnpm y bun, que bloquean los scripts de las dependencias por defecto, no piden aprobación.
- npm y Homebrew instalan exactamente las versiones de dependencias que se probaron, desde el `npm-shrinkwrap.json` del paquete. pnpm, bun y yarn no leen ese archivo: instalan las mismas dependencias directas (fijadas a versiones exactas) y resuelven por su cuenta las dependencias de esas.
- npm y Homebrew instalan exactamente las versiones de dependencias que se probaron, desde el `npm-shrinkwrap.json` del paquete (npm cuando instala desde el registro; la fórmula de Homebrew corre `npm ci` sobre el paquete). npm ignora ese archivo si instalas un `.tgz` descargado. pnpm, bun y yarn no leen ese archivo: instalan las mismas dependencias directas (fijadas a versiones exactas) y resuelven por su cuenta las dependencias de esas.
- pnpm 11 y posteriores esperan un día antes de instalar una versión nueva (`minimumReleaseAge`), así que una versión llega a pnpm un día después que a npm.
- yarn quiere decir yarn 1 (classic). yarn 2 y posteriores no instalan global: ahí usa npm, pnpm o bun.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/(docs)/get-started/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ turno version
`turno upgrade` later updates turno with the same tool that installed it. CI installs the packed release with each of these on macOS and Linux and runs it.

- The package runs no install scripts, so pnpm and bun, which block dependencies' scripts by default, need no approval.
- npm and Homebrew install exactly the dependency versions that were tested, from the package's `npm-shrinkwrap.json`. pnpm, bun and yarn do not read that file: they install the same direct dependencies (pinned to exact versions) and resolve the dependencies of those themselves.
- npm and Homebrew install exactly the dependency versions that were tested, from the package's `npm-shrinkwrap.json` (npm when it installs from the registry; the Homebrew formula runs `npm ci` on the package). npm ignores that file when you install a downloaded `.tgz` instead. pnpm, bun and yarn do not read that file: they install the same direct dependencies (pinned to exact versions) and resolve the dependencies of those themselves.
- pnpm 11 and later wait a day before they install a new release (`minimumReleaseAge`), so a release reaches pnpm a day after npm.
- yarn means yarn 1 (classic). yarn 2 and later have no global installs: use npm, pnpm or bun there.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/releases/cli/0-2-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ turno mcp savings
- **Secrets**: `turno secret set` no longer passes the value as a command argument. On Linux, `turno secret` and `keychain:` references use the Secret Service through `secret-tool`.
- **Private files**: turno's folders are created 0700 and the files it writes 0600. Backups are private and pruned after 30 days, always keeping the newest 10.
- **`turno open`**: accepts only http(s) and mailto links, and works on Linux.
- **A lighter, locked install**: `turno-cli` no longer pulls in `turno-browser` and `turno-fonts` (about 52 MB down to 27 MB), and both packages ship an `npm-shrinkwrap.json`. No package in either tree runs an install script.
- **A lighter, locked install**: `turno-cli` no longer pulls in `turno-browser` and `turno-fonts` (a clean global install holds 18.5 MB of files in 97 packages, down from 43.1 MB in 100 for 0.1.1; [measured](https://github.com/wimo-dev/turno/blob/main/bench/results/2026-11-30-m3-16gb-install-size.json)), and both packages ship an `npm-shrinkwrap.json`. No package in either tree runs an install script.

## Fixes

Expand Down
151 changes: 151 additions & 0 deletions bench/install-size.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#!/usr/bin/env node
// Measures what `npm install --global turno-cli@<version>` puts on disk.
//
// node bench/install-size.mjs [--versions 0.1.1,0.2.0,0.6.3] [--out bench/results/<file>.json]
//
// Each version goes into its own empty prefix with an empty npm cache, a throwaway HOME and
// empty user and global npmrc files, so nothing from your own setup or an earlier run counts.
// Install scripts are not run (--ignore-scripts): the packages since 0.2.0 have none, and a
// measurement should not run third-party code. A version without an npm-shrinkwrap.json (before
// 0.2.0) resolves its dependency ranges to what the registry has today.
// Size is the sum of the file sizes under lib/node_modules (MiB, and MB in parentheses) and the
// disk usage `du -sk` reports for it (which varies by a few MiB between runs of the same tree on
// APFS; the file sizes do not); packages are the folders with a package.json under it,
// turno-cli included.

import { execFileSync } from "node:child_process";
import { lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { cpus, loadavg, platform, release, tmpdir, totalmem } from "node:os";
import { join } from "node:path";
import { parseArgs } from "node:util";

const { values } = parseArgs({
options: {
versions: { type: "string", default: "0.1.1,0.2.0,0.6.3" },
out: { type: "string" },
},
});

const MIB = 1024 * 1024;
const startedAt = new Date();
const loadAtStart = loadavg().map((n) => Math.round(n * 100) / 100);
const npmVersion = execFileSync("npm", ["--version"], { encoding: "utf8" }).trim();

function osName() {
if (platform() !== "darwin") return `${platform()} ${release()}`;
return `macOS ${execFileSync("sw_vers", ["-productVersion"], { encoding: "utf8" }).trim()}`;
}

function apparentBytes(dir) {
let total = 0;
for (const name of readdirSync(dir)) {
const p = join(dir, name);
const st = lstatSync(p);
total += st.isDirectory() ? apparentBytes(p) : st.size;
}
return total;
}

function measure(version) {
const work = mkdtempSync(join(tmpdir(), "turno-install-size-"));
try {
for (const d of ["home", "cache", "prefix"]) mkdirSync(join(work, d));
writeFileSync(join(work, "user.npmrc"), "");
writeFileSync(join(work, "global.npmrc"), "");
const env = {
PATH: process.env.PATH,
HOME: join(work, "home"),
npm_config_cache: join(work, "cache"),
npm_config_userconfig: join(work, "user.npmrc"),
npm_config_globalconfig: join(work, "global.npmrc"),
npm_config_update_notifier: "false",
};
const args = [
"install",
"--global",
"--prefix",
join(work, "prefix"),
"--ignore-scripts",
"--no-audit",
"--no-fund",
];
const began = Date.now();
const out = execFileSync("npm", [...args, `turno-cli@${version}`], { env, encoding: "utf8" });
const seconds = (Date.now() - began) / 1000;
const modules = join(work, "prefix", "lib", "node_modules");
const packages = packageDirs(modules);
const installed = JSON.parse(readFileSync(join(modules, "turno-cli", "package.json"), "utf8")).version;
if (installed !== version) throw new Error(`asked for ${version}, npm installed ${installed}`);
const bytes = apparentBytes(modules);
const diskKiB = Number(execFileSync("du", ["-sk", modules], { encoding: "utf8" }).split(/\s/)[0]);
return {
version,
shrinkwrap: hasShrinkwrap(join(modules, "turno-cli")),
packages,
npmAdded: Number(/added (\d+) package/.exec(out)?.[1] ?? Number.NaN),
bytes,
mib: Math.round((bytes / MIB) * 10) / 10,
mb: Math.round((bytes / 1e6) * 10) / 10,
diskMiB: Math.round((diskKiB / 1024) * 10) / 10,
seconds: Math.round(seconds * 10) / 10,
};
} finally {
rmSync(work, { recursive: true, force: true });
}
}

/** Folders with a package.json under a node_modules tree, nested ones included. */
function packageDirs(modules) {
let count = 0;
for (const name of readdirSync(modules)) {
if (name.startsWith(".")) continue;
const dirs = name.startsWith("@")
? readdirSync(join(modules, name)).map((n) => join(modules, name, n))
: [join(modules, name)];
for (const dir of dirs) {
if (!lstatSync(dir).isDirectory()) continue;
try {
lstatSync(join(dir, "package.json"));
count++;
} catch {}
try {
count += packageDirs(join(dir, "node_modules"));
} catch {}
}
}
return count;
}

function hasShrinkwrap(dir) {
try {
lstatSync(join(dir, "npm-shrinkwrap.json"));
return true;
} catch {
return false;
}
}

const rows = values.versions.split(",").map((v) => measure(v.trim()));
const result = {
version: 1,
kind: "turno-cli-install-size",
startedAt: startedAt.toISOString(),
finishedAt: new Date().toISOString(),
command: `node bench/install-size.mjs --versions ${values.versions}`,
install: "npm install --global --prefix <empty dir> --ignore-scripts --no-audit --no-fund turno-cli@<version>",
machine: {
cpu: cpus()[0]?.model,
memoryGiB: Math.round(totalmem() / 1024 ** 3),
os: osName(),
},
loadAverageAtStart: loadAtStart,
node: process.version,
npm: npmVersion,
rows,
};

for (const r of rows)
console.log(
`turno-cli ${r.version}: ${r.mib} MiB (${r.mb} MB), ${r.diskMiB} MiB on disk, ${r.packages} packages${r.shrinkwrap ? ", shrinkwrap" : ""}`,
);
if (values.out) writeFileSync(values.out, `${JSON.stringify(result, null, 2)}\n`);
55 changes: 55 additions & 0 deletions bench/results/2026-11-30-m3-16gb-install-size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"version": 1,
"kind": "turno-cli-install-size",
"startedAt": "2026-11-30T06:41:05.339Z",
"finishedAt": "2026-11-30T06:43:56.591Z",
"command": "node bench/install-size.mjs --versions 0.1.1,0.2.0,0.6.3",
"install": "npm install --global --prefix <empty dir> --ignore-scripts --no-audit --no-fund turno-cli@<version>",
"machine": {
"cpu": "Apple M3",
"memoryGiB": 16,
"os": "macOS 27.2.1"
},
"loadAverageAtStart": [
181.61,
94.95,
79.73
],
"node": "v26.13.0",
"npm": "11.20.0",
"rows": [
{
"version": "0.1.1",
"shrinkwrap": false,
"packages": 100,
"npmAdded": 100,
"bytes": 43109463,
"mib": 41.1,
"mb": 43.1,
"diskMiB": 54.6,
"seconds": 67.2
},
{
"version": "0.2.0",
"shrinkwrap": true,
"packages": 97,
"npmAdded": 97,
"bytes": 18541668,
"mib": 17.7,
"mb": 18.5,
"diskMiB": 27.8,
"seconds": 50.5
},
{
"version": "0.6.3",
"shrinkwrap": true,
"packages": 98,
"npmAdded": 98,
"bytes": 18851108,
"mib": 18,
"mb": 18.9,
"diskMiB": 28.2,
"seconds": 40.7
}
]
}
Loading
Loading