Add code infrastructure to validate file content (#14657)
* Implemented modular architecture for filestream security sanitization with an svg-html example * 31440: Refactoring, applied to more entry points and removed test analyzer * 31440 Added Unittests for FileStreamSecurityValidator * PR fixes and better unittest mock names --------- Co-authored-by: Sven Geusens <sge@umbraco.dk>
This commit is contained in:
20
src/Umbraco.Core/Security/IFileStreamSecurityAnalyzer.cs
Normal file
20
src/Umbraco.Core/Security/IFileStreamSecurityAnalyzer.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace Umbraco.Cms.Core.Security;
|
||||
|
||||
public interface IFileStreamSecurityAnalyzer
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the analyzer should process the file
|
||||
/// The implementation should be considerably faster than IsConsideredSafe
|
||||
/// </summary>
|
||||
/// <param name="fileStream"></param>
|
||||
/// <returns></returns>
|
||||
bool ShouldHandle(Stream fileStream);
|
||||
|
||||
/// <summary>
|
||||
/// Analyzes whether the file content is considered safe
|
||||
/// </summary>
|
||||
/// <param name="fileStream">Needs to be a Read/Write seekable stream</param>
|
||||
/// <returns>Whether the file is considered safe</returns>
|
||||
bool IsConsideredSafe(Stream fileStream);
|
||||
}
|
||||
Reference in New Issue
Block a user