Ship file viewer, editor improvements, and private package releases
This commit is contained in:
1 parent
645914955c
commit
a4a31032b9
158 files changed
+10523
-137
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { withSecurityHeaders } from "../src/headers.ts";
|
||||
test("default framing permits self but not cross-origin ancestors", () => {
|
||||
const headers = withSecurityHeaders(
|
||||
new Request("https://app.test"),
|
||||
new Response("ok"),
|
||||
"production",
|
||||
).headers;
|
||||
expect(headers.get("x-frame-options")).toBe("SAMEORIGIN");
|
||||
expect(headers.get("content-security-policy")).toContain("frame-ancestors 'self'");
|
||||
});
|
||||
test("explicit DENY keeps both framing policies restrictive", () => {
|
||||
const headers = withSecurityHeaders(
|
||||
new Request("https://app.test"),
|
||||
new Response("ok"),
|
||||
"production",
|
||||
{ frameOptions: "DENY" },
|
||||
).headers;
|
||||
expect(headers.get("x-frame-options")).toBe("DENY");
|
||||
expect(headers.get("content-security-policy")).toContain("frame-ancestors 'none'");
|
||||
});
|
||||
Reference in new issue
Block a user