chore(security): stage COOP/COEP report-only headers#3609
Conversation
|
@lspassos1 is attempting to deploy a commit to the World Monitor Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4e7f9188d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { "key": "Cross-Origin-Opener-Policy-Report-Only", "value": "same-origin" }, | ||
| { "key": "Cross-Origin-Embedder-Policy-Report-Only", "value": "require-corp" }, |
There was a problem hiding this comment.
Include reporting endpoint in COOP/COEP report-only headers
These report-only headers are configured without a report-to parameter, so browsers treat them as functionally inert and do not emit violation reports; that defeats the stated rollout goal of observing COOP/COEP breakage before enforcement. In practice this means production traffic will not generate the telemetry needed to validate readiness for enforced isolation. Add ; report-to="..." and a corresponding Reporting-Endpoints (or equivalent) header so violations are actually delivered.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR stages COOP/COEP cross-origin isolation by adding
Confidence Score: 3/5Safe to merge from a breakage perspective — report-only headers never block requests — but the change does not achieve its own stated goal of collecting isolation violation data from production users. The report-only headers are syntactically correct and won't regress anything. However, without a
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Vercel/nginx as Vercel / nginx
participant ReportCollector as Reporting Endpoint
Browser->>Vercel/nginx: GET /page
Vercel/nginx-->>Browser: 200 + COOP-Report-Only: same-origin\n+ COEP-Report-Only: require-corp\n(no report-to directive)
Note over Browser: Loads cross-origin resource<br/>that would violate COEP
Browser->>Browser: Generate COOP/COEP violation report
Browser--xReportCollector: POST report\n(no endpoint configured — silently dropped)
Note over Browser,ReportCollector: Without Reporting-Endpoints header +\nreport-to directive, reports never leave the browser
Reviews (1): Last reviewed commit: "chore(security): stage COOP COEP report-..." | Re-trigger Greptile |
| { "key": "Cross-Origin-Opener-Policy-Report-Only", "value": "same-origin" }, | ||
| { "key": "Cross-Origin-Embedder-Policy-Report-Only", "value": "require-corp" }, |
There was a problem hiding this comment.
No reporting endpoint — violations are silently discarded
Neither header includes a report-to directive, and there is no matching Reporting-Endpoints (or legacy Report-To) header anywhere in the config. Without a named reporting group, browsers generate the violation reports internally but have nowhere to POST them; they are silently dropped. Because collecting those violations is the entire stated purpose of this "safe first rollout step", the report-only phase as shipped delivers zero observability for production traffic. The Cross-Origin-Opener-Policy-Report-Only value should be same-origin; report-to="default" (and likewise for COEP), paired with a Reporting-Endpoints: default="https://<your-collector>/reports" header on the same route. The nginx config has the same omission.
e4e7f91 to
22c30e5
Compare
|
Updated after the report-only review feedback. The PR now wires I also added tests for the collector, header/report endpoint wiring, nginx alignment, and the no-enforcement rollout guardrail. |
22c30e5 to
0cc6a37
Compare
|
Follow-up to the CI failure: the failing job was Validated locally with |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Root cause
Changes
Reporting-Endpoints: wm-coop-coep="https://worldmonitor.app/api/security/report".Cross-Origin-Opener-Policy-Report-Only: same-origin; report-to="wm-coop-coep".Cross-Origin-Embedder-Policy-Report-Only: require-corp; report-to="wm-coop-coep"./api/security/report, an Edge endpoint that accepts Reporting API batches, rate-limits when Redis is configured, caps payload size, and logs only redacted report summaries.api/api-route-exceptions.jsonas an external protocol endpoint because its wire format is defined by the browser Reporting API.Validation
node --test api/security/report.test.mjs tests/deploy-config.test.mjsnode --test tests/edge-functions.test.mjsnode --test api/security/report.test.mjs tests/deploy-config.test.mjs tests/edge-functions.test.mjsnpm run lint:api-contractnpm run lint:unicodenpm run lint:boundariesnode -e "JSON.parse(require('fs').readFileSync('vercel.json','utf8')); console.log('vercel.json ok')"git diff --check -- api/api-route-exceptions.json api/security/report.js api/security/report.test.mjs vercel.json docker/nginx-security-headers.conf tests/deploy-config.test.mjsnpx biome check api/security/report.js api/security/report.test.mjs tests/deploy-config.test.mjs api/api-route-exceptions.jsonRisk
Refs #3547