Skip to content

Fail the Build on a Frame, Media File, or Object the Blog Policy Blocks #515

Closed

Description

@ptr727

Summary

The blog's Content-Security-Policy names no frame-src or media-src, so both fall back to default-src 'self', and object-src is 'none'. hugo.yaml lets a post carry raw HTML. A post that adds an <iframe>, <video>, <audio>, <source>, <embed>, or <object> loading from another host therefore builds and passes every gate. The browser then blocks it, and the page shows an empty box.

checks/check-csp-scripts.py reads only <script> elements, inline handlers, and javascript: URLs. deploy/README.md "Security headers" tells an author that an embed from another host needs that host in the policy first, but nothing checks it. No post carries such an embed today, so nothing on the site is broken.

Work

  • Extend the gate, which already visits every start tag. For each element that loads a frame, media, or object, compare the origin of its src or data with the directive governing it, including the default-src fallback.
  • Add unit cases built from constructed pages, as the existing ones are.

Done

A post adding a frame, media file, or object from a host the policy does not name fails the release build.

🤖 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