Antivirus scan
An antivirus scan is a component of an antivirus package that scans files for viruses and other harmful items. Sitecore Content Hub has an antivirus scan functionality that triggers when users upload assets, either through the Creation component, or through an Excel import.
As a superuser, you can enable the antivirus scan in the settings. This document describes how to set it up.
Enable the antivirus scan
To enable the antivirus scan:
On the menu bar, click Manage .
On the Manage page, click Settings.
On the Settings page, search for Antivirus.
Search and select the AntivirusSetting.
On the AntivirusSetting, set the
antivirusEnabled
flag totrue
.Click Save.
Configure an antivirus task
Because the antivirus scan functionality makes a call to an external service API, it requires a RunExternalWebTask
processing task configured in the M.MediaMatrix for the related media flow.
Set up an external web task
On the menu bar, click Manage .
On the Manage page, click Settings.
On the Settings page, search for Media processing.
On the Media processing page, select Content and click Archives.
On the Archives flow details page, click and, in the right-hand pane, select Run external web task.
In the Parameters tab, in the Name field, enter Antivirus. You can leave the Content type field blank. In the Content disposition field, select Attachment. In the URL field, enter a URL that points to the external antivirus scan service of your choice.
In the Outputs tab, click Store output to enable outputs. In the Output type field, select Property. In the Property field, select Virusscan result.
Click Save task, then Save and Close.
Click Publish.
Configure the M.MediaMatrix.Content entity
Go to {host}/en-us/admin/entitymgmt/entities/{entity ID number}.
On the Media Matrix entities page, locate Content and click View detail next to it.
On the M.MediaMatrix.Content entity detail page, click and make sure the Text option is selected from the drop-down menu.
Search for the
Archives
node and make sure this JSON comes first undertasks
:"antivirus": { "type": "RunExternalWebTask", "do update": true, "input": "source", "output": "antivirus", "outputfileprovider": "local", "contentdisposition": "attachment", "url": "http://beeceptor.com/console/testsitecore-antivirus", "parameters": {}, "headers": {} }
Add an antivirus dependency in the
metadata
entry of theArchives
node as follows:"deps": [ "antivirus" ]
Store the scan output in the antivirus property of the file as follows:
"properties": { "VirusScanResult": "antivirus" }
Click Save.
Complete the antivirus scan
Create an asset either through the Creation component or through an Excel import. If the file is considered to have malicious content by the antivirus service you have used, on the file details page, you see the message: "This file has been flagged as malicious. Downloads are disabled." Also, if a file is flagged as malicious, the thumbnail and associated renditions are replaced by placeholders, and any options for downloading it are disabled.
Note
An external web task is a webhook that Content Hub uses in file processing to create custom renditions (pre-defined file conversions).
Can we improve this article ? Provide feedback