Skip to content

Commit a5f5e0a

Browse files
authored
provide xml doc on IFormFile for more user attention (#64660)
1 parent 65916c5 commit a5f5e0a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Http/Http.Features/src/IFormFile.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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>

0 commit comments

Comments
 (0)