Results 1 to 4 of 4

Thread: Putting XSS Filter and CharacterEncodingFilter together

  1. #1
    Join Date
    Dec 2011
    Posts
    13

    Default Putting XSS Filter and CharacterEncodingFilter together

    Hi All,

    I had already written a XSS Filter to reject invalid input. But my application can still send invalid character/script to the browser. I want to prevent these in response object also. For that I think I can use CharacterEncodingFilter (correct me if I am wrong).

    My web.xml already have:
    Code:
    <!-- URLRewrite Filter -->
    	<filter-name>xssFilter</filter-name>
    		<filter-class>com.anjib.filter.XssFilter</filter-class>
    	</filter>
    	<filter-mapping>
    		<filter-name>xssFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    How can I give specify another filter with same url pattern without conflicting?

    Thanks

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    By simply adding it... You can have as many filters on the same pattern as you like...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Dec 2011
    Posts
    13

    Default

    Does CharacterEncodingFilter convert "<" to "&lt;". I am trying to put filter to do so for the response going from server to browser.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    No... It enforces/set a character encoding (the scheme) it doesn't convert characters...

    Also why are you building your own there are already security filters out there (like HDIV for instance) ... Which offer what you want.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

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