Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In order to prevent Application from XSS attacks I usually use following rules:</p> <ol> <li><p>Determine the level of security for your application. <br> There are several tools that can protect your application as for me better security is provided by <a href="https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet" rel="noreferrer">OWASP</a> tools: <a href="http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/java/org/owasp/esapi/codecs/CSSCodec.java" rel="noreferrer">ESAPI</a> or <a href="https://www.owasp.org/index.php/Category%3aOWASP_AntiSamy_Project_.NET" rel="noreferrer">AntySami</a>. <br> Note:Using Sanitization does not guarantee filtering of all malicious code, so tools can be more or less secure.</p></li> <li><p>Understand whether you need to perform sanitization on client, server or both sides. In most cases it's enough to do this on server side.</p></li> <li><p>Understand whether you need to preserve html tags (and what tags you need to preserve) or not. As it was stated previously not allowing html tags is more secure solution.</p></li> </ol> <p>Based on this you can find a proper decision.<br> 1. Personally for server code sanitization I used <a href="http://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer" rel="noreferrer">jSoup</a>. As for me it's pretty good tool to do this.<br> Usually In order to check input vulnerability I am using following vector:</p> <pre><code>';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--&gt;&lt;/SCRIPT&gt;"&gt;'&gt;&lt;SCRIPT&gt;alert(String.fromCharCode(88,83,83))&lt;/SCRIPT&gt; </code></pre> <ol> <li>In case you need prevent XSS on client side you can use following tools: <br> a) <a href="https://code.google.com/p/google-caja/wiki/JsHtmlSanitizer" rel="noreferrer">JSSANItazer</a> seems a bit outdated <br> b) <a href="https://github.com/linkedin/dustjs/wiki/Dust-Tutorial" rel="noreferrer">Dust</a> - maintained by twitter; <br></li> </ol> <p>These tools easily can allow you to sanitize your input and mainly is answer for your question. </p> <p>Server side tools mentioned above.</p> <p>Regarding 3rd point. In case you don't need to handle html tags you can easily use ESAPI on server side and <a href="https://www.owasp.org/index.php/ESAPI_JavaScript_Readme" rel="noreferrer">ESAPI4JS</a> on client side. As I understand it doesn't work for you.</p> <p>When I read your task I understood that you are storing email message therefore In your case it's required to sanitize input on server side (using one of tools) and it's as per you to add it or not on client side. You need only decide whether add another sanitization on UI side or render your "preview page" on server.</p>
    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