Skip to content

Commit

Permalink
Add canonicalization clarification to methods that accept paths
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Dec 2, 2022
1 parent 4896661 commit b054725
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions api/src/main/java/jakarta/servlet/ServletContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ public interface ServletContext {
* application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized user
* provided data) and when using the result not to create a security vulnerability in the application.
*
* <p>
* The provided {@code path} parameter is canonicalized as per section 3.5.2 of the specification before being used to
* match resources.
*
* @param path the partial path used to match the resources, which must start with a <tt>/</tt>
* @return a Set containing the directory listing, or null if there are no resources in the web application whose path
* begins with the supplied path.
Expand Down Expand Up @@ -257,6 +261,10 @@ public interface ServletContext {
* application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized user
* provided data) and when using the result not to create a security vulnerability in the application.
*
* <p>
* The provided {@code path} parameter is canonicalized as per section 3.5.2 of the specification before being used to
* match a resource.
*
* @param path a <code>String</code> specifying the path to the resource
*
* @return the resource located at the named path, or <code>null</code> if there is no resource at that path
Expand Down Expand Up @@ -291,6 +299,10 @@ public interface ServletContext {
* application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized user
* provided data) and when using the result not to create a security vulnerability in the application.
*
* <p>
* The provided {@code path} parameter is canonicalized as per section 3.5.2 of the specification before being used to
* match a resource.
*
* @param path a <code>String</code> specifying the path to the resource
*
* @return the <code>InputStream</code> returned to the servlet, or <code>null</code> if no resource exists at the
Expand All @@ -317,6 +329,10 @@ public interface ServletContext {
* application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized user
* provided data) and when using the result not to create a security vulnerability in the application.
*
* <p>
* The provided {@code path} parameter is canonicalized as per section 3.5.2 of the specification before being used to
* match a resource.
*
* @param path a <code>String</code> specifying the pathname to the resource
*
* @return a <code>RequestDispatcher</code> object that acts as a wrapper for the resource at the specified path, or
Expand Down Expand Up @@ -400,6 +416,10 @@ public interface ServletContext {
* application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized user
* provided data) and when using the result not to create a security vulnerability in the application.
*
* <p>
* The provided {@code path} parameter is canonicalized as per section 3.5.2 of the specification before being
* translated to a real path.
*
* @param path the <i>virtual</i> path to be translated to a <i>real</i> path
*
* @return the <i>real</i> path, or <tt>null</tt> if the translation cannot be performed
Expand Down
4 changes: 2 additions & 2 deletions spec/src/main/asciidoc/servlet-spec-body.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8570,8 +8570,8 @@ headers with the same name are present in the `HttpServletRequest`. The expected
behaviour is aligned with `getHeader()`.

link:https://github.com/eclipse-ee4j/servlet-api/issues/453[Issue 453]::
Add a security warning to all `ServletContext` methods that accept a path
parameter.
Add a security warning and a clarification of canonicalization requirements to
all `ServletContext` methods that accept a path parameter.

link:https://github.com/eclipse-ee4j/servlet-api/issues/463[Issue 463]::
Clarify Javadoc for `MultipartConfigElement` and `MultipartConfig` that sizes
Expand Down

0 comments on commit b054725

Please sign in to comment.