fix: tighten security audit for loopback auth

This commit is contained in:
Peter Steinberger
2026-01-25 15:16:40 +00:00
parent 6aec34bc60
commit 885167dd58
5 changed files with 47 additions and 12 deletions

View File

@@ -77,6 +77,31 @@ describe("security audit", () => {
);
});
it("flags loopback control UI without auth as critical", async () => {
const cfg: ClawdbotConfig = {
gateway: {
bind: "loopback",
controlUi: { enabled: true },
auth: { mode: "none" as any },
},
};
const res = await runSecurityAudit({
config: cfg,
includeFilesystem: false,
includeChannelSecurity: false,
});
expect(res.findings).toEqual(
expect.arrayContaining([
expect.objectContaining({
checkId: "gateway.loopback_no_auth",
severity: "critical",
}),
]),
);
});
it("flags logging.redactSensitive=off", async () => {
const cfg: ClawdbotConfig = {
logging: { redactSensitive: "off" },

View File

@@ -236,6 +236,18 @@ function collectGatewayConfigFindings(cfg: ClawdbotConfig): SecurityAuditFinding
});
}
if (bind === "loopback" && controlUiEnabled && auth.mode === "none") {
findings.push({
checkId: "gateway.loopback_no_auth",
severity: "critical",
title: "Gateway auth disabled on loopback",
detail:
"gateway.bind is loopback and gateway.auth is disabled. " +
"If the Control UI is exposed through a reverse proxy, unauthenticated access is possible.",
remediation: "Set gateway.auth (token recommended) or keep the Control UI local-only.",
});
}
if (tailscaleMode === "funnel") {
findings.push({
checkId: "gateway.tailscale_funnel",