Skip to content

Conversation

@sideshowbarker
Copy link
Member

Add a normative document-conformance (authoring) requirement that a Content Security Policy given in the value of the content attribute of a meta[http-equiv=content-security-policy] element must not contain any report-uri, frame-ancestors, or sandbox directives.

To help authors/developers avoid making the mistake of putting report-uri, frame-ancestors, or sandbox directives in meta—where UAs will just (silently) ignore them—the document-conformance (authoring) side of the spec’s CSP requirements should explicitly disallow those directives in meta.

Adding this to the spec also enables me to add a corresponding error message to the HTML checker.

cc @mikewest

source Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could wrap just before data-x here. Same for others.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could wrap just before data-x here. Same for others.

OK—done in 745be2f

@sideshowbarker
Copy link
Member Author

I'd like wrapping to occur where there would otherwise be spaces, so that it matches what my text editor's "hard wrap" feature does without manual tweaks.

Yeah, agreed. Too ugly and not consistent with what we've done so far :)

OK then, settled on this:

     attribute in the <span data-x="attr-meta-http-equiv-content-security-policy">Content security
     policy state</span>, the <code data-x="attr-meta-content">content</code> attribute must have a
     value consisting of a <span data-x="Content Security Policy syntax">valid Content Security
-    Policy</span>, which will be <span data-x="enforce the policy">enforced</span> upon the current
-    document. <ref spec="CSP"></p>
+    Policy</span>, but must not contain any <code data-x="report-uri directive">report-uri</code>,
+    <code data-x="frame-ancestors directive">frame-ancestors</code>, or <code data-x="sandbox
+    directive">sandbox</code> <span data-x="Content Security Policy directive">directives</span>.
+    The <span>Content Security Policy</span> given in the <code
+    data-x="attr-meta-content">content</code> attribute will be <span
+    data-x="enforce the policy">enforced</span> upon the current document. <ref spec="CSP"></p>

@annevk
Copy link
Member

annevk commented Jan 19, 2016

We are still waiting for @mikewest to review this? LGTM otherwise.

@sideshowbarker
Copy link
Member Author

We are still waiting for @mikewest to review this?

Yeah—especially since it’s a normative change, don’t think it should be merged til he’s reviewed and OK’ed it.

@mikewest
Copy link
Member

LGTM, sorry for the delay.

Note that I want to drop the restriction on sandbox (and Chrome willfully violates the spec at the moment), but the text you've written is otherwise spot on (and matches Firefox and Edge's behavior).

Add a normative document-conformance (authoring) requirement that a Content
Security Policy given in the value of the `content` attribute of a
meta[http-equiv="content-security-policy] element must not contain any
`report-uri`, `frame-ancestors`, or `sandbox` directives.
@annevk annevk force-pushed the meta-csp-disallowed-directives branch from 9bb1782 to 3947072 Compare January 29, 2016 22:54
@annevk annevk merged commit 3947072 into master Jan 29, 2016
@annevk annevk deleted the meta-csp-disallowed-directives branch January 29, 2016 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants