Skip to content

Commit the CSP Browser Trial as a Repeatable Check #518

Closed

Description

@ptr727

Summary

The blog's Content-Security-Policy was proven before it shipped with a browser pass that no committed tool can repeat. A scratch script ran headless Chromium in the Playwright container against local staging. It loaded every URL in checks/golden-urls.txt plus /search/ with a query typed, clicked the code-copy buttons, and scrolled each page. It recorded every securitypolicyviolation event. That event fires for Content-Security-Policy-Report-Only and an enforcing policy alike.

checks/check-csp-scripts.py proves the built scripts match the policy's hashes. It cannot see what a browser blocks at run time: a style, a font, a fetch, an image, or a script the proxy injects. The next policy change, such as #515 or a widened img-src from #513, needs the browser pass again. Today it would have to be rewritten from scratch.

Work

  • Commit the pass as a script under checks/, taking a base URL and the URL list. It reports each violation with its directive, the blocked URL, and one page it occurred on, and exits non-zero on any violation not on an allow list.
  • Document how to run it against a mirror in OPERATIONS.md. Cover the Playwright image and the uv invocation that already works on this host.
  • Decide whether it runs only by hand or also after a local mirror deploy. It needs Docker and a browser image, so it cannot join the unit suite as it stands.

Done

A documented, committed command reproduces the trial against any mirror and reports the policy's violations.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    gate
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions