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.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(ci): resolve synthetic history findings and await exact CodeQL evidence
Rahman1b0ebcf05b44
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.ymlindex abd03cbf..adede6a6 100644--- a/.github/workflows/codeql.yml+++ b/.github/workflows/codeql.yml@@ -45,6 +45,6 @@ jobs:- name: Inspect actual branch findings after SARIF processingif: github.event_name == 'push'- run: node scripts/security-alerts.mjs --include-closed --ref "$GITHUB_REF"+ run: node scripts/security-alerts.mjs --include-closed --ref "$GITHUB_REF" --commit "$GITHUB_SHA" --wait-seconds 60env:GITHUB_TOKEN: ${{ github.token }}diff --git a/.github/workflows/security-alerts.yml b/.github/workflows/security-alerts.ymlindex 4dccb8df..ff650d8e 100644--- a/.github/workflows/security-alerts.yml+++ b/.github/workflows/security-alerts.yml@@ -13,7 +13,8 @@ permissions:contents: readconcurrency:- group: security-alert-inventory-${{ github.ref }}+ # Keep push/CodeQL/Scorecard runs from evicting each other while readiness is pending.+ group: security-alert-inventory-${{ github.ref }}-${{ github.event_name }}-${{ github.event.workflow_run.name || 'direct' }}cancel-in-progress: falsejobs:@@ -38,9 +39,9 @@ jobs:run: |set -euo pipefailif [[ "$GITHUB_EVENT_NAME" == "push" ]]; then- node scripts/security-alerts.mjs --ref "$GITHUB_REF"+ node scripts/security-alerts.mjs --ref "$GITHUB_REF" --commit "$GITHUB_SHA" --wait-seconds 360else- node scripts/security-alerts.mjs+ node scripts/security-alerts.mjs --commit "$GITHUB_SHA" --wait-seconds 360fienv:GITHUB_TOKEN: ${{ github.token }}diff --git a/.gitleaksignore b/.gitleaksignoreindex 3e14fc23..f9819a16 100644--- a/.gitleaksignore+++ b/.gitleaksignore@@ -14,3 +14,8 @@ f68cd5567321efb9ac84bc940ebc2429cc088153:lib/infra/dokploy-deploy.test.ts:generi# Reviewed DOM property assignments: maxLength=1024 and hidden=true, no credential literals.67d4b3ec64a456cb6015c65f5e7d6aaa7de2a2af:lib/infra/portable/ui.ts:generic-api-key:11db292708a0ce5554a1a265091a65fb6a19636538:lib/infra/portable/ui.ts:generic-api-key:11++# Reviewed SC-sync unit-test fixtures: synthetic strings passed only to in-memory state.+# No provider requests; scoped to the original commit, exact file, rule and line.+9d3eb899b80a3d3ace1766a65e3b154fd029d7a3:lib/infra/sc-sync.test.ts:generic-api-key:4+9d3eb899b80a3d3ace1766a65e3b154fd029d7a3:lib/infra/sc-sync.test.ts:generic-api-key:15diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 3fc51d49..f0e4a9a1 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -10,6 +10,10 @@ this is the *what*, and it is what Settings → About shows as “What's new”.- `install` enable MCP exec + document stable Cloudflare tunnel defaults+**Fixed**++- `ci` resolve synthetic history findings and await exact CodeQL evidence+**Tests**- `forge` use node fixture commands under Bun runnerdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex fbeead3d..6ac77990 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,19 @@+## 2026-09-12 — Hosted history scan and security inventory readiness++The hosted checks for PR #41 exposed two distinct failures not covered by the earlier local+release report. The pinned, full-history Gitleaks command reproduced two findings in the+SC-sync test introduced on September 9: synthetic in-memory values, not production tokens.+Only those two historical commit/path/rule/line fingerprints are reviewed exceptions. Current+fixtures now generate deterministic synthetic values, without broad exclusions or rewriting shared history.++The push inventory and the Scorecard follow-up both ran before CodeQL SARIF was available;+the later CodeQL-triggered inventory passed for the same commit. The inventory now supports+an explicit bounded readiness wait and exact requested SHA. Trigger-specific concurrency keeps+push, CodeQL and Scorecard follow-ups from evicting each other. It polls only missing/stale+CodeQL evidence and still fails on timeout, access denial, malformed evidence, analysis+failure, branch movement or any open finding. Negative regression tests preserve those+boundaries. Hosted results, rather than local build success alone, determine CI completion.+## 2026-09-11 — Fresh-install MCP exec default and stable Cloudflare gateway baselineFresh installs now write `OS_MCP_ENABLED=1` and `OS_MCP_MAX_SCOPE=exec` beside the generated ownerdiff --git a/docs/SECURITY-ASSURANCE.md b/docs/SECURITY-ASSURANCE.mdindex 30775236..e955b747 100644--- a/docs/SECURITY-ASSURANCE.md+++ b/docs/SECURITY-ASSURANCE.md@@ -29,6 +29,13 @@ All GitHub Actions referenced by the repository are pinned to immutable commit S`Security alert inventory` uses the repository-scoped GitHub Actions token with read-only security permissions to enumerate and paginate default-branch alerts and their affected instances. It fails for any remaining open finding, or when the inventory/scan evidence cannot be read. It never dismisses alerts or changes scan configuration. Its status is deliberately separate from a successful CodeQL analysis job. The job logs and summary expose rule/path/severity evidence, never bearer credentials or secret-scanning values. `node scripts/security-alerts.mjs --inventory` is an explicit collection-only mode, not release clearance.+The push inventory and the follow-up CodeQL/Scorecard inventories allow up to 360 seconds+for CodeQL evidence on their exact checkout commit. The post-analysis CodeQL step allows+60 seconds for SARIF visibility. A missing/older analysis is pending, not clean; timeout,+API denial, malformed evidence, analysis failure, branch movement and open findings still+fail closed. The CLI remains immediate unless `--wait-seconds` is explicitly supplied,+and `--commit` prevents a newer branch tip from being reported as the requested revision.+## GitHub security controlsThe public repository enables:@@ -59,7 +66,9 @@ The final runner message summarizes only the selected lanes; skipped Codex or ZA## Reviewed Gitleaks fixtures-MSO's redaction unit test intentionally contains six realistic-looking **synthetic** credential fixtures so the redactor can prove it removes secrets. Gitleaks correctly detects those patterns in the historical commit that introduced the test. The repository records six exact finding fingerprints in `.gitleaksignore` and marks the current fixture lines with `gitleaks:allow`.+MSO's redaction unit test intentionally contains six realistic-looking **synthetic** credential fixtures so the redactor can prove it removes secrets. Gitleaks correctly detects those patterns in the historical commit that introduced the test. `.gitleaksignore` records their exact fingerprints; the current redaction fixture lines carry `gitleaks:allow`. The same finding-specific ledger also records reviewed mocked Dokploy keys and non-secret DOM property assignments.++The SC-sync tests introduced in commit `9d3eb899b80a3d3ace1766a65e3b154fd029d7a3` used clearly synthetic strings exclusively with `syncScIn` and in-memory state, without provider requests. Two historical findings (lines 4 and 15) are recorded by exact commit/path/rule/line fingerprint. Current SC-sync fixtures generate deterministic synthetic values instead of key-shaped strings; no file-wide, rule-wide or commit-wide exception was added.The exception is intentionally finding-specific. The file and rules are **not** globally allowlisted, so a new secret-like value in that test file still fails the scan and requires review.diff --git a/lib/infra/sc-sync.test.ts b/lib/infra/sc-sync.test.tsindex 26c6cb98..d802d223 100644--- a/lib/infra/sc-sync.test.ts+++ b/lib/infra/sc-sync.test.ts@@ -1,18 +1,20 @@import { it, expect } from 'vitest';import { syncScIn, type ScRow } from './sc-sync';import { emptyIntegrationState, resolveSharedConnection } from './identity';-const row=(user='alice',id='main'):ScRow=>({user,id,provider:'composio',label:id,source:'sc',authMethod:'project-api-key',isDefault:true,values:{COMPOSIO_API_KEY:'synthetic_key_for_test_123456'}});+// Deterministic in-memory fixtures, never provider credentials.+const fixtureValue=(label:string)=>`synthetic-${label.repeat(24)}`;+const row=(user='alice',id='main'):ScRow=>({user,id,provider:'composio',label:id,source:'sc',authMethod:'project-api-key',isDefault:true,values:{COMPOSIO_API_KEY:fixtureValue('a')}});const input=(rows:ScRow[])=>({users:[...new Set(rows.map(r=>r.user))].map(id=>({id,label:id})),rows});it('imports all users with strict isolation, no secret output, and idempotent repeat',()=>{- const s=emptyIntegrationState(),a=row(),b={...row('bob'),values:{COMPOSIO_API_KEY:'another_synthetic_key_123456'}};+ const s=emptyIntegrationState(),a=row(),b={...row('bob'),values:{COMPOSIO_API_KEY:fixtureValue('b')}};const out=syncScIn(s,input([a,b]));expect(JSON.stringify(out)).not.toContain('synthetic');expect(s.users.alice.connections.composio.main.values.apiKey).toBe(a.values.COMPOSIO_API_KEY);expect(s.users.bob.connections.composio.main.values.apiKey).toBe(b.values.COMPOSIO_API_KEY);const snapshot=JSON.stringify(s);expect(syncScIn(s,input([a,b])).results.every(r=>r.action==='unchanged')).toBe(true);expect(JSON.stringify(s)).toBe(snapshot);});it('fills metadata-only connections and preserves conflicting credentials/defaults',()=>{const s=emptyIntegrationState(),a=row();syncScIn(s,input([{...a,values:{}}]));expect(syncScIn(s,input([a])).results[0].action).toBe('filled');const before=s.users.alice.connections.composio.main.values.apiKey;- const other={...a,values:{COMPOSIO_API_KEY:'changed_synthetic_key_123456'}};expect(syncScIn(s,input([other])).results[0].connection).toBe('sc-main');expect(s.users.alice.connections.composio.main.values.apiKey).toBe(before);expect(s.users.alice.defaults.composio).toBe('main');- expect(()=>syncScIn(s,input([{...other,values:{COMPOSIO_API_KEY:'third_synthetic_key_123456'}}]))).toThrow('sc_sync_conflicting_alias');+ const other={...a,values:{COMPOSIO_API_KEY:fixtureValue('c')}};expect(syncScIn(s,input([other])).results[0].connection).toBe('sc-main');expect(s.users.alice.connections.composio.main.values.apiKey).toBe(before);expect(s.users.alice.defaults.composio).toBe('main');+ expect(()=>syncScIn(s,input([{...other,values:{COMPOSIO_API_KEY:fixtureValue('d')}}]))).toThrow('sc_sync_conflicting_alias');});it('preserves shared aliases and resolves backing collisions without copying credentials',()=>{const s=emptyIntegrationState(),a=row(),shared={...row('bob'),sharedFrom:{user:'alice',provider:'composio',connection:'main'}};diff --git a/scripts/security-alerts.mjs b/scripts/security-alerts.mjsindex e9718665..fa11e04b 100644--- a/scripts/security-alerts.mjs+++ b/scripts/security-alerts.mjs@@ -6,12 +6,18 @@ const args = process.argv.slice(2);let selectedRef;let inventory = false;let includeClosed = false;+let expectedCommit;+let waitSeconds = 0;for (let i = 0; i < args.length; i++) {if (args[i] === "--inventory") inventory = true;else if (args[i] === "--include-closed") includeClosed = true;else if (args[i] === "--ref" && args[i + 1]) selectedRef = args[++i];- else throw new Error("usage: node scripts/security-alerts.mjs [--inventory] [--ref refs/heads/branch] [--include-closed]");+ else if (args[i] === "--commit" && args[i + 1]) expectedCommit = args[++i];+ else if (args[i] === "--wait-seconds" && /^(0|[1-9][0-9]{0,2})$/.test(args[i + 1] ?? "")) waitSeconds = Number(args[++i]);+ else throw new Error("usage: node scripts/security-alerts.mjs [--inventory] [--ref refs/heads/branch] [--include-closed] [--commit SHA] [--wait-seconds 0..480]");}+if (waitSeconds > 480) throw new Error("Readiness wait must be bounded to 480 seconds");+if (expectedCommit && !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(expectedCommit)) throw new Error("An exact commit SHA is required");if (selectedRef && (!/^refs\/heads\/[A-Za-z0-9_./-]+$/.test(selectedRef) || selectedRef.includes("..") || selectedRef.endsWith("/"))) {throw new Error("An exact branch ref is required");}@@ -64,10 +70,22 @@ try {const ref = selectedRef ?? `refs/heads/${repository.default_branch}`;const branchName = ref.slice("refs/heads/".length);const branch = (await get(`/branches/${encodeURIComponent(branchName)}`)).value;- const recent = await get(`/code-scanning/analyses?ref=${encodeURIComponent(ref)}&per_page=100`);- if (!Array.isArray(recent.value) || !recent.value.length) throw new Error("No scan evidence for the selected branch");- if (!recent.value.some((scan) => scan.tool?.name === "CodeQL" && scan.commit_sha === branch.commit.sha && !scan.error)) {- throw new Error("CodeQL has not completed successfully for the current selected-branch commit");+ if (expectedCommit && expectedCommit !== branch.commit.sha) throw new Error("Selected branch no longer matches the requested commit");+ const deadline = Date.now() + waitSeconds * 1000;+ let recent;+ for (;;) {+ recent = await get(`/code-scanning/analyses?ref=${encodeURIComponent(ref)}&per_page=100`);+ if (!Array.isArray(recent.value)) throw new Error("Invalid GitHub analysis response");+ const exact = recent.value.filter((scan) => scan.tool?.name === "CodeQL" && scan.commit_sha === branch.commit.sha && scan.ref === ref);+ if (exact.some((scan) => !scan.error)) break;+ if (exact.some((scan) => scan.error)) throw new Error("CodeQL analysis failed for the selected commit");+ if (Date.now() >= deadline) throw new Error("CodeQL has not completed successfully for the current selected-branch commit");+ const current = (await get(`/branches/${encodeURIComponent(branchName)}`)).value;+ if (current.commit.sha !== branch.commit.sha) throw new Error("Branch changed while waiting for CodeQL; retry");+ console.log(`WAITING_FOR_CODEQL ${ref} ${branch.commit.sha}`);+ // A push and a fast Scorecard run can precede CodeQL SARIF processing.+ // Only missing/stale analysis is retryable; API denial and real findings still fail.+ await new Promise((resolve) => setTimeout(resolve, Math.min(10_000, deadline - Date.now())));}const alerts = await pages(`/code-scanning/alerts?state=open&ref=${encodeURIComponent(ref)}`);const rows = [];diff --git a/scripts/security-alerts.test.ts b/scripts/security-alerts.test.tsindex 9f3f5c6d..8647b4ed 100644--- a/scripts/security-alerts.test.ts+++ b/scripts/security-alerts.test.ts@@ -1,29 +1,34 @@import { spawnSync } from "node:child_process";-import { mkdtempSync, rmSync } from "node:fs";+import { mkdtempSync, readFileSync, rmSync } from "node:fs";import { tmpdir } from "node:os";import path from "node:path";import { afterEach, describe, expect, it } from "vitest";const roots: string[] = [];afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }); });-function run(options: { count?: number; denied?: boolean; noAnalysis?: boolean; paginate?: boolean; stale?: boolean; hostile?: boolean } = {}) {+function run(options: { count?: number; denied?: boolean; noAnalysis?: boolean; paginate?: boolean; stale?: boolean; hostile?: boolean; args?: string[]; readyAfter?: number; branchMoved?: boolean; wrongRef?: boolean; analysisError?: boolean; invalidAnalysis?: boolean } = {}) {const root = mkdtempSync(path.join(tmpdir(), "mso-alert-report-test-")); roots.push(root);const stub = `const options=${JSON.stringify(options)};+ process.argv=['node','security-alerts.mjs',...(options.args??[])];+ let clock=0,analyses=0,branches=0,waits=0,inventories=0;+ Date.now=()=>clock;+ globalThis.setTimeout=(callback,ms)=>{clock+=ms;waits++;queueMicrotask(callback);return 1;};globalThis.fetch=async(url)=>{if(options.denied)return new Response('{}',{status:403});let value={default_branch:'main'};let headers={};- if(url.includes('/branches/'))value={commit:{sha:'a'.repeat(40)}};- if(url.includes('/alerts?')){value=Array.from({length:options.count??0},(_,i)=>({number:i+1,state:'open',tool:{name:'CodeQL'},rule:{id:options.hostile?'js/test%0A::error::boom':'js/test',severity:'warning',security_severity_level:'high'}}));+ if(url.includes('/branches/'))value={commit:{sha:(++branches>1&&options.branchMoved?'b':'a').repeat(40)}};+ if(url.includes('/alerts?')){inventories++;value=Array.from({length:options.count??0},(_,i)=>({number:i+1,state:'open',tool:{name:'CodeQL'},rule:{id:options.hostile?'js/test%0A::error::boom':'js/test',severity:'warning',security_severity_level:'high'}}));if(options.paginate){if(url.includes('page=2'))value=[];else headers={link:'<https://api.github.com/next>; rel="next"'};}}if(url.includes('/instances?'))value=[{ref:'refs/heads/main',state:'open',location:{path:options.hostile?'../escape.ts':'lib/test.ts',start_line:3},message:{text:'review me'}}];- if(url.includes('/analyses?'))value=options.noAnalysis?[]:[{id:1,commit_sha:(options.stale?'b':'a').repeat(40),tool:{name:'CodeQL'},ref:'refs/heads/main'}];+ if(url.includes('/analyses?')){analyses++;value=options.invalidAnalysis?{}:options.noAnalysis?[]:[{id:1,commit_sha:(options.stale||analyses<=(options.readyAfter??0)?'b':'a').repeat(40),tool:{name:'CodeQL'},ref:options.wrongRef?'refs/heads/other':'refs/heads/main',error:options.analysisError?'failed':''}];}return new Response(JSON.stringify(value),{status:200,headers});- };await import(${JSON.stringify(path.join(process.cwd(), "scripts/security-alerts.mjs"))});`;+ };await import(${JSON.stringify(path.join(process.cwd(), "scripts/security-alerts.mjs"))});console.log('FETCH_COUNTS '+JSON.stringify({analyses,branches,waits,inventories}));`;const result = spawnSync(process.execPath, ["--input-type=module", "-e", stub], { encoding: "utf8", timeout: 10_000,env: { NODE_ENV: "test", PATH: process.env.PATH, GITHUB_TOKEN: "synthetic-test-value", GITHUB_REPOSITORY: "example/repository", RUNNER_TEMP: root } });let report: { openCount: number; alerts: unknown[]; ref: string } | undefined;try { report = JSON.parse(result.stdout.split("\n").find((line) => line.startsWith("CODE_SCANNING_REPORT "))!.slice("CODE_SCANNING_REPORT ".length)); } catch { /* failed evidence is expected in negative cases */ }- return { ...result, report };+ const counts = JSON.parse(result.stdout.split("\n").find((line) => line.startsWith("FETCH_COUNTS "))?.slice(13) ?? "{}");+ return { ...result, report, counts };}describe("GitHub open-alert evidence", () => {it("does not turn 21 open alerts into a successful security check", () => {@@ -42,3 +47,54 @@ describe("GitHub open-alert evidence", () => {it("does not call an unscanned repository clean", () => { expect(run({ noAnalysis: true }).status).toBe(2); });it("follows pagination instead of treating a first page as the complete inventory", () => { const result = run({ count: 2, paginate: true }); expect(result.status).toBe(1); expect(result.report?.alerts).toHaveLength(2); });});+++describe("bounded exact-commit CodeQL readiness", () => {+ const args = ["--wait-seconds", "30", "--commit", "a".repeat(40)];+ it("waits for the pushed commit rather than failing on a previous clean analysis", () => {+ const result = run({ args, readyAfter: 2 });+ expect(result.status).toBe(0); expect(result.counts.waits).toBe(2); expect(result.counts.inventories).toBe(1);+ expect(result.stdout).toContain("WAITING_FOR_CODEQL refs/heads/main");+ });+ it("still fails on open alerts after the current analysis arrives", () => {+ const result = run({ args, readyAfter: 1, count: 2 });+ expect(result.status).toBe(1); expect(result.report?.openCount).toBe(2);+ });+ it.each([{ noAnalysis: true }, { stale: true }, { wrongRef: true }])("fails closed at the wait bound: %j", (options) => {+ const result = run({ args, ...options });+ expect(result.status).toBe(2); expect(result.counts.waits).toBe(3); expect(result.counts.inventories).toBe(0);+ });+ it.each([{ denied: true }, { analysisError: true }, { invalidAnalysis: true }])("does not retry non-readiness failures: %j", (options) => {+ const result = run({ args, ...options });+ expect(result.status).toBe(2); expect(result.counts.waits).toBe(0); expect(result.counts.inventories).toBe(0);+ });+ it("rejects a changed branch while waiting", () => {+ const result = run({ args, readyAfter: 2, branchMoved: true });+ expect(result.status).toBe(2); expect(result.stderr).toContain("Branch changed"); expect(result.counts.inventories).toBe(0);+ });+ it("rejects an obsolete requested commit before querying scan evidence", () => {+ const result = run({ args: ["--commit", "b".repeat(40)] });+ expect(result.status).toBe(2); expect(result.counts.analyses).toBe(0);+ });+ it.each(["-1", "481", "Infinity", "1.5", "", "--inventory"])("rejects an invalid or excessive readiness wait: %s", (value) => {+ expect(run({ args: ["--wait-seconds", value] }).status).not.toBe(0);+ });+});+++it("keeps hosted inventories strict, bounded and pinned to the checkout SHA", () => {+ for (const file of ["security-alerts.yml", "codeql.yml"]) {+ const source = readFileSync(path.join(process.cwd(), ".github/workflows", file), "utf8");+ const commands = source.split("\n").filter((line) => line.includes("node scripts/security-alerts.mjs"));+ expect(commands.length).toBeGreaterThan(0);+ for (const command of commands) {+ expect(command).toContain('--commit "$GITHUB_SHA"');+ expect(command).toMatch(/--wait-seconds (60|360)$/);+ expect(command).not.toContain("--inventory"); expect(command).not.toContain("|| true");+ }+ expect(source).not.toContain("continue-on-error: true");+ if (file === "security-alerts.yml") {+ expect(source).toContain("${{ github.event_name }}-${{ github.event.workflow_run.name || 'direct' }}");+ }+ }+});