aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in EL part of JSP 2.0 specification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in EL part of JSP 2.0 specification" Watch "Doubt in EL part of JSP 2.0 specification" New topic
Author

Doubt in EL part of JSP 2.0 specification

vijayakumar vivekanandan
Greenhorn

Joined: Dec 08, 2004
Posts: 21
I was skimming thro the JSP 2.0 specification's EL part (page 1-65).
I cannot understand the "to help prevent cross-site scripting attacks" part of the following lines.


"The semantics of an EL expression are the same as with Java expressions: the
value is computed and inserted into the current output. In cases where escaping is
desired (for example, to help prevent cross-site scripting attacks), the JSTL core
tag <c ut> can be used.
"


How cross site scripting attacks occur if we use expressions and how it is prevented in EL?


Advanced thanks.


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br />You cannot solve a problem with the same level of understanding that created it. <br />@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Gabriel Forro
Ranch Hand

Joined: Apr 16, 2004
Posts: 59
Hello,

imagine You have a request attribute:


if You use:

, there will be a javascript block on the client side.

But if You use:


the text will be text and not javascript code. Thanks to the escaping.
So the answer is, that cross-site scripting attack is not prevented in EL. You can use the

tag to prevent it.

[ December 13, 2004: Message edited by: Gabriel Forro ]

[ December 13, 2004: Message edited by: Gabriel Forro ]
[ December 13, 2004: Message edited by: Gabriel Forro ]

Gabriel
vijayakumar vivekanandan
Greenhorn

Joined: Dec 08, 2004
Posts: 21
Thanks Gabry. That was a crystal clear illustration. Is there any material elaborating on such possible attacks. This will help me make my codes secure.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in EL part of JSP 2.0 specification