Last updated: Nov-14-2022
Cloudinary is a cloud-based service that provides an end-to-end image and video management solution including uploads, storage, transformations, optimizations and delivery.
Cloudinary offers a very rich set of asset uploading, transformation and digital asset management capabilities. Cloudinary allows you to upload media files to the cloud, transform them on the fly and deliver them to your users optimized and cached via a fast CDN.
Perception Point's Malware Detection add-on provides the fastest and most accurate next-generation detection and response to any content-borne attack that can infiltrate your website. The Perception Point add-on scans any user generated content uploaded, such as documents, images, videos and other files, well before they reach end users. Seven layers of static and dynamic engines perform deep scanning of every piece of content, uncovering any concealed attack or evasion technique. The patented, cloud-native add-on is easily deployed, is easy to use, has virtually zero scanning delay and limitless scale, and does not tamper or change the scanned content.
With Perception Point's add-on, you can extend Cloudinary's powerful cloud-based media library and delivery capabilities by automatically scanning both your own assets and those uploaded by your users, making sure that no virus or malicious code is delivered to your web and mobile viewers.
Before you can use the Perception Point's Malware Detection add-on:
You must have a Cloudinary account. If you don't already have one, you can sign up for a free account.
Register for the add-on: make sure you're logged in to your account and then go to the Add-ons page. For more information about add-on registrations, see Registering for add-ons.
Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant SDK guide.
If you are new to Cloudinary, you may want to take a look at How to integrate Cloudinary in your app for a walk through on the basics of creating and setting up your account, working with SDKs, and then uploading, transforming and delivering assets.
Automatic file scanning flow
The following describes the basic flow of uploading and displaying moderated assets using Cloudinary and the Perception Point add-on:
- The asset is uploaded to Cloudinary.
- The uploaded assets are set to a 'pending' status, with short-term CDN caching.
- The uploaded asset is sent to Perception Point for asynchronous moderation in the background.
- The asset is either approved or rejected by Perception Point's anti-malware add-on.
- An optional notification callback is sent to your application with the virus scanning results.
- If the asset is approved, its cache settings are modified to be long-term.
- A rejected asset does not appear in your media library, but is backed up, consuming storage, so that it can be restored if necessary.
- Pending, approved and rejected assets can be listed programmatically using Cloudinary's API or interactively using the Media Library in your Cloudinary Console.
- You can manually override the automatic moderation using the API or Media Library.
Request file scanning
To request moderation of uploaded assets, set the
moderation upload parameter to
The same goes for videos or raw files. Just make sure to set the
resource_type parameter to
raw when calling the upload method. For example:
Learn more: Upload presets
The Perception Point add-on performs the asset moderation asynchronously and should be completed within a few seconds or minutes, depending on file size.
The following snippet shows a sample response of an upload API call that indicates that the Perception Point moderation is in the
Due to the fact that the Perception Point add-on moderates media assets asynchronously, you may want to request a notification when the scanning process is completed.
When calling the upload API with the
perception_point parameter, you can request a notification by adding the
notification_url parameter to a public HTTP or HTTPS notification URL. Cloudinary sends a POST request to the specified endpoint when that Perception Point scanning finishes.
The following JSON snippets are examples of POST requests sent to the notification URL when moderation is completed. The
moderation_status value can be either
As an alternative to receiving a webhook when the moderation check finishes, you can poll Cloudinary's Admin API to check the moderation status of a previously uploaded asset:
The following JSON snippet is the response of the Admin API resource details of a moderated image. As you can see, the moderation status is set to
The example below queries the Perception Point moderation status of an uploaded raw text file:
This file contains a virus signature and therefore it is rejected. The JSON response includes details regarding the detected virus by the Perception Point add-on.
Anti-malware moderation list
Cloudinary's Admin API can be used to list all moderated assets of a specific type - image (default), video, or raw. You can list assets with a particular status, including pending, approved and rejected, by specifying the second parameter of the
resources_by_moderation API method.
While the automatic virus scanning of the Perception Point add-on is very accurate, in some cases you may want to manually override the moderation decision. You can either approve a previously rejected asset or reject an approved one.
One way to manually override the moderation result is using Cloudinary's Media Library Web interface. From the left navigation menu, select Moderation. Then, from the moderation tools list in the top menu, select Perception Point and then select the status (Pending, Rejected, or Approved) of the assets you want to display.
- When listing the assets rejected by Perception Point, you can click on the green Approve button to revert the decision and recover the original rejected asset.
- When listing the assets approved by Perception Point, you can click on the red Reject button to revert the decision and prevent a certain asset from being publicly available to your users.
You can alternatively use Cloudinary's Admin API to programmatically override a specific moderation result. The following sample code uses the
update API method while specifying a public ID of a moderated image (default resource type) and setting the
moderation_status parameter to either the
approved or the