Inline File Validation
Inline File Validation is a feature that enables file content to be validated while the file is in transit as well as when the transfer is complete. Validation is performed by an external validation service and is triggered for downloads on the server side. The service may be implemented by writing a REST service that responds to a HTTP POST request that is issued by the ascp transfer binary for session and file events.
For detailed information about inline file validation, see the Aspera Enterprise Server Admin Guide (select your platform and transfer server version to access the document link).
The normal process for inline validation starts with the server sending a POST /validation/files (HTTP 1.1) for the file events. If the <validation_uri> attribute is configured then at least two /validation/files HTTP requests will be sent to the external REST validation service for every file. Essentially a transfer start and transfer stop event. If file validation fails, the entire transfer session will be terminated and the reason message will be funneled from the external validator. A typical payload from the Aspera Server to the external validator service is seen below in JSON format.
The payload could also include other parameters. Custom implementations will use different fields of the payload to validate the file depending on user needs, the full list of available options are seen below:
|Field||Description||Always in the JSON payload|
|startstop||The session status. Possible values: start, stop, running||yes|
|session_id||The session id||yes|
|xfer_id||The transfer id, used by some transfer clients (eg. Connect) to link different transfer sessions||no|
|host||The Aspera server address||yes|
|client_ip||The client address||yes|
|user||The transfer user name||yes|
|user_id||The transfer user id||no. Default "0"|
|direction||Upload or download transfer. Possible values: send, recv||yes|
|cookie||User defined cookie string. Used to monitor transfers||no|
|target_rate_kbps||The transfer target rate in Kbps||yes|
|min_rate_kbps||The transfer minimum rate in Kbps||yes|
|rate_policy||The transfer rate policy. Possible values: fixed, fair, high, low||yes|
|cipher||The transfer encryption algorithm. Possible values: none, aes-128||yes|
|manifest_file||The manifest file path||no|
|file||The path of the file in transfer||yes|
|size||The size of the file||yes|
|start_byte||The start transfer byte. This value can be higher than 0 for resumed transfers||yes|
|end_byte||The transfer end byte||yes|
|tags||A JSON format string used to pass proprietary or user-defined data||no|
|file_name_encoding||The file name encoding type. Possible values: utf8, utf16||yes|
|file_csum||If checksum computation is enabled, the value of the checksum||no|
|file_csum_type||The checksum computation algorithm. Possible values: none, md5, sha1||yes|
If the file is accepted the external validator should return a HTTP status code of 200. If 200 is returned no payload is needed. However, if the file is rejected the external validator should return a HTTP status code of 400 with a JSON payload containing an error code and a message. For example, an error payload could be:
Example to Request Validation
The example below shows how to configure the server to request validation for user testz. Essentially, the configuration file indicates that files for the user testz should be validated by a server located at http://10.41.42.14:9090/. A REST service should be running on the specified address and port that can handle HTTP POST /validation/files operations from the Aspera Server.
Example Validator Service
The Ruby example below shows a basic REST service which will validate all files ending with extension MOV and reject all other files. This validation only runs when the transfer starts.
File Validation requires ascp version 3.5 or higher and can have triggers defined by adding an external validation URL in the Aspera Server Configuration File (aspera.conf) by using the <validation_uri> tag which is in the <transfer> section; this setting can be declared globally or for a specific user. For example, the following would define the validation URL in the aspera.conf file, you can also add the optional <validation_threshold_kb> tag which only triggers validation once a file of the specified size is downloaded.