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
scout/forge:scout/3089-every-forge-response-carries-a-permissio → main 3 commits fork 1 thread · 1 unresolved
3 files
changed +8
−6
src/http/respond.ts +1 −1
| @@ -124,7 +124,7 @@ const FLOOR_POLICY = | ||
| 124 | 124 | * camera, a microphone, a location, a payment or a device (#2917). |
| 125 | 125 | */ |
| 126 | 126 | const PERMISSIONS_POLICY = |
| 127 | "camera=(), microphone=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=()"; | |
| 127 | "camera=(), microphone=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=(), interest-cohort=()"; | |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * 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 @@ | ||
| 3 | 3 | * no socket, each request handed to forgeHttp(app).handle. Every finding that |
| 4 | 4 | * stands today is named in KNOWN with its section and why; a new one fails. |
| 5 | 5 | */ |
| 6 | import { securityFloor } from "../src/http/respond.ts"; | |
| 6 | 7 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 7 | 8 | import { mkdtemp, rm } from "node:fs/promises"; |
| 8 | 9 | import { tmpdir } from "node:os"; |
| 9 | 10 | import { join } from "node:path"; |
| 11 | import { securityFloor } from "../src/http/respond.ts"; | |
| 10 | 12 | import { createApp, type App } from "../src/app.ts"; |
| 11 | 13 | import { commitToBranch, createRepo } from "../src/actions/repos.ts"; |
| 12 | 14 | import { createUser } from "../src/core/users.ts"; |
| @@ -27,7 +29,6 @@ const KNOWN: Record<string, [string, string]> = {}; | ||
| 27 | 29 | const WHY: Record<string, [string, string]> = { |
| 28 | 30 | "color-scheme": ["https://specification.website/#color-scheme", "pages carry no color-scheme meta; the stylesheet picks the theme"], |
| 29 | 31 | 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"], | |
| 31 | 32 | etag: ["https://specification.website/#caching", "server-rendered HTML carries no ETag, so a revisit is never a 304"], |
| 32 | 33 | }; |
| 33 | 34 | for (const [check, why] of Object.entries(WHY)) for (const path of PATHS) KNOWN[`${check} ${path}`] = why; |
| @@ -49,7 +50,7 @@ afterAll(async () => { | ||
| 49 | 50 | }); |
| 50 | 51 | |
| 51 | 52 | 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); | |
| 53 | 54 | const found = await webspec("http://forge.test", PATHS, fetcher, { site: true }); |
| 54 | 55 | const keyOf = (f: { check: string; path: string }) => `${f.check} ${f.path}`; |
| 55 | 56 | // 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 { | ||
| 808 | 808 | label + "same-origin", |
| 809 | 809 | ); |
| 810 | 810 | // 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 | ); | |
| 814 | 815 | expect(label + response.headers.get("strict-transport-security")).toBe( |
| 815 | 816 | label + "max-age=31536000", |
| 816 | 817 | ); |
new above
offline
Non-blocking:
interest-cohortis 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.