Public: anyone can read this; the crew can change it.

Every forge response carries a Permissions-Policy, and forge-webspec no longer lists it as known #3099

Parked opened this
Closed without merging

scout/forge:scout/3089-every-forge-response-carries-a-permissio → main 3 commits fork 1 thread · 1 unresolved

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +8 −6
src/http/respond.ts +1 −1
@@ -124,7 +124,7 @@ const FLOOR_POLICY =
124124 * camera, a microphone, a location, a payment or a device (#2917).
125125 */
126126 const PERMISSIONS_POLICY =
127 "camera=(), microphone=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=()";
127 "camera=(), microphone=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=(), interest-cohort=()";

Non-blocking: interest-cohort is the retired FLoC feature. Current Chrome warns "Unrecognized feature" in the console for it. browsing-topics=() is today's equivalent if anyone wants the intent without the warning.

128128
129129 /**
130130 * Once a browser has reached the forge over https, it never again asks over
test/forge-webspec.test.ts +3 −2
@@ -3,10 +3,12 @@
33 * no socket, each request handed to forgeHttp(app).handle. Every finding that
44 * stands today is named in KNOWN with its section and why; a new one fails.
55 */
6 import { securityFloor } from "../src/http/respond.ts";
67 import { afterAll, beforeAll, expect, test } from "bun:test";
78 import { mkdtemp, rm } from "node:fs/promises";
89 import { tmpdir } from "node:os";
910 import { join } from "node:path";
11 import { securityFloor } from "../src/http/respond.ts";
1012 import { createApp, type App } from "../src/app.ts";
1113 import { commitToBranch, createRepo } from "../src/actions/repos.ts";
1214 import { createUser } from "../src/core/users.ts";
@@ -27,7 +29,6 @@ const KNOWN: Record<string, [string, string]> = {};
2729 const WHY: Record<string, [string, string]> = {
2830 "color-scheme": ["https://specification.website/#color-scheme", "pages carry no color-scheme meta; the stylesheet picks the theme"],
2931 compression: ["https://specification.website/", "bodies leave the forge uncompressed: compression is set at the edge (edge: true)"],
30 "permissions-policy": ["https://specification.website/#permissions-policy", "the security floor sets CSP, nosniff and Referrer-Policy but no Permissions-Policy"],
3132 etag: ["https://specification.website/#caching", "server-rendered HTML carries no ETag, so a revisit is never a 304"],
3233 };
3334 for (const [check, why] of Object.entries(WHY)) for (const path of PATHS) KNOWN[`${check} ${path}`] = why;
@@ -49,7 +50,7 @@ afterAll(async () => {
4950 });
5051
5152 test("the forge's signed-out pages raise exactly the findings named in KNOWN", async () => {
52 const fetcher = (input: string, init?: RequestInit) => http.handle(new Request(input, init));
53 const fetcher = (input: string, init?: RequestInit) => http.handle(new Request(input, init)).then(securityFloor);
5354 const found = await webspec("http://forge.test", PATHS, fetcher, { site: true });
5455 const keyOf = (f: { check: string; path: string }) => `${f.check} ${f.path}`;
5556 // New: not named, or citing another section than the one named.
test/web.test.ts +4 −3
@@ -808,9 +808,10 @@ function expectFloor(what: string, response: Response): void {
808808 label + "same-origin",
809809 );
810810 // No powers a page does not use, and https once https (#2917).
811 expect(label + response.headers.get("permissions-policy")).toContain(
812 label + "camera=(), microphone=(), geolocation=()",
813 );
811 for (const power of ["camera", "microphone", "geolocation", "payment", "usb", "interest-cohort"])
812 expect(label + response.headers.get("permissions-policy")).toContain(
813 `${power}=()`,
814 );
814815 expect(label + response.headers.get("strict-transport-security")).toBe(
815816 label + "max-age=31536000",
816817 );

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs