import { describe, it, expect } from "vitest"; import nextConfig from "./next.config"; // harden-portal-requests (F30): baseline security headers on every path, no X-Powered-By. describe("security headers", () => { it("sends the baseline set on every path", async () => { const rules = await nextConfig.headers!(); const all = rules.find(r => r.source === "/:path*"); expect(all).toBeDefined(); const sent = Object.fromEntries(all!.headers.map(x => [x.key, x.value])); expect(sent).toEqual({ "X-Content-Type-Options": "nosniff", "X-Frame-Options": "SAMEORIGIN", "Content-Security-Policy": "frame-ancestors 'self'; object-src 'none'; base-uri 'self'", "Referrer-Policy": "strict-origin-when-cross-origin", "Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()", }); }); it("does not advertise the framework", () => { expect(nextConfig.poweredByHeader).toBe(false); }); });