Avoid direct access to source code of JSF page

前端 未结 1 1593
暖寄归人
暖寄归人 2021-01-24 04:19

When I request /personal/faces/public/login.xhtml, then it works fine, but when I request /personal/public/login.xhtml without /faces I ob

相关标签:
1条回答
  • 2021-01-24 04:30

    This is happening because you've specified /faces/* in your FacesServlet configuration in the web.xml. As a result, any file requested that does not match the specified url pattern will be served as a regular file with a GET request Change that config to the following to ensure all JSF related requests go through the FacesServlet:

       <servlet-mapping>
           <servlet-name>Faces Servlet</servlet-name>
           <url-pattern>*.xhtml</url-pattern>
        </servlet-mapping>
    

    This ensures all files with .xhtml extension will be processed before returning to the client.

    While the above solution may solve the immediate problem, what you're experiencing points to a deeper security issue. It indicates that anyone with a browser can request and download artifacts from your web application deployment and possibly other parts of your filesystem. This is a security hole you will need to look into. The options vary depending on your App server

    0 讨论(0)
提交回复
热议问题