-
Notifications
You must be signed in to change notification settings - Fork 147
/
index.html
5649 lines (3090 loc) · 275 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Content Security Policy Level 2</title>
<link href="../default.css" rel="stylesheet" type="text/css">
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<meta content="Bikeshed 1.0.0" name="generator">
<style>
table {
text-align: left;
margin: 20px;
width: 100%;
border-collapse: collapse;
}
tbody tr:nth-child(odd) {
background-color: #EEE;
}
th {
border-bottom: 1px solid #999;
padding: 0.5em;
}
td:first-child {
width: 30%;
padding-right: 1em;
}
td {
vertical-align: top;
padding: 0.5em;
}
tbody th {
border: 0;
background-color: #FFF;
}
tr.section {
border-top: 1px solid #999;
vertical-align: top;
}
</style>
</head>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/">
<img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72">
</a>
</p>
<h1 class="p-name no-ref" id="title">Content Security Policy Level 2</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft,
<time class="dt-updated" datetime="2015-08-12">12 August 2015</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://w3c.github.io/webappsec/specs/CSP2/">https://w3c.github.io/webappsec/specs/CSP2/</a>
<dt>Latest version:
<dd><a href="http://www.w3.org/TR/CSP2/">http://www.w3.org/TR/CSP2/</a>
<dt>Previous Versions:
<dd><a href="http://www.w3.org/TR/2014/WD-CSP2-20140703/" rel="previous">http://www.w3.org/TR/2014/WD-CSP2-20140703/</a>
<dd><a href="http://www.w3.org/TR/2014/WD-CSP11-20140211/" rel="previous">http://www.w3.org/TR/2014/WD-CSP11-20140211/</a>
<dd><a href="http://www.w3.org/TR/2012/CR-CSP-20121115/" rel="previous">http://www.w3.org/TR/2012/CR-CSP-20121115/</a>
<dt>Feedback:
<dd><span><a href="mailto:public-webappsec@w3.org?subject=%5BCSP2%5D%20YOUR%20TOPIC%20HERE">public-webappsec@w3.org</a> with subject line “<kbd>[CSP2] <var>… message topic …</var></kbd>” (<a href="http://lists.w3.org/Archives/Public/public-webappsec/" rel="discussion">archives</a>)</span>
<dt>Issue Tracking:
<dd><a href="https://github.com/w3c/webappsec/issues/">GitHub</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard" data-editor-id="56384"><a class="p-name fn u-email email" href="mailto:mkwst@google.com">Mike West</a> (<span class="p-org org">Google Inc.</span>)
<dd class="editor p-author h-card vcard" data-editor-id="39502"><a class="p-name fn u-email email" href="mailto:w3c@adambarth.com">Adam Barth</a> (<span class="p-org org">Google Inc.</span>)
<dd class="editor p-author h-card vcard" data-editor-id="41156"><a class="p-name fn u-email email" href="mailto:dveditz@mozilla.com">Dan Veditz</a> (<span class="p-org org">Mozilla Corporation</span>)
<dt>Former Editors:
<dd>
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:brandon@hackmill.com">Brandon Sterne</a> (<span class="p-org org">formerly of Mozilla Corporation</span>)
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2015 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
</p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<p>This document defines a policy language used to declare a set of content restrictions for a web resource, and a mechanism for transmitting the policy from a server to a client where the policy is enforced.</p>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p>
This is a public copy of the editors’ draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress.
</p>
<p>
<strong>Changes to this document may be tracked at
<a href="https://github.com/w3c/webappsec">https://github.com/w3c/webappsec</a>.</strong>
</p>
<p>
The (<a href="http://lists.w3.org/Archives/Public/public-webappsec/">archived</a>) public mailing list
<a href="mailto:public-webappsec@w3.org?Subject=%5BCSP2%5D%20PUT%20SUBJECT%20HERE">public-webappsec@w3.org</a>
(see <a href="http://www.w3.org/Mail/Request">instructions</a>)
is preferred for discussion of this specification.
When sending e-mail,
please put the text “CSP2” in the subject,
preferably like this:
“[CSP2] <em>…summary of comment…</em>”
</p>
<p>
This document was produced by the
<a href="http://www.w3.org/2011/webappsec/">Web Application Security Working Group</a>.
</p>
<p>
This document was produced by a group operating under
the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/49309/status" rel="disclosure">public list of any patent disclosures</a>
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 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.
</p>
<p>
This document is governed by the <a href="http://www.w3.org/2014/Process-20140801/" id="w3c_process_revision">1 August 2014 W3C Process Document</a>.
</p></div>
<div data-fill-with="at-risk"></div>
<h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="content">Table of Contents</span></h2>
<div data-fill-with="table-of-contents" role="navigation">
<ul class="toc" role="directory">
<li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<ul class="toc">
<li><a href="#changes-from-level-1"><span class="secno">1.1</span> <span class="content">Changes from Level 1</span></a>
</ul>
<li><a href="#key-concepts"><span class="secno">2</span> <span class="content">Key Concepts and Terminology</span></a>
<ul class="toc">
<li><a href="#terms-defined-here"><span class="secno">2.1</span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#terms-defined-by-reference"><span class="secno">2.2</span> <span class="content">Terms defined by reference</span></a>
<li><a href="#html-concepts"><span class="secno">2.3</span> <span class="content">Relevant Concepts from HTML</span></a>
<li><a href="#grammar"><span class="secno">2.4</span> <span class="content">Grammatical Concepts</span></a>
</ul>
<li><a href="#policy-delivery"><span class="secno">3</span> <span class="content">Policy Delivery</span></a>
<ul class="toc">
<li><a href="#content-security-policy-header-field"><span class="secno">3.1</span> <span class="content">
<code>Content-Security-Policy</code> Header Field
</span></a>
<li><a href="#content-security-policy-report-only-header-field"><span class="secno">3.2</span> <span class="content">
<code>Content-Security-Policy-Report-Only</code> Header Field
</span></a>
<li><a href="#delivery-html-meta-element"><span class="secno">3.3</span> <span class="content">
HTML <code><span>meta</span></code> Element
</span></a>
<li><a href="#enforcing-multiple-policies"><span class="secno">3.4</span> <span class="content">Enforcing multiple policies.</span></a>
<li><a href="#which-policy-applies"><span class="secno">3.5</span> <span class="content">Policy applicability</span></a>
</ul>
<li><a href="#syntax-and-algorithms"><span class="secno">4</span> <span class="content">Syntax and Algorithms</span></a>
<ul class="toc">
<li><a href="#policy-syntax"><span class="secno">4.1</span> <span class="content">Policy Syntax</span></a>
<ul class="toc">
<li><a href="#policy-parsing"><span class="secno">4.1.1</span> <span class="content">Parsing Policies</span></a>
</ul>
<li><a href="#source-list-syntax"><span class="secno">4.2</span> <span class="content">Source List Syntax</span></a>
<ul class="toc">
<li><a href="#source-list-parsing"><span class="secno">4.2.1</span> <span class="content">Parsing Source Lists</span></a>
<li><a href="#match-source-expression"><span class="secno">4.2.2</span> <span class="content">Matching Source Expressions</span></a>
<ul class="toc">
<li><a href="#source-list-guid-matching"><span class="secno">4.2.2.1</span> <span class="content">
Security Considerations for GUID URL schemes
</span></a>
<li><a href="#source-list-path-patching"><span class="secno">4.2.2.2</span> <span class="content">Path Matching</span></a>
<li><a href="#source-list-paths-and-redirects"><span class="secno">4.2.2.3</span> <span class="content">Paths and Redirects</span></a>
</ul>
<li><a href="#script-src-the-nonce-attribute"><span class="secno">4.2.3</span> <span class="content">
The <code>nonce</code> attribute
</span></a>
<li><a href="#source-list-valid-nonces"><span class="secno">4.2.4</span> <span class="content">Valid Nonces</span></a>
<li><a href="#source-list-valid-hashes"><span class="secno">4.2.5</span> <span class="content">Valid Hashes</span></a>
</ul>
<li><a href="#media-type-list-syntax"><span class="secno">4.3</span> <span class="content">Media Type List Syntax</span></a>
<ul class="toc">
<li><a href="#media-type-list-parsing"><span class="secno">4.3.1</span> <span class="content">Parsing</span></a>
<li><a href="#media-type-list-matching"><span class="secno">4.3.2</span> <span class="content">Matching</span></a>
</ul>
<li><a href="#violation-reports"><span class="secno">4.4</span> <span class="content">Reporting</span></a>
</ul>
<li><a href="#processing-model"><span class="secno">5</span> <span class="content">Processing Model</span></a>
<ul class="toc">
<li><a href="#processing-model-workers"><span class="secno">5.1</span> <span class="content">Workers</span></a>
<li><a href="#processing-model-iframe-srcdoc"><span class="secno">5.2</span> <span class="content"><code>srcdoc</code> IFrames</span></a>
</ul>
<li><a href="#script-interfaces"><span class="secno">6</span> <span class="content">Script Interfaces</span></a>
<ul class="toc">
<li><a href="#securitypolicyviolationevent-interface"><span class="secno">6.1</span> <span class="content">
<code>SecurityPolicyViolationEvent</code> Interface
</span></a>
<li><a href="#securitypolicyviolationeventinit-interface"><span class="secno">6.2</span> <span class="content">
<code>SecurityPolicyViolationEventInit</code> Interface
</span></a>
<li><a href="#firing-securitypolicyviolationevent-events"><span class="secno">6.3</span> <span class="content">Firing Violation Events</span></a>
</ul>
<li><a href="#directives"><span class="secno">7</span> <span class="content">Directives</span></a>
<ul class="toc">
<li><a href="#directive-base-uri"><span class="secno">7.1</span> <span class="content"><code>base-uri</code></span></a>
<li><a href="#directive-child-src"><span class="secno">7.2</span> <span class="content"><code>child-src</code></span></a>
<ul class="toc">
<li><a href="#directive-child-src-nested"><span class="secno">7.2.1</span> <span class="content">Nested Browsing Contexts</span></a>
<li><a href="#directive-child-src-workers"><span class="secno">7.2.2</span> <span class="content">Workers</span></a>
</ul>
<li><a href="#directive-connect-src"><span class="secno">7.3</span> <span class="content"><code>connect-src</code></span></a>
<ul class="toc">
<li><a href="#connect-src-usage"><span class="secno">7.3.1</span> <span class="content">Usage</span></a>
</ul>
<li><a href="#directive-default-src"><span class="secno">7.4</span> <span class="content"><code>default-src</code></span></a>
<ul class="toc">
<li><a href="#default-src-usage"><span class="secno">7.4.1</span> <span class="content">Usage</span></a>
</ul>
<li><a href="#directive-font-src"><span class="secno">7.5</span> <span class="content"><code>font-src</code></span></a>
<li><a href="#directive-form-action"><span class="secno">7.6</span> <span class="content"><code>form-action</code></span></a>
<li><a href="#directive-frame-ancestors"><span class="secno">7.7</span> <span class="content"><code>frame-ancestors</code></span></a>
<ul class="toc">
<li><a href="#frame-ancestors-and-frame-options"><span class="secno">7.7.1</span> <span class="content">
Relation to <code>X-Frame-Options</code>
</span></a>
<li><a href="#frame-ancestors-multiple-source-values"><span class="secno">7.7.2</span> <span class="content">Multiple Host Source Values</span></a>
</ul>
<li><a href="#directive-frame-src"><span class="secno">7.8</span> <span class="content"><code>frame-src</code></span></a>
<li><a href="#directive-img-src"><span class="secno">7.9</span> <span class="content"><code>img-src</code></span></a>
<li><a href="#directive-media-src"><span class="secno">7.10</span> <span class="content"><code>media-src</code></span></a>
<li><a href="#directive-object-src"><span class="secno">7.11</span> <span class="content"><code>object-src</code></span></a>
<li><a href="#directive-plugin-types"><span class="secno">7.12</span> <span class="content"><code>plugin-types</code></span></a>
<ul class="toc">
<li><a href="#plugin-types-usage"><span class="secno">7.12.1</span> <span class="content">Usage</span></a>
<li><a href="#plugin-types-predeclaration"><span class="secno">7.12.2</span> <span class="content">
Predeclaration of expected media types
</span></a>
</ul>
<li><a href="#directive-report-uri"><span class="secno">7.13</span> <span class="content"><code>report-uri</code></span></a>
<li><a href="#directive-sandbox"><span class="secno">7.14</span> <span class="content"><code>sandbox</code></span></a>
<ul class="toc">
<li><a href="#sandboxing-and-workers"><span class="secno">7.14.1</span> <span class="content">Sandboxing and Workers</span></a>
<li><a href="#sandbox-usage"><span class="secno">7.14.2</span> <span class="content">Usage</span></a>
</ul>
<li><a href="#directive-script-src"><span class="secno">7.15</span> <span class="content"><code>script-src</code></span></a>
<ul class="toc">
<li><a href="#script-src-nonce-usage"><span class="secno">7.15.1</span> <span class="content">
Nonce usage for <code><span>script</span></code> elements
</span></a>
<li><a href="#script-src-hash-usage"><span class="secno">7.15.2</span> <span class="content">
Hash usage for <code><span>script</span></code> elements
</span></a>
</ul>
<li><a href="#directive-style-src"><span class="secno">7.16</span> <span class="content"><code>style-src</code></span></a>
<ul class="toc">
<li><a href="#style-src-nonce-usage"><span class="secno">7.16.1</span> <span class="content">
Nonce usage for <code><span>style</span></code> elements
</span></a>
<li><a href="#style-src-hash-usage"><span class="secno">7.16.2</span> <span class="content">
Hash usage for <code><span>style</span></code> elements
</span></a>
</ul>
</ul>
<li><a href="#examples"><span class="secno">8</span> <span class="content">Examples</span></a>
<ul class="toc">
<li><a href="#example-policies"><span class="secno">8.1</span> <span class="content">Sample Policy Definitions</span></a>
<li><a href="#example-violation-report"><span class="secno">8.2</span> <span class="content">Sample Violation Report</span></a>
</ul>
<li><a href="#security-considerations"><span class="secno">9</span> <span class="content">Security Considerations</span></a>
<ul class="toc">
<li><a href="#security-css-parsing"><span class="secno">9.1</span> <span class="content">Cascading Style Sheet (CSS) Parsing</span></a>
<li><a href="#security-redirects"><span class="secno">9.2</span> <span class="content">Redirect Information Leakage</span></a>
</ul>
<li><a href="#implementation-considerations"><span class="secno">10</span> <span class="content">Implementation Considerations</span></a>
<ul class="toc">
<li><a href="#complications"><span class="secno">10.1</span> <span class="content">Processing Complications</span></a>
</ul>
<li><a href="#iana-considerations"><span class="secno">11</span> <span class="content">IANA Considerations</span></a>
<ul class="toc">
<li><a href="#iana-content-security-policy"><span class="secno">11.1</span> <span class="content">Content-Security-Policy</span></a>
<li><a href="#iana-content-security-policy-report-only"><span class="secno">11.2</span> <span class="content">Content-Security-Policy-Report-Only</span></a>
</ul>
<li><a href="#acknowledgements"><span class="secno">12</span> <span class="content">Acknowledgements</span></a>
<li><a href="#conformance"><span class="secno"></span> <span class="content">Conformance</span></a>
<ul class="toc">
<li><a href="#conventions"><span class="secno"></span> <span class="content">Document conventions</span></a>
<li><a href="#conformant-algorithms"><span class="secno"></span> <span class="content">Conformant Algorithms</span></a>
<li><a href="#conformance-classes"><span class="secno"></span> <span class="content">Conformance Classes</span></a>
</ul>
<li><a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ul class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ul>
<li><a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ul class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ul>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
</ul></div>
<main>
<section>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<p><em>This section is not normative.</em></p>
<p>This document defines Content Security Policy, a mechanism web applications
can use to mitigate a broad class of content injection vulnerabilities, such
as cross-site scripting (XSS). Content Security Policy is a declarative policy
that lets the authors (or server administrators) of a web application inform
the client about the sources from which the application expects to load
resources.</p>
<p>To mitigate XSS attacks, for example, a web application can declare that it
only expects to load script from specific, trusted sources. This declaration
allows the client to detect and block malicious scripts injected into the
application by an attacker.</p>
<p>Content Security Policy (CSP) is not intended as a first line of defense
against content injection vulnerabilities. Instead, CSP is best used as
defense-in-depth, to reduce the harm caused by content injection attacks. As
a first line of defense against content injection, server operators should
validate their input and encode their output.</p>
<p>There is often a non-trivial amount of work required to apply CSP to an
existing web application. To reap the greatest benefit, authors will need to
move all inline script and style out-of-line, for example into external
scripts, because the user agent cannot determine whether an inline script
was injected by an attacker.</p>
<p>To take advantage of CSP, a web application opts into using CSP by supplying a
<code>Content-Security-Policy</code> HTTP header. Such policies apply to the
current resource representation only. To supply a policy for an entire site,
the server needs to supply a policy with each resource representation.</p>
<h3 class="heading settled" data-level="1.1" id="changes-from-level-1"><span class="secno">1.1. </span><span class="content">Changes from Level 1</span><a class="self-link" href="#changes-from-level-1"></a></h3>
<p>This document describes an evolution of the
<a href="http://www.w3.org/TR/CSP/">Content Security Policy specification</a>.
Level 2 makes two breaking changes from Level 1, and adds support for a number
of new directives and capabilities which are summarized below:</p>
<ol>
<li>
The following changes are backwards incompatible with the majority of
user agent’s implementations of CSP 1:
<ol>
<li>
The path component of a source expression is now ignored if the
resource being loaded is the result of a redirect, as described in
<a href="#source-list-paths-and-redirects">§4.2.2.3 Paths and Redirects</a>.
<p class="note" role="note">Note: Paths are technically new in CSP2, but they were already
implemented in many user agents before this revision of CSP was
completed, so noting the change here seems reasonable.</p>
<li>
A <a data-link-type="dfn" href="#protected-resource">protected resource</a>’s ability to load Workers is now controlled
via <a data-link-type="dfn" href="#child_src"><code>child-src</code></a> rather than
<a data-link-type="dfn" href="#script_src"><code>script-src</code></a>.
<li>
Workers now have their own policy, separate from the <a data-link-type="dfn" href="#protected-resource">protected
resource</a> which loaded them. This is described in
<a href="#processing-model-workers">§5.1 Workers</a>.
</ol>
<li>
The following directives are brand new in this revision:
<ol>
<li>
<a data-link-type="dfn" href="#base_uri"><code>base-uri</code></a> controls the <a data-link-type="dfn" href="#protected-resource">protected
resource</a>’s ability to specify the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#document-base-url">document base
URL</a>.
<li>
<a data-link-type="dfn" href="#child_src"><code>child-src</code></a> deprecates and replaces
<a data-link-type="dfn" href="#frame_src"><code>frame-src</code></a>, controlling the <a data-link-type="dfn" href="#protected-resource">protected
resource</a>’s ability to embed frames, and to load Workers.
<li>
<a data-link-type="dfn" href="#form_action"><code>form-action</code></a> controls the <a data-link-type="dfn" href="#protected-resource">protected
resource</a>’s ability to submit forms.
<li>
<a data-link-type="dfn" href="#frame_ancestors"><code>frame-ancestors</code></a> controls the <a data-link-type="dfn" href="#protected-resource">protected
resource</a>’s ability be embedded in other documents. It is meant
to supplant the <code>X-Frame-Options</code> HTTP request header.
<li>
<a data-link-type="dfn" href="#plugin_types"><code>plugin-types</code></a> controls the <a data-link-type="dfn" href="#protected-resource">protected
resource</a>’s ability to load specific types of plugins.
</ol>
<li>
Individual inline scripts and stylesheets may be whitelisted via nonces
(as described in <a href="#source-list-valid-nonces">§4.2.4 Valid Nonces</a>) and hashes (as described
in <a href="#source-list-valid-hashes">§4.2.5 Valid Hashes</a>).
<li>
A <code class="idl"><a data-link-type="idl" href="#securitypolicyviolationevent">SecurityPolicyViolationEvent</a></code> is fired upon violations, as described
in <a href="#firing-securitypolicyviolationevent-events">§6.3 Firing Violation Events</a>.
<li>
A number of new fields were added to violation reports (both those POSTED
via <a data-link-type="dfn" href="#report_uri"><code>report-uri</code></a>, and those handed to the DOM via
<code class="idl"><a data-link-type="idl" href="#securitypolicyviolationevent">SecurityPolicyViolationEvent</a></code> events. These include
<code class="idl"><a data-link-type="idl" href="#dom-securitypolicyviolationevent-effectivedirective">effectiveDirective</a></code>,
<code class="idl"><a data-link-type="idl" href="#dom-securitypolicyviolationevent-statuscode">statusCode</a></code>,
<code class="idl"><a data-link-type="idl" href="#dom-securitypolicyviolationevent-sourcefile">sourceFile</a></code>,
<code class="idl"><a data-link-type="idl" href="#dom-securitypolicyviolationevent-linenumber">lineNumber</a></code>, and
<code class="idl"><a data-link-type="idl" href="#dom-securitypolicyviolationevent-columnnumber">columnNumber</a></code>.
<li>
Certain flags present in the <code><a data-link-type="dfn" href="#sandbox">sandbox</a></code> directive now
affect Worker creation, as described in <a href="#sandboxing-and-workers">§7.14.1 Sandboxing and Workers</a>.
</ol>
</section>
<section>
<h2 class="heading settled" data-level="2" id="key-concepts"><span class="secno">2. </span><span class="content">Key Concepts and Terminology</span><a class="self-link" href="#key-concepts"></a></h2>
<h3 class="heading settled" data-level="2.1" id="terms-defined-here"><span class="secno">2.1. </span><span class="content">Terms defined by this specification</span><a class="self-link" href="#terms-defined-here"></a></h3>
<dl>
<dt>
<dfn data-dfn-type="dfn" data-export="" data-local-lt="policy" id="security-policy">security policy<a class="self-link" href="#security-policy"></a></dfn>
<dt>
<dfn data-dfn-type="dfn" data-export="" data-local-lt="directive" id="security-policy-directive">security policy directive<a class="self-link" href="#security-policy-directive"></a></dfn>
<dt>
<dfn data-dfn-type="dfn" data-export="" data-local-lt="directive name" id="security-policy-directive-name">security policy directive name<a class="self-link" href="#security-policy-directive-name"></a></dfn>
<dt>
<dfn data-dfn-type="dfn" data-export="" data-local-lt="directive value" id="security-policy-directive-value">security policy directive value<a class="self-link" href="#security-policy-directive-value"></a></dfn>
<dd>
A <strong>security policy</strong> refers to both a set of security
preferences for restrictions within which content can operate, and
to a fragment of text that codifies or transmits these preferences.
For example, the following string is a policy which restricts script
and object content:
<div class="example" id="example-f8c8229d"><a class="self-link" href="#example-f8c8229d"></a>
<code><a data-link-type="dfn" href="#script_src">script-src</a> 'self'; <a data-link-type="dfn" href="#object_src">object-src</a> 'none'</code>
</div>
<p>Security policies contain a set of <strong>security policy
directives</strong> (<code><a data-link-type="dfn" href="#script_src">script-src</a></code> and
<code><a data-link-type="dfn" href="#object_src">object-src</a></code> in the example above), each responsible
for declaring the restrictions for a particular resource type, or
manipulating a specific aspect of the policy’s restrictions. The list
of directives defined by this specification can be found in
<a href="#directives">§7 Directives</a>.</p>
<p>Each directives has a <strong>name</strong> and a <strong>value</strong>;
a detailed grammar can be found in <a href="#syntax-and-algorithms">§4 Syntax and Algorithms</a>.</p>
<dt>
<dfn data-dfn-type="dfn" data-export="" id="protected-resource">protected resource<a class="self-link" href="#protected-resource"></a></dfn>
<dd>
A <a data-link-type="dfn" href="#security-policy">security policy</a> is applied by a user agent to a specific
<a data-link-type="dfn" href="#resource-representation">resource representation</a>, known as the <strong>protected
resource</strong>. See <a href="#policy-delivery">§3 Policy Delivery</a> for details regarding
the mechanisms by which policies may be applied to a protected
resource.
</dl>
<h3 class="heading settled" data-level="2.2" id="terms-defined-by-reference"><span class="secno">2.2. </span><span class="content">Terms defined by reference</span><a class="self-link" href="#terms-defined-by-reference"></a></h3>
<dl>
<dt>
<dfn data-dfn-type="dfn" data-noexport="" id="globally-unique-identifier">globally unique identifier<a class="self-link" href="#globally-unique-identifier"></a></dfn>
<dd>
Defined in
<a href="https://tools.ietf.org/html/rfc6454#section-2.3">Section 2.3 of
the Origin specification</a>. <a data-link-type="biblio" href="#biblio-rfc6454">[RFC6454]</a>
<p class="note" role="note">NOTE: URLs which do not use hierarchical elements as naming authorities
(<code>data:</code>, for instance) have <a data-link-type="dfn" href="#origin">origins</a> which are globally
unique identifiers.</p>
<dt>
<dfn data-dfn-type="dfn" data-noexport="" id="http-200-response">HTTP 200 response<a class="self-link" href="#http-200-response"></a></dfn>
<dd>
Defined in
<a href="https://tools.ietf.org/html/rfc7231#section-6.3.1">Section
6.3.1 of HTTP/1.1 -- Semantics and Content</a>. <a data-link-type="biblio" href="#biblio-rfc7231">[RFC7231]</a>
<dt>
<dfn data-dfn-type="dfn" data-noexport="" id="json-object">JSON object<a class="self-link" href="#json-object"></a></dfn>
<dt>
<dfn data-dfn-type="dfn" data-noexport="" id="json-stringification">JSON stringification<a class="self-link" href="#json-stringification"></a></dfn>
<dd>
Defined in the JSON specification. <a data-link-type="biblio" href="#biblio-rfc4627">[RFC4627]</a>
<dt>
<dfn data-dfn-type="dfn" data-noexport="" id="origin">origin<a class="self-link" href="#origin"></a></dfn>
<dd>
Defined by the Origin specification. <a data-link-type="biblio" href="#biblio-rfc6454">[RFC6454]</a>
<dt>
<dfn data-dfn-type="dfn" data-local-lt="representation" data-noexport="" id="resource-representation">resource representation<a class="self-link" href="#resource-representation"></a></dfn>
<dd>
Defined in <a href="https://tools.ietf.org/html/rfc7231#section-3">Section
3 of HTTP/1.1 -- Semantics and Content</a>. <a data-link-type="biblio" href="#biblio-rfc7231">[RFC7231]</a>
<dt>
<dfn data-dfn-type="dfn" data-noexport="" id="url">URL<a class="self-link" href="#url"></a></dfn>
<dd>
Defined by <a data-link-type="biblio" href="#biblio-url">[URL]</a>.
<dt><dfn data-dfn-type="dfn" data-noexport="" id="sha_256">SHA-256<a class="self-link" href="#sha_256"></a></dfn>
<dt><dfn data-dfn-type="dfn" data-noexport="" id="sha_384">SHA-384<a class="self-link" href="#sha_384"></a></dfn>
<dt><dfn data-dfn-type="dfn" data-noexport="" id="sha_512">SHA-512<a class="self-link" href="#sha_512"></a></dfn>
<dd>
These digest algorithms are defined by the NIST. <a data-link-type="biblio" href="#biblio-fips180">[FIPS180]</a>
</dl>
<h3 class="heading settled" data-level="2.3" id="html-concepts"><span class="secno">2.3. </span><span class="content">Relevant Concepts from HTML</span><a class="self-link" href="#html-concepts"></a></h3>
<p>The <code><a data-link-type="element" href="http://www.w3.org/TR/html5/obsolete.html#the-applet-element">applet</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-audio-element">audio</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-embed-element">embed</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-iframe-element">iframe</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-img-element">img</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-link-element">link</a></code>,
<code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-object-element">object</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/scripting-1.html#the-script-element">script</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-source-element">source</a></code>, <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-track-element">track</a></code>, and <code><a data-link-type="element" href="http://www.w3.org/TR/html5/embedded-content-0.html#the-video-element">video</a></code> are defined in
<a data-link-type="biblio" href="#biblio-html5">[HTML5]</a>.</p>
<p>The terms <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#auxiliary-browsing-context">auxiliary browsing contexts</a>,
<a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#opener-browsing-context">opener browsing context</a>, and <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#nested-browsing-context">nested browsing contexts</a> are
defined in the HTML5 specification. <a data-link-type="biblio" href="#biblio-html5">[HTML5]</a></p>
<p>A <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#plugin">plugin</a> is defined in the HTML5 specification. <a data-link-type="biblio" href="#biblio-html5">[HTML5]</a></p>
<p>The <code><<@font-face>></code> Cascading Style Sheets (CSS) rule is defined
in the CSS Fonts Module Level 3 specification. <a data-link-type="biblio" href="#biblio-css3-fonts">[CSS3-FONTS]</a></p>
<p>The <code>XMLHttpRequest</code> object is defined in the
<code>XMLHttpRequest</code> specification. <a data-link-type="biblio" href="#biblio-xmlhttprequest">[XMLHTTPREQUEST]</a></p>
<p>The <code>WebSocket</code> object is defined in the <code>WebSocket</code>
specification. <a data-link-type="biblio" href="#biblio-websockets">[WEBSOCKETS]</a></p>
<p>The <code>EventSource</code> object is defined in the <code>EventSource</code>
specification. <a data-link-type="biblio" href="#biblio-eventsource">[EVENTSOURCE]</a></p>
<p>The <dfn data-dfn-type="dfn" data-noexport="" id="runs-a-worker">runs a worker<a class="self-link" href="#runs-a-worker"></a></dfn> algorithm is
<a href="http://www.w3.org/TR/workers/#run-a-worker">defined in the Web
Workers spec</a>. <a data-link-type="biblio" href="#biblio-workers">[WORKERS]</a></p>
<p>The term <dfn data-dfn-type="dfn" data-noexport="" id="callable">callable<a class="self-link" href="#callable"></a></dfn> refers to an object whose interface
has one or more <dfn data-dfn-type="dfn" data-noexport="" id="callers">callers<a class="self-link" href="#callers"></a></dfn> as defined in the <a href="http://www.w3.org/TR/2010/WD-WebIDL-20101021/#idl-callers">Web
IDL</a> specification <a data-link-type="biblio" href="#biblio-webidl">[WEBIDL]</a>.</p>
<h3 class="heading settled" data-level="2.4" id="grammar"><span class="secno">2.4. </span><span class="content">Grammatical Concepts</span><a class="self-link" href="#grammar"></a></h3>
<p>The Augmented Backus-Naur Form (ABNF) notation used in this document is
specified in RFC5234. <a data-link-type="biblio" href="#biblio-abnf">[ABNF]</a></p>
<p>This document also uses the ABNF extension "#rule" as defined in
<a href="https://tools.ietf.org/html/rfc7230#section-7">Section 7</a>
of HTTP/1.1 -- Message Syntax and Routing. <a data-link-type="biblio" href="#biblio-rfc7230">[RFC7230]</a></p>
<p>The following core rules are included by reference, as defined in
<a href="https://tools.ietf.org/html/rfc5234#appendix-B.1">Appendix B.1</a>
of <a data-link-type="biblio" href="#biblio-abnf">[ABNF]</a>: <code><dfn data-dfn-type="dfn" data-noexport="" id="alpha">ALPHA<a class="self-link" href="#alpha"></a></dfn></code> (letters),
<code><dfn data-dfn-type="dfn" data-noexport="" id="digit">DIGIT<a class="self-link" href="#digit"></a></dfn></code> (decimal 0-9), <code><dfn data-dfn-type="dfn" data-noexport="" id="wsp">WSP<a class="self-link" href="#wsp"></a></dfn></code>
(white space) and <code><dfn data-dfn-type="dfn" data-noexport="" id="vchar">VCHAR<a class="self-link" href="#vchar"></a></dfn></code> (printing characters).</p>
</section>
<section>
<h2 class="heading settled" data-level="3" id="policy-delivery"><span class="secno">3. </span><span class="content">Policy Delivery</span><a class="self-link" href="#policy-delivery"></a></h2>
<p>The server delivers a <a data-link-type="dfn" href="#security-policy">policy</a> to the user agent via an HTTP response
header (defined in <a href="#content-security-policy-header-field">§3.1 Content-Security-Policy Header Field</a> and
<a href="#content-security-policy-report-only-header-field">§3.2 Content-Security-Policy-Report-Only Header Field</a>) or an HTML
<code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> element (defined in <a href="#delivery-html-meta-element">§3.3 HTML meta Element</a>).</p>
<section>
<h3 class="heading settled" data-level="3.1" id="content-security-policy-header-field"><span class="secno">3.1. </span><span class="content">
<code>Content-Security-Policy</code> Header Field
</span><a class="self-link" href="#content-security-policy-header-field"></a></h3>
<p>The <code><dfn data-dfn-type="dfn" data-export="" id="content_security_policy">Content-Security-Policy<a class="self-link" href="#content_security_policy"></a></dfn></code> header field is
the preferred mechanism for delivering a policy. The grammar is as follows:</p>
<pre>"Content-Security-Policy:" 1#<a data-link-type="dfn" href="#policy_token">policy-token</a>
</pre>
<p>For example, a response might include the following header field:</p>
<div class="example" id="example-be526382"><a class="self-link" href="#example-be526382"></a>
<code>Content-Security-Policy: <a data-link-type="dfn" href="#script_src">script-src</a> 'self'</code>
</div>
<p>A server MUST NOT send more than one HTTP header field named
<code>Content-Security-Policy</code> with a given <a data-link-type="dfn" href="#resource-representation">resource
representation</a>.</p>
<p>A server MAY send different <code>Content-Security-Policy</code>
header field values with different <a data-link-type="dfn" href="#resource-representation">representations</a> of the same
resource or with different resources.</p>
<p>Upon receiving an HTTP response containing at least one
<code>Content-Security-Policy</code> header field, the user agent
MUST <a data-link-type="dfn" href="#enforce">enforce</a> each of the policies contained in each such
header field.</p>
</section>
<section>
<h3 class="heading settled" data-level="3.2" id="content-security-policy-report-only-header-field"><span class="secno">3.2. </span><span class="content">
<code>Content-Security-Policy-Report-Only</code> Header Field
</span><a class="self-link" href="#content-security-policy-report-only-header-field"></a></h3>
<p>The <code><dfn data-dfn-type="dfn" data-export="" id="content_security_policy_report_only">Content-Security-Policy-Report-Only<a class="self-link" href="#content_security_policy_report_only"></a></dfn></code>
header field lets servers experiment with policies by monitoring (rather
than enforcing) a policy. The grammar is as follows:</p>
<pre>"Content-Security-Policy-Report-Only:" 1#<a data-link-type="dfn" href="#policy_token">policy-token</a>
</pre>
<p>For example, server operators might wish to develop their
security policy iteratively. The operators can deploy a report-only
policy based on their best estimate of how their site behaves:</p>
<div class="example" id="example-77886cbd"><a class="self-link" href="#example-77886cbd"></a>
<pre>Content-Security-Policy-Report-Only: <a data-link-type="dfn" href="#script_src">script-src</a> 'self';
<a data-link-type="dfn" href="#report_uri">report-uri</a> /csp-report-endpoint/
</pre>
</div>
<p>If their site violates this policy the user agent will <a data-link-type="dfn" href="#send-violation-reports">send violation
reports</a> to the URL specified in the policy’s <a data-link-type="dfn" href="#report_uri">report-uri</a>
directive, but allow the violating resources to load regardless. Once a site
has confidence that the policy is appropriate, they can start enforcing the
policy using the <code><a data-link-type="dfn" href="#content_security_policy">Content-Security-Policy</a></code> header field.</p>
<p>A server MUST NOT send more than one HTTP header field named
<code>Content-Security-Policy-Report-Only</code> with a given
<a data-link-type="dfn" href="#resource-representation">resource representation</a>.</p>
<p>A server MAY send different
<code>Content-Security-Policy-Report-Only</code> header field values
with different <a data-link-type="dfn" href="#resource-representation">representations</a> of the same resource or with different
resources.</p>
<p>Upon receiving an HTTP response containing at least one
<code>Content-Security-Policy-Report-Only</code> header field, the
user agent MUST <a data-link-type="dfn" href="#monitor">monitor</a> each of the policies
contained in each such header field.</p>
<p class="note" role="note">Note: The <code><a data-link-type="dfn" href="#content_security_policy_report_only">Content-Security-Policy-Report-Only</a></code>
header is <em>not</em> supported inside a <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> element.</p>
</section>
<section>
<h3 class="heading settled" data-level="3.3" id="delivery-html-meta-element"><span class="secno">3.3. </span><span class="content">
HTML <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> Element
</span><a class="self-link" href="#delivery-html-meta-element"></a></h3>
<p>The server MAY supply policy via one or more HTML <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> elements
with <code><a data-link-type="element-attr" href="http://www.w3.org/TR/html5/document-metadata.html#attr-meta-http-equiv">http-equiv</a></code> attributes that are an <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#ascii-case-insensitive">ASCII case-insensitive
match</a> for the string "<code>Content-Security-Policy</code>". For
example:</p>
<pre class="example" id="example-ff79af85"><a class="self-link" href="#example-ff79af85"></a><meta http-equiv="Content-Security-Policy" content="<a data-link-type="dfn" href="#script_src">script-src</a> 'self'">
</pre>
<p>Add the following entry to the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/document-metadata.html#pragma-directives">pragma directives</a> for the <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code>
element:</p>
<dl>
<dt>
Content security policy
(<code>http-equiv="content-security-policy"</code>)
<dd>
<ol>
<li>If the Document’s <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-head-element">head</a></code> element is not an ancestor of the
<code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> element, abort these steps.
<li>If the <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> element lacks a <code><a data-link-type="element-attr" href="http://www.w3.org/TR/html5/document-metadata.html#attr-meta-content">content</a></code> attribute, abort
these steps.
<li>Let <var>policy</var> be the value of the <code><a data-link-type="element-attr" href="http://www.w3.org/TR/html5/document-metadata.html#attr-meta-content">content</a></code>
attribute of the <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code> element.
<li>Let <var>directive-set</var> be the result of
<a data-link-type="dfn" href="#parse-the-policy">parsing <var>policy</var></a>.
<li>
Remove all occurrences of <code><a data-link-type="dfn" href="#report_uri">report-uri</a></code>,
<code><a data-link-type="dfn" href="#frame_ancestors">frame-ancestors</a></code>, and <code><a data-link-type="dfn" href="#sandbox">sandbox</a></code>
directives from <var>directive-set</var>.
<p class="note" role="note">Note: User agents are encouraged to issue a warning to developers
if one or more of these directives are included in a policy
delivered via <code><a data-link-type="element" href="http://www.w3.org/TR/html5/document-metadata.html#the-meta-element">meta</a></code>.</p>