Skip to content

Commit fb04047

Browse files
committed
Update Javadoc of MultipartFile#getOriginalFilename
Closes gh-26299
1 parent d50375d commit fb04047

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-web/src/main/java/org/springframework/web/multipart/MultipartFile.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,10 +53,16 @@ public interface MultipartFile extends InputStreamSource {
5353
* Return the original filename in the client's filesystem.
5454
* <p>This may contain path information depending on the browser used,
5555
* but it typically will not with any other than Opera.
56+
* <p><strong>Note:</strong> Please keep in mind this filename is supplied
57+
* by the client and should not be used blindly. In addition to not using
58+
* the directory portion, the file name could also contain characters * such
59+
* as ".." and others that can be used maliciously.
5660
* @return the original filename, or the empty String if no file has been chosen
5761
* in the multipart form, or {@code null} if not defined or not available
5862
* @see org.apache.commons.fileupload.FileItem#getName()
5963
* @see org.springframework.web.multipart.commons.CommonsMultipartFile#setPreserveFilename
64+
* @see <a href="https://tools.ietf.org/html/rfc7578#section-4.2">RFC 7578, Section 3.4</a>
65+
* @see <a href="https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload">Unrestricted File Upload</a>
6066
*/
6167
@Nullable
6268
String getOriginalFilename();

0 commit comments

Comments
 (0)