fix(gateway): add HSTS header hardening and docs

This commit is contained in:
Peter Steinberger
2026-02-23 19:47:09 +00:00
parent c88915b721
commit 9af3ec92a5
16 changed files with 275 additions and 2 deletions

View File

@@ -189,4 +189,44 @@ describe("resolveGatewayRuntimeConfig", () => {
);
});
});
describe("HTTP security headers", () => {
it("resolves strict transport security header from config", async () => {
const result = await resolveGatewayRuntimeConfig({
cfg: {
gateway: {
bind: "loopback",
auth: { mode: "none" },
http: {
securityHeaders: {
strictTransportSecurity: " max-age=31536000; includeSubDomains ",
},
},
},
},
port: 18789,
});
expect(result.strictTransportSecurityHeader).toBe("max-age=31536000; includeSubDomains");
});
it("does not set strict transport security when explicitly disabled", async () => {
const result = await resolveGatewayRuntimeConfig({
cfg: {
gateway: {
bind: "loopback",
auth: { mode: "none" },
http: {
securityHeaders: {
strictTransportSecurity: false,
},
},
},
},
port: 18789,
});
expect(result.strictTransportSecurityHeader).toBeUndefined();
});
});
});