Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inform about exposed view source when using prefix mapping #1015

Closed
eclipse-faces-bot opened this issue Jun 14, 2011 · 15 comments
Closed

Inform about exposed view source when using prefix mapping #1015

eclipse-faces-bot opened this issue Jun 14, 2011 · 15 comments

Comments

@eclipse-faces-bot
Copy link

Trigger: http://stackoverflow.com/questions/6341361/jsf-url-mapping-security-risk

Summary: When prefix mapping is used, the view source is publicity avaliable to enduser by just removing the prefix mapping pattern from the request URL. This can cause privacy issues and in opinion of some even a security issue. This should more clearly be adressed in the specification.

Affected Versions

[2.1]

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Reported by @BalusC

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Issue-Links:
is related to
JAVASERVERFACES_SPEC_PUBLIC-915

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
jakobkorherr said:
Possible workaround: use a filter that prohibits access to everything not containing the prefix mapping of the FacesServlet!

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@BalusC said:
@jakob: this is pretty poor. How about static resources like JS/CSS/images and plain HTML files?

The common approach to prevent direct access to source files when prefix mapping is used is to put a security constraint on the JSF default view extension:

    Restrict direct access to XHTML files             XHTML files         *.xhtml        

An alternative approach is to use extension mapping of *.xhtml instead. The only disadvantage is that you cannot serve "plain" XHTML files anymore without invoking the FacesServlet. But IMO this is not a disadvantage as those kind of files should have the *.html extension.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
jakobkorherr said:
hehe - yep, I know it's pretty poor, but it was the first thing that popped into my mind!

How about static resources like JS/CSS/images and plain HTML files?

Well, since JSF 2 you should serve these with the JSF resource handler anyway!

However, using a security contraint is better, and of course, using *.xhtml is the best!

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
File: FacesServlet.html
Attached By: @edburns

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Generated documentation. Will be color coded.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Sending jsf-api/src/main/java/javax/faces/webapp/FacesServlet.java
Sending jsf-api/src/main/java/javax/faces/webapp/package.html
Transmitting file data ..
Committed revision 9164.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Marked as fixed on Tuesday, June 14th 2011, 4:33:01 am

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@BalusC said:
Great! By the way, I start to realize that the issue is not related to prefix patterns per se. The same issue would expose when you're using a suffix pattern such as *.faces and replace the extension in request URL by *.xhtml.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
jakobkorherr said:
hehehe. you're right. did not think of that!

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:

The only disadvantage is that you cannot serve "plain" XHTML files anymore without invoking the FacesServlet. But IMO this is not a disadvantage as those kind of files should have the *.html extension.

Following that logic, I wonder what the opinions are on adding *.xhtml to the default servlet mapping? This will instantly solve the problem with exposing the source code and as an extra benefit I think *.xhtml to *.xhtml will be easier to understand for those new to JSF.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@manfredriem said:
Closing resolved issue out

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1015

@eclipse-faces-bot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant