Checks a HTML string against antisamy policy file to determine if it may be vulnerable to XSS / Cross Site Scripting.
isSafeHTML(inputString [, PolicyFile])
→ returns boolean
Example with HTML that causes isSafeHTML to return false.
<cfsavecontent variable="html">
<div onmouseover=alert(1)>
</cfsavecontent>
<cfoutput>#isSafeHTML(html)#</cfoutput>
Expected Result: no
Example with HTML that is safe on the default policy.
<cfsavecontent variable="html">
<a href="https://foundeo.com/" title="ColdFusion Consulting & Security">Foundeo Inc.</a>
</cfsavecontent>
<cfoutput>#isSafeHTML(html)#</cfoutput>
Expected Result: yes
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.