Class: AntiVirus

$.security. AntiVirus

Class for checking data with external Anti-Virus (AV) engines. The scan needs a Virus Scan Adapter (VSA) to be installed on the host. The setup and configuration is available with SAP note 2081108. This class uses the SAP certified interface NW-VSI 2.00 (see SAP note 1883424). For a list of the AV products supported, see SAP note 1494278.

new AntiVirus(Profile)

Parameters:
Name Type Argument Description
Profile String <optional>
The profile name for the scan instance. If no profile is specified, the default profile is used.
Throws:
Throws an error if the profile is invalid
Examples
//create a new $.security.AntiVirus object using the default profile
var av = new $.security.AntiVirus();
//scan a buffer with own "upload" profile
var av = new $.security.AntiVirus("upload");
av.scan(buffer);

Methods

isAvailable()

Check the AV engine and return true if this is ready to scan. Return false if the engine is not loaded, the profile is not active or contains configuration errors and so on.

scan(data, objectName)

This method performs an AV check with VSI, using one of the external AV engines listed in SAP note 1494278. The optional objectName parameter should be passed to the function whenever available, for example, in a file upload; the result of the AV scan depends on the file type (MIME type).
Parameters:
Name Type Argument Description
data String | ArrayBuffer | $.db.ResultSet Data to be scanned
objectName String <optional>
Name of the object
Throws:
Throws an error if an infection was found or a problem occurred during the AV scan
Examples
var data = //Some data to be checked
var av = new $.security.AntiVirus();

//... peform AV check
av.scan(data);
var data = //Some data to be checked
var av = new $.security.AntiVirus();

//... check data as Word document
av.scan(data, "myDocument.docx");