Expose one plan/execute replay contract through both CLI and MCP with exact source, input, runtime, sandbox, limit, and export commitments. Run selected ESM and extracted CommonJS/Rspack factories in a disposable Linux x64 Bubblewrap namespace with a content-addressed Node ELF closure, architecture-checked seccomp, delegated systemd cgroup limits, bounded protocol capture, cancellation, and observable cleanup. Preserve left and right observations as Evidence, derive differential comparisons without erasing unknowns, add optional separately authorized reproducers, and fail closed on stale plans or unavailable host boundaries. Add source-owned parser, sanitizer, clipboard, denial, timeout, OOM, protocol-forgery, and cancellation coverage; a real Linux verifier and workflow; regenerated catalogs and TypeDoc; and updated the packaged REA analysis skill for the 83-tool inventory.
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import {
|
|
systemDoctorHost,
|
|
type DoctorCheck,
|
|
type DoctorHost,
|
|
} from "./application/Doctor.js";
|
|
import { inspectSystemGhidraProvider } from "./ghidra/GhidraDoctor.js";
|
|
import { parseConfig } from "./config.js";
|
|
import { SystemJavaScriptReplayHost } from "./replay/SystemJavaScriptReplayHost.js";
|
|
|
|
/** Compose provider diagnostics at the outer CLI adapter boundary. */
|
|
export const createSystemDoctorHost = (): DoctorHost =>
|
|
systemDoctorHost({
|
|
providerInspections: async () => [await inspectSystemGhidraProvider()],
|
|
javascriptReplayCheck: inspectJavaScriptReplay,
|
|
});
|
|
|
|
const inspectJavaScriptReplay = async (): Promise<DoctorCheck> => {
|
|
const config = parseConfig(process.env);
|
|
if (!config.ok)
|
|
return {
|
|
name: "javascript-replay",
|
|
ok: false,
|
|
classification: "config_drift",
|
|
detail: config.error.message,
|
|
remediation: "Fix the reported REA_JAVASCRIPT_REPLAY_* configuration.",
|
|
};
|
|
if (!config.value.javascriptReplayPolicy.enabled)
|
|
return {
|
|
name: "javascript-replay",
|
|
ok: true,
|
|
classification: "healthy",
|
|
detail:
|
|
"disabled by default; no extracted-module execution path is admitted",
|
|
};
|
|
try {
|
|
await new SystemJavaScriptReplayHost().probe(
|
|
config.value.javascriptReplayPolicy,
|
|
);
|
|
return {
|
|
name: "javascript-replay",
|
|
ok: true,
|
|
classification: "healthy",
|
|
detail: "Linux namespace, seccomp, and delegated cgroup probes passed",
|
|
};
|
|
} catch (cause: unknown) {
|
|
return {
|
|
name: "javascript-replay",
|
|
ok: false,
|
|
classification:
|
|
process.platform === "linux"
|
|
? "missing_dependency"
|
|
: "unsupported_host",
|
|
detail: cause instanceof Error ? cause.message : "sandbox probe failed",
|
|
remediation:
|
|
"Install and configure compatible Bubblewrap and systemd user cgroup delegation, or disable controlled replay.",
|
|
};
|
|
}
|
|
};
|