fix: tighten security audit for loopback auth
This commit is contained in:
@@ -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" },
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user