Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've been looking into this so decided to write up my own answer based on what you already had, this <a href="https://www.owasp.org/index.php/Abridged_XSS_Prevention_Cheat_Sheet" rel="nofollow noreferrer">OWASP cheat sheet</a> and some experimentation of my own</p> <p><strong>HTML escaping:</strong></p> <ul> <li>${} or the escape() function</li> </ul> <p><strong>Attribute escaping: (common attributes)</strong> </p> <ul> <li>This is handled in play so long as you wrap your attributes in double quotes (") and use ${}. </li> <li>For complex attributes (href/src/etc.) see JavaScript below</li> <li>Example unsafe code <ul> <li><code>&lt;a id=${data.value} href="..."&gt;...&lt;/a&gt;</code></li> <li><code>&lt;a id='${data.value}' href="..."&gt;...&lt;/a&gt;</code></li> </ul></li> <li>This would break with this for data.value: <ul> <li><code>% href=javascript:alert('XSS')</code></li> <li><code>%' href=javascript:alert(window.location)</code></li> </ul></li> </ul> <p><strong>JavaScript escaping: (and complex attributes)</strong> </p> <ul> <li>Use escapeJavaScript(). <a href="http://www.playframework.org/documentation/1.2/javaextensions" rel="nofollow noreferrer">http://www.playframework.org/documentation/1.2/javaextensions</a></li> <li>Example unsafe code <ul> <li><code>&lt;a onmouseover="x='${data.value}'; ..." href="..."&gt;...&lt;/a&gt;</code></li> </ul></li> <li>This would break with this for data.value: <ul> <li><code>'; javascript:alert(window.location);//</code></li> </ul></li> </ul> <p><strong>CSS escaping:</strong></p> <ul> <li>Not sure as I've no need for this. <ul> <li>I'd imagine you'd need to create your own somehow. Hopefully there is something out there to manipulate the strings for you.</li> </ul></li> </ul> <p><strong>URL escaping:</strong> </p> <ul> <li>use urlEncode(). <a href="http://www.playframework.org/documentation/1.2/javaextensions" rel="nofollow noreferrer">http://www.playframework.org/documentation/1.2/javaextensions</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload