<s>
Content	B-Protocol
Security	I-Protocol
Policy	I-Protocol
(	O
CSP	O
)	O
is	O
a	O
computer	O
security	O
standard	O
introduced	O
to	O
prevent	O
cross-site	O
scripting	O
(	O
XSS	O
)	O
,	O
clickjacking	O
and	O
other	O
code	O
injection	O
attacks	O
resulting	O
from	O
execution	O
of	O
malicious	O
content	O
in	O
the	O
trusted	O
web	O
page	O
context	O
.	O
</s>
<s>
It	O
is	O
a	O
Candidate	O
Recommendation	O
of	O
the	O
W3C	O
working	O
group	O
on	O
Web	O
Application	O
Security	O
,	O
widely	O
supported	O
by	O
modern	O
web	B-Application
browsers	I-Application
.	O
</s>
<s>
CSP	O
provides	O
a	O
standard	O
method	O
for	O
website	O
owners	O
to	O
declare	O
approved	O
origins	O
of	O
content	O
that	O
browsers	B-Application
should	O
be	O
allowed	O
to	O
load	O
on	O
that	O
websitecovered	O
types	O
are	O
JavaScript	B-Language
,	O
CSS	B-Language
,	O
HTML	B-General_Concept
frames	I-General_Concept
,	O
web	O
workers	O
,	O
fonts	O
,	O
images	O
,	O
embeddable	O
objects	O
such	O
as	O
Java	B-Application
applets	I-Application
,	O
ActiveX	B-Application
,	O
audio	O
and	O
video	O
files	O
,	O
and	O
other	O
HTML5	B-Application
features	O
.	O
</s>
<s>
The	O
standard	O
,	O
originally	O
named	O
Content	O
Restrictions	O
,	O
was	O
proposed	O
by	O
Robert	O
Hansen	O
in	O
2004	O
,	O
first	O
implemented	O
in	O
Firefox	B-Application
4	I-Application
and	O
quickly	O
picked	O
up	O
by	O
other	O
browsers	B-Application
.	O
</s>
<s>
Version	O
1	O
of	O
the	O
standard	O
was	O
published	O
in	O
2012	O
as	O
W3C	O
candidate	O
recommendation	O
and	O
quickly	O
with	O
further	O
versions	O
(	O
Level	O
2	O
)	O
published	O
in	O
2014	O
.	O
draft	O
of	O
Level	O
3	O
is	O
being	O
developed	O
with	O
the	O
new	O
features	O
being	O
quickly	O
adopted	O
by	O
the	O
web	B-Application
browsers	I-Application
.	O
</s>
<s>
Google	B-Application
Chrome	I-Application
supports	O
this	O
as	O
of	O
version	O
25	O
.	O
</s>
<s>
Firefox	B-Application
supports	O
this	O
as	O
of	O
version	O
23	O
,	O
released	O
on	O
6	O
August	O
2013	O
.	O
</s>
<s>
WebKit	B-Language
supports	O
this	O
as	O
of	O
version	O
528	O
(	O
nightly	O
build	O
)	O
.	O
</s>
<s>
Chromium-based	O
Microsoft	B-Application
Edge	I-Application
support	O
is	O
similar	O
to	O
Chrome	B-Application
's	O
.	O
</s>
<s>
X-WebKit-CSP	O
–	O
deprecated	O
,	O
experimental	O
header	O
introduced	O
into	O
Google	B-Application
Chrome	I-Application
,	O
Safari	B-Application
and	O
other	O
WebKit-based	O
web	B-Application
browsers	I-Application
in	O
2011	O
.	O
</s>
<s>
X-Content-Security-Policy	O
–	O
deprecated	O
,	O
experimental	O
header	O
introduced	O
in	O
Gecko	B-Language
2	I-Language
based	O
browsers	B-Application
(	O
Firefox	B-Application
4	I-Application
to	O
Firefox	B-Application
22	O
,	O
Thunderbird	O
3.3	O
,	O
SeaMonkey	O
2.1	O
)	O
.	O
</s>
<s>
Each	O
header	O
will	O
be	O
processed	O
separately	O
by	O
the	O
browser	B-Application
.	O
</s>
<s>
Internet	B-Application
Explorer	I-Application
10	I-Application
and	O
Internet	B-Application
Explorer	I-Application
11	I-Application
also	O
support	O
CSP	O
,	O
but	O
only	O
sandbox	O
directive	O
,	O
using	O
the	O
experimental	O
X-Content-Security-Policy	O
header	O
.	O
</s>
<s>
A	O
number	O
of	O
web	O
application	O
frameworks	O
support	O
CSP	O
,	O
for	O
example	O
AngularJS	B-Application
(	O
natively	O
)	O
and	O
Django	B-Language
(	O
middleware	O
)	O
.	O
</s>
<s>
Instructions	O
for	O
Ruby	B-Application
on	I-Application
Rails	I-Application
have	O
been	O
posted	O
by	O
GitHub	B-Application
.	O
</s>
<s>
Otherwise	O
,	O
the	O
CSP	O
is	O
rather	O
static	O
and	O
can	O
be	O
delivered	O
from	O
web	B-Operating_System
application	I-Operating_System
tiers	I-Operating_System
above	O
the	O
application	O
,	O
for	O
example	O
on	O
load	B-Application
balancer	I-Application
or	O
web	B-Application
server	I-Application
.	O
</s>
<s>
In	O
January	O
2016	O
,	O
another	O
method	O
was	O
published	O
,	O
which	O
leverages	O
server-wide	O
CSP	O
allowlisting	O
to	O
exploit	O
old	O
and	O
vulnerable	O
versions	O
of	O
JavaScript	B-Language
libraries	O
hosted	O
at	O
the	O
same	O
server	O
(	O
frequent	O
case	O
with	O
CDN	B-Operating_System
servers	O
)	O
.	O
</s>
<s>
One	O
example	O
goal	O
of	O
a	O
policy	O
is	O
a	O
stricter	O
execution	O
mode	O
for	O
JavaScript	B-Language
in	O
order	O
to	O
prevent	O
certain	O
cross-site	O
scripting	O
attacks	O
.	O
</s>
<s>
DOM	B-General_Concept
event	O
handlers	O
as	O
HTML	O
attributes	O
(	O
e.g.	O
</s>
<s>
While	O
using	O
CSP	O
in	O
a	O
new	O
application	O
may	O
be	O
quite	O
straightforward	O
,	O
especially	O
with	O
CSP-compatible	O
JavaScript	B-Language
framework	O
,	O
existing	O
applications	O
may	O
require	O
some	O
refactoring	O
—	O
or	O
relaxing	O
the	O
policy	O
.	O
</s>
<s>
Recommended	O
coding	O
practice	O
for	O
CSP-compatible	O
web	O
applications	O
is	O
to	O
load	O
code	O
from	O
external	O
source	O
files	O
(	O
<script src>	O
)	O
,	O
parse	O
JSON	B-General_Concept
instead	O
of	O
evaluating	O
it	O
and	O
use	O
EventTarget.addEventListener( )	O
to	O
set	O
event	O
handlers	O
.	O
</s>
