Skip to content

Survey What Blog Posts Load Before a Blog Content-Security-Policy #501

Closed

Description

@ptr727

Summary

The family site sends a Content-Security-Policy, and the blog sends none. deploy/README.md "Security headers" states the reason: blog posts embed third-party content, so a policy has to wait for a survey of what the posts load. This issue tracks that survey, which #497 kept out of scope.

Work

  • List every origin the built site loads from: scripts, frames, images, fonts, and styles, across content/ and the theme's partials.
  • Draft a policy that allows exactly those origins. Try it first as Content-Security-Policy-Report-Only on local staging, and read the browser console on a sample of posts.
  • Decide whether to ship it as enforcing or report-only. That decision belongs to the maintainer.

Done

The blog block sends a policy that the posts' own embeds pass, or the README records why the blog has none.

🤖 Generated with Claude Code

Activity

  1. ptr727 commented on Oct 25, 2026

    @ptr727
    OwnerAuthor

    Survey result, from a minified build of develop at b13ce30.

    • Scripts: no post loads a script from another host. The theme writes four inline scripts, each byte-identical on every page, so they can be listed by hash. The search page loads one script of the site's own.
    • Frames, objects, forms: none on any page.
    • Styles and fonts: the site's own CSS, an inline <style> on every page, style= attributes on 16 posts, and Google Fonts.
    • Images: the site's own, apart from 95 hotlinked images on eight posts. Every one sampled answers 404, so they are already broken. Filed as Settle the Dead Hotlinked Images on Eight Archived Posts #513.

    Decisions, put to the maintainer and answered on 2026-10-24:

    1. Inline scripts are allowed by sha256 hash, with a build gate in make-release.sh that fails when the hashes and the built scripts differ. Not chosen: moving the scripts into a file through theme overrides, or 'unsafe-inline'.
    2. img-src 'self', leaving the dead origins out, with Settle the Dead Hotlinked Images on Eight Archived Posts #513 filed for the broken images.
    3. The policy ships enforcing, provided the local staging trial shows no violation beyond those images.

    Trial: the policy ran as Content-Security-Policy-Report-Only on local staging. A headless Chromium pass over every rendered URL and the search page recorded securitypolicyviolation events. All 328 pages carried the header. The only violations were the 95 dead images, so the policy ships enforcing.

    🤖 Generated with Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions