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(security): scope passive cache review by path
Rahman7dad297f8294
diff --git a/.github/workflows/dast.yml b/.github/workflows/dast.ymlindex 9d157ca7..0046ee9e 100644--- a/.github/workflows/dast.yml+++ b/.github/workflows/dast.yml@@ -34,14 +34,24 @@ jobs:MSO_DAST_URL: ${{ vars.MSO_DAST_URL }}- name: Run passive ZAP baseline against configured live instance+ id: zap+ continue-on-error: trueuses: zaproxy/action-baseline@de8ad967d3548d44ef623df22cf95c3b0baf8b25 # v0.15.0with:target: ${{ vars.MSO_DAST_URL }}docker_name: ghcr.io/zaproxy/zaproxy@sha256:781a2bdaea47324e7bab583e2263f21d257b0aee61ed51521a5be45f5f5081efrules_file_name: security/zap-baseline.conf# The pinned action forwards rules_file_name only for IGNORE entries.- # Pass the existing INFO-only policy to ZAP explicitly; do not ignore warnings.+ # Pass the existing INFO-only policy explicitly. fail_action=false preserves+ # the raw JSON for path-scoped review; the next step is the fail-closed gate.cmd_options: -m 2 -c security/zap-baseline.conf- fail_action: true+ fail_action: falseallow_issue_writing: falseartifact_name: zap-baseline-report++ - name: Require only reviewed passive findings+ if: ${{ always() }}+ run: node scripts/check-zap-report.mjs report_json.json+ env:+ MSO_DAST_URL: ${{ vars.MSO_DAST_URL }}+ MSO_ZAP_STEP_OUTCOME: ${{ steps.zap.outcome }}diff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex ab6076d1..b947b0e1 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,12 @@+## 2026-09-18 — Scope cache retrieval review to immutable asset paths++PR review caught that a rule-wide 10050 INFO entry would also downgrade a future+shared-cache exposure on an authenticated or user-specific URL. Rule 10050 is therefore+removed from the rule-wide ZAP policy. Hosted and local DAST now validate the raw ZAP+JSON: only same-origin, query-free /_next/static/chunks/*.js and+/_next/static/media/*.woff2 instances are accepted for that rule; every other 10050+instance and every otherwise-unreviewed alert remains a failing condition.+## 2026-09-18 — Classify cache retrieval only for immutable public assetsThe first post-merge passive ZAP run against main produced one new default warning:diff --git a/docs/SECURITY-ASSURANCE.md b/docs/SECURITY-ASSURANCE.mdindex 41d7a6a1..ce489468 100644--- a/docs/SECURITY-ASSURANCE.md+++ b/docs/SECURITY-ASSURANCE.md@@ -89,7 +89,7 @@ The exception is intentionally finding-specific. The file and rules are **not**## Reviewed ZAP informational alerts-The production baseline keeps six known passive signals visible as `INFO`: cache policy on the public manifest, intentionally non-storable private/auth-shell responses, retrieval of content-hashed Next.js static chunks/fonts from the shared cache, broad HTTPS sources in `img-src`/`frame-src`, a Unix timestamp in a static bundle, and the deliberate absence of COEP. The cache-retrieval classification is limited to immutable public framework assets observed in the September 18 production scan; authenticated and user-specific responses remain `private, no-cache, no-store`. The CSP exception is a product trade-off: MSO permits user-selected remote images and sandboxed HTTPS embeds, while `connect-src` remains restricted and inbound framing is blocked by CSP `frame-ancestors 'none'` plus `X-Frame-Options: DENY`. COEP would break those supported cross-origin resources.+The production baseline keeps five rule-wide passive signals visible as `INFO`: cache policy on the public manifest, intentionally non-storable private/auth-shell responses, broad HTTPS sources in `img-src`/`frame-src`, a Unix timestamp in a static bundle, and the deliberate absence of COEP. A sixth reviewed signal, ZAP rule 10050 (`Retrieved from Cache`), is deliberately **not** present in the rule-wide policy. `scripts/check-zap-report.mjs` accepts that rule only when every instance is a same-origin, query-free `/_next/static/chunks/*.js` or `/_next/static/media/*.woff2` asset; any other 10050 instance fails the gate. Authenticated and user-specific responses remain `private, no-cache, no-store`.These are rule-specific classifications in `security/zap-baseline.conf`, not a global warning bypass. Any other ZAP baseline alert remains a warning/failure and makes the gate non-zero.diff --git a/lib/security/security-scanner-supply-chain.test.ts b/lib/security/security-scanner-supply-chain.test.tsindex 5b6a0098..e6ee8145 100644--- a/lib/security/security-scanner-supply-chain.test.ts+++ b/lib/security/security-scanner-supply-chain.test.ts@@ -31,9 +31,12 @@ describe("security scanner supply chain", () => {expect(script).not.toContain("ghcr.io/zaproxy/zaproxy@sha256:");});- it("keeps cache retrieval informational only for the reviewed static-asset policy", () => {+ 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");- expect(policy).toContain("10050\tINFO\t(Content-hashed Next.js static chunks/fonts are intentionally cacheable; authenticated and user-specific responses remain no-store)");- expect(policy).not.toContain("10050\tIGNORE");+ 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");+ expect(ultimate).toContain('node "$ROOT/scripts/check-zap-report.mjs" "$ZAP_WORK/report_json.json"');});});diff --git a/scripts/check-zap-report.mjs b/scripts/check-zap-report.mjsnew file mode 100644index 00000000..9d226509--- /dev/null+++ b/scripts/check-zap-report.mjs@@ -0,0 +1,132 @@+import { readFileSync } from "node:fs";+import { resolve } from "node:path";+import { fileURLToPath } from "node:url";+import { requireDastTarget } from "./check-dast-target.mjs";++const CACHE_RULE = "10050";+const STATIC_CACHE_PATHS = [+ /^\/_next\/static\/chunks\/[^/?#]+\.js$/,+ /^\/_next\/static\/media\/[^/?#]+\.woff2$/,+];++function asArray(value) {+ return Array.isArray(value) ? value : [];+}++export function reviewedInfoRules(policyText) {+ const ids = new Set();+ for (const [index, raw] of policyText.split("\n").entries()) {+ const line = raw.trim();+ if (!line || line.startsWith("#")) continue;+ const parts = raw.split("\t");+ if (parts.length < 2 || !parts[0].trim() || !parts[1].trim()) {+ throw new Error("ZAP policy line " + (index + 1) + " is malformed");+ }+ const id = parts[0].trim();+ const action = parts[1].trim().toUpperCase();+ if (action !== "INFO") throw new Error("ZAP policy rule " + id + " must remain INFO");+ if (id === CACHE_RULE) {+ throw new Error("ZAP rule 10050 must be path-scoped by report validation, not rule-wide policy");+ }+ ids.add(id);+ }+ return ids;+}++function safeLocation(url) {+ return url.origin + url.pathname;+}++function reviewedStaticCacheInstance(instance, targetOrigin) {+ if (!instance || typeof instance !== "object") return false;+ if (String(instance.method ?? "GET").toUpperCase() !== "GET") return false;+ let url;+ try {+ url = new URL(String(instance.uri ?? ""));+ } catch {+ return false;+ }+ if (url.origin !== targetOrigin || url.username || url.password || url.search || url.hash) return false;+ return STATIC_CACHE_PATHS.some((pattern) => pattern.test(url.pathname));+}++export function validateZapReport(report, { target, stepOutcome = "success", policyText }) {+ if (stepOutcome !== "success") {+ throw new Error("ZAP scanner step did not complete successfully");+ }+ const approvedTarget = new URL(requireDastTarget(target));+ if (!report || typeof report !== "object") throw new Error("ZAP report is missing or malformed");+ const sites = asArray(report.site);+ if (sites.length === 0) throw new Error("ZAP report contains no scanned site");++ const infoRules = reviewedInfoRules(policyText);+ let sawTarget = false;+ let reviewedCacheInstances = 0;+ let reviewedInfoAlerts = 0;++ for (const site of sites) {+ let siteUrl;+ try {+ siteUrl = new URL(String(site?.["@name"] ?? ""));+ } catch {+ throw new Error("ZAP report contains an invalid site origin");+ }+ if (siteUrl.origin !== approvedTarget.origin) {+ throw new Error("ZAP report contains an unexpected site origin: " + siteUrl.origin);+ }+ sawTarget = true;++ for (const alert of asArray(site?.alerts)) {+ const rule = String(alert?.pluginid ?? alert?.pluginId ?? "");+ if (!rule) throw new Error("ZAP report contains an alert without a rule id");++ if (rule === CACHE_RULE) {+ const instances = asArray(alert?.instances);+ if (instances.length === 0) throw new Error("ZAP rule 10050 has no reviewable instances");+ for (const instance of instances) {+ if (!reviewedStaticCacheInstance(instance, approvedTarget.origin)) {+ let location = "unparseable URL";+ try {+ location = safeLocation(new URL(String(instance?.uri ?? "")));+ } catch {}+ throw new Error("ZAP rule 10050 is outside the reviewed static-asset scope: " + location);+ }+ reviewedCacheInstances += 1;+ }+ continue;+ }++ if (infoRules.has(rule)) {+ reviewedInfoAlerts += 1;+ continue;+ }+ throw new Error("ZAP report contains an unreviewed alert rule: " + rule);+ }+ }++ if (!sawTarget) throw new Error("ZAP report does not contain the approved target");+ return { reviewedCacheInstances, reviewedInfoAlerts, siteCount: sites.length };+}++function main() {+ const reportPath = process.argv[2] || "report_json.json";+ const target = process.env.MSO_DAST_URL;+ const stepOutcome = process.env.MSO_ZAP_STEP_OUTCOME || "success";+ try {+ const report = JSON.parse(readFileSync(reportPath, "utf8"));+ const policyText = readFileSync("security/zap-baseline.conf", "utf8");+ const result = validateZapReport(report, { target, stepOutcome, policyText });+ process.stdout.write(+ "ZAP report accepted: " + result.siteCount + " site(s), " ++ result.reviewedInfoAlerts + " reviewed INFO alert group(s), " ++ result.reviewedCacheInstances + " reviewed static-cache instance(s)\n"+ );+ } catch (error) {+ process.stderr.write(+ "ZAP report rejected: " + (error instanceof Error ? error.message : "unknown validation error") + "\n"+ );+ process.exitCode = 1;+ }+}++if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1])) main();diff --git a/scripts/dast-target.test.ts b/scripts/dast-target.test.tsindex 53c60cd8..bed3c7c2 100644--- a/scripts/dast-target.test.ts+++ b/scripts/dast-target.test.ts@@ -24,14 +24,20 @@ describe("passive DAST requires an explicit safe target", () => {const guard = workflow.indexOf("run: node scripts/check-dast-target.mjs");const scan = workflow.indexOf("uses: zaproxy/action-baseline@");expect(guard).toBeGreaterThan(0); expect(scan).toBeGreaterThan(guard);- expect(workflow).not.toMatch(/^\s*if:/m);+ const scanEnd = workflow.indexOf("- name: Require only reviewed passive findings");+ const scanStep = workflow.slice(workflow.lastIndexOf("- name: Run passive ZAP baseline"), scanEnd);+ expect(scanStep).not.toMatch(/^\s*if:/m);expect(workflow).toContain("MSO_DAST_URL: ${{ vars.MSO_DAST_URL }}");- expect(workflow).toContain("fail_action: true");+ expect(workflow).toContain("id: zap");+ expect(workflow).toContain("continue-on-error: true");+ expect(workflow).toContain("fail_action: false");expect(workflow).toContain("allow_issue_writing: false");expect(workflow).toContain("rules_file_name: security/zap-baseline.conf");expect(workflow).toContain("cmd_options: -m 2 -c security/zap-baseline.conf");+ expect(workflow).toContain("run: node scripts/check-zap-report.mjs report_json.json");+ expect(workflow).toContain("MSO_ZAP_STEP_OUTCOME: ${{ steps.zap.outcome }}");const rules = readFileSync("security/zap-baseline.conf", "utf8").split("\n").filter(line => line && !line.startsWith("#"));- expect(rules.map(line => line.split("\t")[0])).toEqual(["10015", "10049", "10050", "10055", "10096", "90004"]);+ expect(rules.map(line => line.split("\t")[0])).toEqual(["10015", "10049", "10055", "10096", "90004"]);expect(rules.every(line => line.split("\t")[1] === "INFO")).toBe(true);expect(workflow).not.toContain("-I");});diff --git a/scripts/security-ultimate.sh b/scripts/security-ultimate.shindex b12918cc..a8a9b0bc 100755--- a/scripts/security-ultimate.sh+++ b/scripts/security-ultimate.sh@@ -137,9 +137,17 @@ if [[ "${MSO_SECURITY_SKIP_DAST:-0}" != "1" ]]; then# container user can create its ephemeral files. It contains no credentials.chmod 777 "$ZAP_WORK"chmod 644 "$ZAP_WORK/zap-baseline.conf"- run_capture "OWASP ZAP baseline" docker run --rm -t \- -v "$ZAP_WORK:/zap/wrk:rw" "$ZAP_IMAGE" \- zap-baseline.py -t "$DAST_URL" -m 2 -c zap-baseline.conf+ run_reviewed_zap() {+ local rc=0+ docker run --rm -t \+ -v "$ZAP_WORK:/zap/wrk:rw" "$ZAP_IMAGE" \+ zap-baseline.py -t "$DAST_URL" -m 2 -c zap-baseline.conf -J report_json.json || rc=$?+ # ZAP uses 1/2 for alert findings; raw report validation decides whether every finding is reviewed.+ if (( rc > 2 )); then return "$rc"; fi+ MSO_DAST_URL="$DAST_URL" MSO_ZAP_STEP_OUTCOME=success \+ node "$ROOT/scripts/check-zap-report.mjs" "$ZAP_WORK/report_json.json"+ }+ run_capture "OWASP ZAP baseline" run_reviewed_zapchmod 700 "$ZAP_WORK"elseprintf '%-28s %s\n' "OWASP ZAP baseline" SKIPPEDdiff --git a/scripts/zap-report.test.ts b/scripts/zap-report.test.tsnew file mode 100644index 00000000..387bbfd1--- /dev/null+++ b/scripts/zap-report.test.ts@@ -0,0 +1,70 @@+import { describe, expect, it } from "vitest";+import { readFileSync } from "node:fs";+import { validateZapReport } from "./check-zap-report.mjs";++const target = "https://mso.example.com";+const policyText = [+ "10015\tINFO\t(manifest)",+ "10049\tINFO\t(cache policy)",+ "10055\tINFO\t(csp)",+ "10096\tINFO\t(timestamp)",+ "90004\tINFO\t(cross-origin policy)",+].join("\n");++function report(alerts: unknown[]) {+ return { site: [{ "@name": target, alerts }] };+}++function alert(pluginid: string, uris: string[]) {+ return { pluginid, instances: uris.map(uri => ({ uri, method: "GET" })) };+}++describe("path-scoped ZAP report review", () => {+ it("accepts reviewed immutable Next.js cache paths while keeping rule 10050 out of the rule-wide policy", () => {+ const actualPolicy = readFileSync("security/zap-baseline.conf", "utf8");+ expect(actualPolicy).not.toMatch(/^10050\t/m);+ expect(validateZapReport(+ report([+ alert("10055", [target + "/"]),+ alert("10050", [+ target + "/_next/static/chunks/abc-123.js",+ target + "/_next/static/media/Geist_Variable-s.p.hash.woff2",+ ]),+ ]),+ { target, policyText },+ )).toMatchObject({ reviewedCacheInstances: 2, reviewedInfoAlerts: 1 });+ });++ it.each([+ target + "/api/v1/private",+ target + "/login",+ target + "/_next/static/chunks/a.js?token=secret",+ target + "/_next/static/media/font.ttf",+ "https://other.example.com/_next/static/chunks/a.js",+ ])("rejects rule 10050 outside the reviewed static-cache boundary: %s", uri => {+ expect(() => validateZapReport(+ report([alert("10050", [uri])]),+ { target, policyText },+ )).toThrow(/10050.*outside the reviewed static-asset scope/);+ });++ it("fails closed for every other unreviewed rule", () => {+ expect(() => validateZapReport(+ report([alert("10054", [target + "/"])]),+ { target, policyText },+ )).toThrow(/unreviewed alert rule: 10054/);+ });++ it("fails closed when scanner action failed or report is incomplete", () => {+ expect(() => validateZapReport(report([]), { target, policyText, stepOutcome: "failure" })).toThrow(/did not complete/);+ expect(() => validateZapReport({ site: [] }, { target, policyText })).toThrow(/no scanned site/);+ expect(() => validateZapReport(report([{ pluginid: "10050", instances: [] }]), { target, policyText })).toThrow(/no reviewable instances/);+ });++ it("refuses to put rule 10050 back into the rule-wide policy", () => {+ expect(() => validateZapReport(+ report([]),+ { target, policyText: policyText + "\n10050\tINFO\t(too broad)" },+ )).toThrow(/10050 must be path-scoped/);+ });+});diff --git a/security/zap-baseline.conf b/security/zap-baseline.confindex 0fc8f1a0..8013193d 100644--- a/security/zap-baseline.conf+++ b/security/zap-baseline.conf@@ -3,7 +3,6 @@# Any other ZAP baseline rule remains WARN by default and therefore fails the gate (exit 2).10015 INFO (Public web manifest intentionally revalidates; no sensitive content)10049 INFO (Private/authenticated responses intentionally use no-store; static auth-shell responses inherit it)-10050 INFO (Content-hashed Next.js static chunks/fonts are intentionally cacheable; authenticated and user-specific responses remain no-store)10055 INFO (CSP permits arbitrary HTTPS image/embed sources by product design; connect-src remains tightly restricted)10096 INFO (Build/static bundle contains ordinary Unix timestamps; no credential or host-secret exposure)90004 INFO (COEP intentionally omitted because cross-origin media/embeds are supported; inbound framing is denied separately)