Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In every Web Application, data consists of various layers like the View Layer, Model Layer, Database Layer, etc. Each layer is "supposed" to be developed independently to satisfy various scalability and maintainability requirements. </p> <p>Now, basically, every layer needs to "talk" to every other, and they have to decide upon a language through which they can talk. This is called encoding. Various types of encodings exists like ASCII, UTF-8, UTF-16, etc. Now if the user is Chinese or Japanese, for instance, then for him ASCII wouldn't work, hence he would go ahead with UTF-16 or any other encoding technique which would guarantee communication in Chinese. So from the web layer, Chinese characters would pass through the business layer, and then to the data layer, and everywhere, the same "encoding" scheme is to be used.</p> <p>Why ? </p> <p>Now suppose , your Web Layer , sends data in UTF-16 , supporting chinese language , but the database layer accepts , only ASCII , then the database layer would get confused as to what are you talking ! it understands only English characters , it won't understanding the rest. This was about Encoding.</p> <p>Escaping : </p> <p>There is a certain set of data called "metadata" which have a special meaning from the browsers perspective. For example , <code>&lt;&gt;</code> are metadata from the browsers perspective. The browsers parser knows that all the data contained inside these <code>&lt;&gt;</code> are to be interpreted. Now the attackers use this technique to confuse the browsers. For Example :</p> <pre><code>&lt;input type="text" value="${name} /&gt; </code></pre> <p>if i replace the name with </p> <pre><code>name="/&gt;&lt;script&gt;alert(document.cookie)&lt;/script&gt; </code></pre> <p>Then the resultant code as the browser sees it will be </p> <pre><code>&lt;input type="text" value=""/&gt;&lt;script&gt;alert(document.cookie)&lt;/script&gt; /&gt; </code></pre> <p>Means, now you need to instruct the browser that whatever I put in the <code>name=""</code> should be "escaped" , or should be considered as data only. So there are various functions which either encode/escape <code>&lt;&gt;</code> as their html equivalent <code>%3C%3E</code>, so now the browser knows that this needs to be treated differently. Basically escaping means to escape their actual meaning (roughly speaking).</p> <pre><code> &lt;input type="text" value="${fn:escapeXML(name)} /&gt; </code></pre> <p>using JSTL.</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. 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.
    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