Add Antivirus Scanner#19329
Conversation
…S/OrchardCore into ma/upload-file-scanner
|
|
||
| try | ||
| { | ||
| using var client = new TcpClient(); |
There was a problem hiding this comment.
I its lifetime working the same way as httpclient?
|
|
||
| public interface IAntivirusScanner | ||
| { | ||
| Task<AntivirusResult> ScanAsync(AntivirusScanContext context, Stream stream); |
There was a problem hiding this comment.
FileCreatingResult FileCreatingAsync(FileCreatingContext context, Stream stream, CancellationToken ct)
For file system and also blob storage (any file). Use anywhere we upload/get files, not just Media.
FileCreatedAsync (IFileInfo) (whatever is used in orchard to get a stream from a file)
// If we were able to create a file (FileCreating) then we have to be able to get a file info
IFileEventHandler
We return a Stream as we need to read it, even if we don't want to replace/change the content.
FileCreatingResult: Result
- Stream { get; }
| } | ||
| } | ||
|
|
||
| private async Task<Stream> ScanAsync(string path, Stream stream) |
There was a problem hiding this comment.
should be in the implementation (I might be wrong)
| } | ||
| } | ||
|
|
||
| private static async Task<Stream> CreateTemporarySeekableStreamAsync(Stream stream) |
There was a problem hiding this comment.
should be in the implementation. The implemetnation decides if the stream needs to be opened (caching for isntnce/)
This pull request introduces a new ClamAV-backed antivirus scanning module for Orchard Core, along with Aspire host integration for easier development and deployment. The changes include a new
OrchardCore.Antivirus.ClamAVmodule, Aspire host project setup, and integration of the antivirus scanner into the remote deployment import workflow. This enhances security by ensuring uploaded files are scanned for viruses and streamlines local development with Aspire.New ClamAV Antivirus Module:
OrchardCore.Antivirus.ClamAVmodule, including implementation ofClamAVAntivirusScanner, configuration options (ClamAvOptions), and module manifest. This module scans files with ClamAV before they are stored or imported. [1] [2] [3] [4] [5]Aspire Host Integration:
OrchardCore.AspireHostproject with configuration for Aspire hosting, including aClamAVResourcefor running ClamAV in a container, and project setup files (Program.cs,appsettings.json,launchSettings.json, etc.). This enables easy local orchestration of Orchard Core and ClamAV. [1] [2] [3] [4] [5] [6] [7] [8]Solution and Documentation Updates:
OrchardCore.slnx) to include the new Aspire host and ClamAV module projects. [1] [2]mkdocs.yml.Remote Deployment Security Enhancement:
These changes collectively improve Orchard Core's security posture and developer experience by providing an out-of-the-box, containerized antivirus solution and integrating it into critical file handling workflows.