Issue Details (XML | Word | Printable)

Key: SEC-966
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Luke Taylor
Reporter: Willie Wheeler
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Security

Consider adding escapeXml attribute to security:authentication

Created: 25/Aug/08 11:37 PM   Updated: 28/Aug/08 06:21 AM
Component/s: Taglibs
Affects Version/s: 2.0.3
Fix Version/s: 2.0.4

Time Tracking:
Not Specified


 Description  « Hide
The security:authentication tag does not escape HTML/XML entities, but it would be nice if the option were available, as it is with the JSTL c:out tag. I would even suggest that escaping XML entities should be the default behavior (again, as it is with c:out) because this helps to protect against script injections. Currently somebody could make their username something like <script ...> and if you render it using security:authentication then the browser would run the script.

I don't think it's reasonable to assume that people will disallow '<' and '>' characters in their user fields, partly because many people won't know there's an issue, and partly because in some contexts you want to allow such characters. (For example, gamers like usernames with all kinds of funky characters in them.)

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Willie Wheeler added a comment - 25/Aug/08 11:47 PM
I categorized this as a minor issue but I would actually change that to a major issue since if you use security:authentication, the app is more likely than not to have a script injection vulnerability. The developer would have to take special steps to avoid it. It should require special steps to create the vulnerability.

Luke Taylor added a comment - 26/Aug/08 11:09 AM
I think we can probably add XML escaping to the output by default and this is probably a good idea. I'd disagree that using the tag makes apps "more likely than not" to have an injection vulnerability though. Many applications use pre-configured user data and any application which allow users to choose a login name without applying basic validation for XSS issues is really asking for trouble.

Luke Taylor added a comment - 26/Aug/08 11:25 AM
I've added escaping of the rendered value. This obviously doesn't affect use of the 'var' attribute.

Willie Wheeler added a comment - 27/Aug/08 02:28 AM
Nice. Thanks Luke!