Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: pin GitHub Actions to immutable SHAs (#8314)
[._.]/ Adam Eivyabf195323787
diff --git a/.github/workflows/ci-cancel-recovery.yml b/.github/workflows/ci-cancel-recovery.ymlindex 2ab36df201..d351e31fe5 100644--- a/.github/workflows/ci-cancel-recovery.yml+++ b/.github/workflows/ci-cancel-recovery.yml@@ -59,7 +59,7 @@ jobs:# hosted runner already ships a Node new enough for it — the same# pattern the `impact` job in ci.yml uses. Sparse, because the whole# value of this workflow is how fast it re-dispatches.- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:sparse-checkout: scriptspersist-credentials: falsediff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex cf82ec27de..060cdc69fe 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -61,7 +61,7 @@ jobs:windows_shards: ${{ steps.plan.outputs.windows_shards }}suite_reasons: ${{ steps.plan.outputs.suite_reasons }}steps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:# Depth 2, not full history: a pull_request checkout is the merge ref,# so depth 2 carries both of its parents — which is everything the@@ -143,7 +143,7 @@ jobs:contents: readactions: writesteps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false# See the impact job: depth 2 is the whole PR merge ref, which is all@@ -154,7 +154,7 @@ jobs:run: node scripts/ci-base-sha.js- name: Use Node.js 24.x- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 24.xcache: npm@@ -180,7 +180,7 @@ jobs:# See docs/GITHUB_ACTIONS.md.- name: Cache server node_modulesid: server-modules- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: server/node_moduleskey: server-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('server/package-lock.json', 'server/package.json', 'server/.npmrc', 'scripts/trusted-rebuilds.js') }}@@ -248,7 +248,7 @@ jobs:# deliberately: this is where a near miss is safe, so this is the entry# that keeps restore-keys and stays warm across a lockfile bump.- name: Cache Vitest transform artifacts- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: |server/node_modules/.vite@@ -342,7 +342,7 @@ jobs:contents: readactions: writesteps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false# See the impact job: depth 2 is the whole PR merge ref, which is all@@ -353,7 +353,7 @@ jobs:run: node scripts/ci-base-sha.js- name: Use Node.js 24.x- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 24.xcache: npm@@ -376,7 +376,7 @@ jobs:# has a stamp check to notice.- name: Cache client node_modulesid: client-modules- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: client/node_moduleskey: client-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('client/package-lock.json', 'client/package.json', 'client/.npmrc', 'scripts/trusted-rebuilds.js') }}@@ -386,7 +386,7 @@ jobs:run: npm ci --prefix client- name: Cache Vitest transform artifacts- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: |client/node_modules/.vite@@ -453,12 +453,12 @@ jobs:# No `fetch-depth` and no `Resolve the pull-request diff base`, unlike the# test jobs: the linter's file list arrives from the impact plan, so this# job never diffs and a single-commit checkout is everything it needs.- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false- name: Use Node.js 24.x- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 24.xcache: npm@@ -481,7 +481,7 @@ jobs:# has a stamp check to notice.- name: Cache client node_modulesid: client-modules- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: client/node_moduleskey: client-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('client/package-lock.json', 'client/package.json', 'client/.npmrc', 'scripts/trusted-rebuilds.js') }}@@ -535,12 +535,12 @@ jobs:PGPASSWORD: portosPORTOS_REQUIRE_DB: '1'steps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false- name: Use Node.js 24.x- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 24.xcache: npm@@ -551,7 +551,7 @@ jobs:# on the cache hit.- name: Cache server node_modulesid: server-modules- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: server/node_moduleskey: server-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('server/package-lock.json', 'server/package.json', 'server/.npmrc', 'scripts/trusted-rebuilds.js') }}@@ -619,7 +619,7 @@ jobs:# deliberately: this is where a near miss is safe, so this is the entry# that keeps restore-keys and stays warm across a lockfile bump.- name: Cache Vitest transform artifacts- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: |server/node_modules/.vite@@ -667,7 +667,7 @@ jobs:contents: readactions: writesteps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false# See the impact job: depth 2 is the whole PR merge ref, which is all@@ -678,7 +678,7 @@ jobs:run: node scripts/ci-base-sha.js- name: Use Node.js 24.x- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 24.xcache: npm@@ -689,7 +689,7 @@ jobs:# on the cache hit.- name: Cache server node_modulesid: server-modules- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: server/node_moduleskey: server-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('server/package-lock.json', 'server/package.json', 'server/.npmrc', 'scripts/trusted-rebuilds.js') }}@@ -757,7 +757,7 @@ jobs:# deliberately: this is where a near miss is safe, so this is the entry# that keeps restore-keys and stays warm across a lockfile bump.- name: Cache Vitest transform artifacts- uses: actions/cache@v6+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: |server/node_modules/.vite@@ -796,12 +796,12 @@ jobs:permissions:contents: readsteps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false- name: Use the minimum supported Node.js- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 22.22.2@@ -841,7 +841,7 @@ jobs:# gate is the fan-in job every required check waits on. Cone mode always# includes the repo root, which is where package.json ("type": "module")# has to come from for the script to load as ESM.- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:sparse-checkout: scriptspersist-credentials: false@@ -890,7 +890,7 @@ jobs:contents: readactions: readsteps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:sparse-checkout: scriptspersist-credentials: falsediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex a1d362c7fd..aefe3c8197 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -25,7 +25,7 @@ jobs:steps:# Depth 2 so both parents of the release merge commit — and their trees —# are available to compare against the tree being released.- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:fetch-depth: 2@@ -74,13 +74,13 @@ jobs:if: always() && !contains(github.event.head_commit.message, '[skip ci]')steps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:fetch-depth: 0token: ${{ secrets.GITHUB_TOKEN }}- name: Use Node.js 24.x- uses: actions/setup-node@v7+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:node-version: 24.x@@ -204,7 +204,7 @@ jobs:- name: Create Releaseif: steps.release-check.outputs.exists == 'false'- uses: softprops/action-gh-release@v3+ uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3with:tag_name: v${{ steps.package-version.outputs.version }}name: ${{ steps.changelog.outputs.release_title }}diff --git a/scripts/ci-fail-fast.test.js b/scripts/ci-fail-fast.test.jsindex 524f98d066..96393a99cc 100644--- a/scripts/ci-fail-fast.test.js+++ b/scripts/ci-fail-fast.test.js@@ -94,7 +94,7 @@ describe('ci.yml fail-fast cancellation contract', () => {it('does not persist the elevated checkout token into leaf job steps', () => {for (const id of leafJobs) {const body = jobs[id];- const checkoutStart = body.indexOf(' - uses: actions/checkout@v7');+ const checkoutStart = body.indexOf(' - uses: actions/checkout@');const nextStep = body.indexOf('\n - ', checkoutStart + 1);const checkout = body.slice(checkoutStart, nextStep === -1 ? undefined : nextStep);expect(checkout, id).toContain('persist-credentials: false');diff --git a/scripts/github-actions-pinned.test.js b/scripts/github-actions-pinned.test.jsnew file mode 100644index 0000000000..27b4b9bbb3--- /dev/null+++ b/scripts/github-actions-pinned.test.js@@ -0,0 +1,80 @@+import { readdirSync, readFileSync } from 'fs';+import { dirname, join, relative } from 'path';+import { fileURLToPath } from 'url';++import { describe, expect, it } from 'vitest';++const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');+const WORKFLOWS_DIR = join(REPO_ROOT, '.github/workflows');+function listWorkflowFiles(directory = WORKFLOWS_DIR) {+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {+ const path = join(directory, entry.name);+ if (entry.isDirectory()) return listWorkflowFiles(path);+ return entry.isFile() && /\.ya?ml$/i.test(entry.name) ? [path] : [];+ }).sort();+}++const WORKFLOW_FILES = listWorkflowFiles();+const FULL_COMMIT_REF = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*@[a-f0-9]{40}$/i;+const RELEASE_VERSION_COMMENT = /^v\d+\.\d+\.\d+$/;++function parseUsesLine(line) {+ const match = line.match(/^\s*(?:-\s*)?uses:\s*(["']?)([^"'#\s]+)\1(?:\s+#\s*(.*))?\s*$/);+ if (match) {+ return { reference: match[2], comment: match[3]?.trim() ?? '' };+ }++ if (/^\s*(?:-\s*)?uses:/.test(line)) {+ return { error: 'malformed uses reference' };+ }+ return null;+}++function findUnpinnedUses(yaml) {+ const violations = [];+ for (const [index, line] of yaml.split('\n').entries()) {+ const parsed = parseUsesLine(line);+ if (!parsed) continue;++ if (parsed.error) {+ violations.push({ line: index + 1, reason: parsed.error });+ continue;+ }+ if (parsed.reference.startsWith('./') && !parsed.reference.includes('@')) continue;+ if (!FULL_COMMIT_REF.test(parsed.reference)) {+ violations.push({ line: index + 1, reference: parsed.reference, reason: 'external uses must name a full commit SHA' });+ continue;+ }+ if (!RELEASE_VERSION_COMMENT.test(parsed.comment)) {+ violations.push({ line: index + 1, reference: parsed.reference, reason: 'pinned actions need an exact upstream version comment' });+ }+ }+ return violations;+}++describe('GitHub Actions immutable pin contract', () => {+ it('pins every external action and keeps its exact version beside the SHA', () => {+ for (const filename of WORKFLOW_FILES) {+ const yaml = readFileSync(filename, 'utf8');+ expect(findUnpinnedUses(yaml), relative(REPO_ROOT, filename)).toEqual([]);+ }+ });++ it('rejects branch and tag refs while allowing local reusable workflows', () => {+ expect(findUnpinnedUses(' - uses: actions/checkout@main')).toHaveLength(1);+ expect(findUnpinnedUses(' - uses: actions/checkout@v7')).toHaveLength(1);+ expect(findUnpinnedUses(' - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1')).toEqual([]);+ expect(findUnpinnedUses(' uses: ./.github/workflows/ci.yml')).toEqual([]);+ });++ it('keeps the contents write grant in the release workflow', () => {+ const releasePath = join(WORKFLOWS_DIR, 'release.yml');+ const release = readFileSync(releasePath, 'utf8');++ for (const filename of WORKFLOW_FILES.filter((path) => path !== releasePath)) {+ const yaml = readFileSync(filename, 'utf8');+ expect(yaml, relative(REPO_ROOT, filename)).not.toMatch(/^\s+contents: write\s*$/m);+ }+ expect(release).toMatch(/^permissions:\n contents: write$/m);+ });+});