File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1212 */
1313package com .amazonaws .serverless .proxy .internal ;
1414
15+ import com .amazonaws .serverless .proxy .model .ContainerConfig ;
1516import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
1617import org .slf4j .Logger ;
1718import org .slf4j .LoggerFactory ;
@@ -174,6 +175,14 @@ public static String getValidFilePath(String inputPath) {
174175 /**
175176 * Returns an absolute file path given an input path and validates that it is not trying
176177 * to write/read from a directory other than /tmp.
178+ *
179+ * We suppress the path traversal warnings because this method is used to validate paths passed
180+ * to the servlet implementation methods such as {@link com.amazonaws.serverless.proxy.internal.servlet.AwsProxyRequestPart#write(String)}.
181+ * Using relative paths is a valid use-case for developers implementing a servlet-based API. We
182+ * mitigate the potential partial path traversal by checking the resulting absolute path against
183+ * the list of allowed paths specified in {@link ContainerConfig#getValidFilePaths()}. We also
184+ * block the /var/task directory regardless.
185+ *
177186 * @param inputPath The input path
178187 * @return The absolute path to the file
179188 * @throws IllegalArgumentException If the given path is not valid or outside of /tmp
You can’t perform that action at this time.
0 commit comments