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.

2.4 KB
Raw Blame
import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";

const ROOT = path.resolve(__dirname, "../..");
const ULTIMATE = path.join(ROOT, "scripts/security-ultimate.sh");

describe("security scanner supply chain", () => {
  it("pins OSV release binaries by official version and SHA-256 instead of a mutable/denied container ref", () => {
    const script = fs.readFileSync(ULTIMATE, "utf8");
    expect(script).toContain("OSV_VERSION='2.5.1'");
    expect(script).toContain("OSV_LINUX_AMD64_SHA256='f9f25499a2c8cc367b3af45df2ea7eeca7fbccceab9c35079968f4b3652194be'");
    expect(script).toContain("OSV_LINUX_ARM64_SHA256='3d0f5aa5a6baa8eb32bcef247388e149ef6030a6634ccae6fa0d62681fb27a6d'");
    expect(script).toContain("releases/download/v${OSV_VERSION}/${asset}");
    expect(script).toContain("sha256sum -c -");
    expect(script).toContain('if [[ -L "$OSV_BIN" ]]');
    expect(script).not.toContain("OSV_IMAGE=");
    expect(script).not.toContain("osv-scanner:latest");
  });

  it("runs the verified binary from owner-local state with an ephemeral HOME", () => {
    const script = fs.readFileSync(ULTIMATE, "utf8");
    expect(script).toContain('OSV_TOOLS="$STATE_BASE/tools/osv-scanner/$OSV_VERSION"');
    expect(script).toContain('run_capture "OSV binary integrity" prepare_osv');
    expect(script).toContain('run_capture "OSV dependencies" env HOME="$OSV_HOME" "$OSV_BIN" scan source --recursive "$SRC"');
  });

  it("pins ZAP to the official Docker Hub mirror by immutable digest", () => {
    const script = fs.readFileSync(ULTIMATE, "utf8");
    expect(script).toContain("zaproxy/zap-stable@sha256:781a2bdaea47324e7bab583e2263f21d257b0aee61ed51521a5be45f5f5081ef");
    expect(script).not.toContain("ghcr.io/zaproxy/zaproxy@sha256:");
  });

  it("keeps cache retrieval out of the rule-wide policy and validates raw reports on both DAST lanes", () => {
    const policy = fs.readFileSync(path.join(ROOT, "security/zap-baseline.conf"), "utf8");
    const hosted = fs.readFileSync(path.join(ROOT, ".github/workflows/dast.yml"), "utf8");
    const ultimate = fs.readFileSync(ULTIMATE, "utf8");
    expect(policy).not.toMatch(/^10050\t/m);
    expect(hosted).toContain('node scripts/check-zap-report.mjs report_json.json "${{ steps.zap.outcome }}"');
    expect(ultimate).toContain('node "$ROOT/scripts/check-zap-report.mjs" "$ZAP_WORK/report_json.json" success');
  });
});