cd .. (all tools)

CSP builder

Build and read a Content Security Policy.

// Runs in your browser. Nothing you type here is sent anywhere.

Type a policy, or paste a whole header or <meta> tag.

Start from

Everything from the site itself, nothing from elsewhere.

Scripts.

Remarks

Nothing to remark on this policy.

What it allows

  • default-src

    The fallback for every kind of content that has no directive of its own.

    • 'self' this site itself: same scheme, host and port
  • img-src

    Images and icons.

    • 'self' this site itself: same scheme, host and port
    • data: anything over data:
  • style-src

    Style sheets and inline styles.

    • 'self' this site itself: same scheme, host and port
    • 'unsafe-inline' code written in the page itself: inline blocks and attributes
  • object-src

    Plugins: <object> and <embed>.

    • 'none' nothing at all
  • base-uri

    What a <base> tag may point to.

    • 'self' this site itself: same scheme, host and port
  • form-action

    Where forms may be sent.

    • 'self' this site itself: same scheme, host and port
  • frame-ancestors

    Which sites may show this page in a frame.

    • 'none' nothing at all
  • upgrade-insecure-requests

    Every http: address in the page is fetched over https: instead.

As a header

Content-Security-Policy: default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests

As a tag in the head

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests">

Left out, because a browser ignores it in a tag: frame-ancestors.