Results 1 to 3 of 3

Thread: Usernames conaining an email in failed login form are being escaped

  1. #1

    Exclamation Usernames conaining an email in failed login form are being escaped

    Upon switching to emails as usernames in login forms, in case of login failure I get the ${SPRING_SECURITY_LAST_USERNAME} email-username displayed with escape characters instead of the original @ . - etc'.. this is of course very user unfriendly.

    I am aware of the character escaping done on SPRING_SECURITY_LAST_USERNAME attribute value due to possible XSS attacks:
    https://jira.springsource.org/browse/SEC-1377
    https://jira.springsource.org/browse/SEC-812

    However this leaves me in kind of an odd position, where I have to choose between basic user friendliness and application security, while implementing a rather common feature which is email addresses as usernames.

    It's somewhat peculiar - XSS attacks are common to all web apps not just spring security. Is it actually possible that any web app that displays the attempted username-email is vulnerable to the that attack??

    I'll be happy to know if there a way to resolve this without compromising
    security.

    Yuval

  2. #2
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    How are you rendering the username that it displays as the escaped values? If If you are doing this in a web page you could render without re-escaping the value by doing something like this.

    Code:
    <c:out value="${SPRING_SECURITY_LAST_USERNAME}" 
         escapeXml="false">
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #3

    Default

    Thanks rwinch, it solved the problem perfectly!
    Yuval

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •