<s>
In	O
data	O
sanitization	O
,	O
HTML	B-General_Concept
sanitization	I-General_Concept
is	O
the	O
process	O
of	O
examining	O
an	O
HTML	B-Language
document	O
and	O
producing	O
a	O
new	O
HTML	B-Language
document	O
that	O
preserves	O
only	O
whatever	O
tags	O
are	O
designated	O
"	O
safe	O
"	O
and	O
desired	O
.	O
</s>
<s>
HTML	B-General_Concept
sanitization	I-General_Concept
can	O
be	O
used	O
to	O
protect	O
against	O
attacks	O
such	O
as	O
cross-site	O
scripting	O
(	O
XSS	O
)	O
by	O
sanitizing	O
any	O
HTML	B-Language
code	I-Language
submitted	O
by	O
a	O
user	O
.	O
</s>
<s>
Also	O
potentially	O
dangerous	O
attributes	B-General_Concept
such	O
as	O
the	O
onclick	O
attribute	O
are	O
removed	O
in	O
order	O
to	O
prevent	O
malicious	O
code	O
from	O
being	O
injected	O
.	O
</s>
<s>
Leaving	O
a	O
safe	O
HTML	B-Language
element	O
off	O
a	O
whitelist	O
is	O
not	O
so	O
serious	O
;	O
it	O
simply	O
means	O
that	O
that	O
feature	O
will	O
not	O
be	O
included	O
post-sanitation	O
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
if	O
an	O
unsafe	O
element	O
is	O
left	O
off	O
a	O
blacklist	O
,	O
then	O
the	O
vulnerability	O
will	O
not	O
be	O
sanitized	O
out	O
of	O
the	O
HTML	B-Language
output	O
.	O
</s>
<s>
An	O
out-of-date	O
blacklist	O
can	O
therefore	O
be	O
dangerous	O
if	O
new	O
,	O
unsafe	O
features	O
have	O
been	O
introduced	O
to	O
the	O
HTML	B-Language
Standard	O
.	O
</s>
<s>
Typical	O
operations	O
include	O
removal	O
of	O
the	O
tag	O
itself	O
while	O
preserving	O
the	O
content	O
,	O
preserving	O
only	O
the	O
textual	O
content	O
of	O
a	O
tag	O
or	O
forcing	O
certain	O
values	O
on	O
attributes	B-General_Concept
.	O
</s>
<s>
In	O
PHP	B-Application
,	O
HTML	B-General_Concept
sanitization	I-General_Concept
can	O
be	O
performed	O
using	O
the	O
strip_tags( )	O
function	O
at	O
the	O
risk	O
of	O
removing	O
all	O
textual	O
content	O
following	O
an	O
unclosed	O
less-than	O
symbol	O
or	O
angle	O
bracket	O
.	O
</s>
<s>
The	O
HTML	B-Language
Purifier	O
library	O
is	O
another	O
popular	O
option	O
for	O
PHP	B-Application
applications	O
.	O
</s>
<s>
In	O
Java	B-Language
(	O
and	O
.NET	B-Application
)	O
,	O
sanitization	O
can	O
be	O
achieved	O
by	O
using	O
the	O
OWASP	O
Java	B-Language
HTML	B-Language
Sanitizer	O
Project	O
.	O
</s>
<s>
In	O
.NET	B-Application
,	O
a	O
number	O
of	O
sanitizers	O
use	O
the	O
Html	B-Language
Agility	O
Pack	O
,	O
an	O
HTML	B-Language
parser	O
.	O
</s>
<s>
In	O
JavaScript	B-Language
there	O
are	O
"	O
JS-only	O
"	O
sanitizers	O
for	O
the	O
back	B-Architecture
end	I-Architecture
,	O
and	O
browser-based	O
implementations	O
that	O
use	O
browser	O
's	O
own	O
Document	B-General_Concept
Object	I-General_Concept
Model	I-General_Concept
(	O
DOM	B-General_Concept
)	O
parser	O
to	O
parse	O
the	O
HTML	B-Language
(	O
for	O
better	O
performance	O
)	O
.	O
</s>
