Spec-Zone.ru › ColdFusion

isSafeHTML

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

  • CF11+
  • BL 1.0.0+
  • See Also: getSafeHTML

    Argument Reference

    inputString string
    Required

    String to be validated

    PolicyFile string

    File path for custom AntiSamy policy file. Can be defined in the application scope or if not defined will use ColdFusion server default

    Compatibility

    BoxLang:

    Version 1.0.0+ Requires the bx-esapi module.

    Links more information about isSafeHTML

    • AntiSamy OWASP

    Examples
    Sample code invoking the isSafeHTML function

    Unsafe HTML Example

    Example with HTML that causes isSafeHTML to return false.

    <cfsavecontent variable="html">
        <div onmouseover=alert(1)>
    </cfsavecontent>
    <cfoutput>#isSafeHTML(html)#</cfoutput>

    Expected Result: no

    Safe HTML Example

    Example with HTML that is safe on the default policy.

    <cfsavecontent variable="html">
        <a href="https://foundeo.com/" title="ColdFusion Consulting &amp; Security">Foundeo Inc.</a>
    </cfsavecontent>
    <cfoutput>#isSafeHTML(html)#</cfoutput>

    Expected Result: yes

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/issafehtml

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API