SanitizeHTML
Sanitizes unsafe HTML to protect against XSS attacks using the OWASP Java HTML Sanitizer.
The policy can be one of the following:
blocks
formatting
images
links
styles
tables
If no policy is provided, all policies are used.
You can also provide a OWASP {@link PolicyFactory} object to use a custom policy.
Method Signature
SanitizeHTML(string=[string], policy=[any])
Arguments
Argument
Type
Required
Description
Default
string
string
true
The string to sanitize.
policy
any
false
The policy to use for sanitization. If not provided, all policies are used. This can also be a ${link PolicyFactory} object.
Examples
Related
Last updated
Was this helpful?