File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/Http/Http.Features/src Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,16 @@ public interface IFormFile
3636 /// <summary>
3737 /// Gets the file name from the Content-Disposition header.
3838 /// </summary>
39+ /// <remarks>
40+ /// Do not use the <see cref="FileName"/> property of <see cref="IFormFile"/> other than for display and logging.
41+ /// When displaying or logging, HTML encode the file name. A cyberattacker can provide a malicious filename, including full paths or relative paths.
42+ /// <para>
43+ /// You can use the following code to remove the path from the file name:
44+ /// </para>
45+ /// <code>
46+ /// string untrustedFileName = Path.GetFileName(formFile.FileName);
47+ /// </code>
48+ /// </remarks>
3949 string FileName { get ; }
4050
4151 /// <summary>
You can’t perform that action at this time.
0 commit comments