Integration with clamav antivirus relies on an external clamd service. When a file is uploaded hasura-storage will create the file metadata first and then check if the file is clean with clamd via its TCP socket. If the file is clean the rest of the process will continue as usual. If a virus is found details about the virus will be added to the virus table and the rest of the process will be aborted.

sequence

To enable the antivirus you need to follow the next steps:

  1. Deploy using Nhost Run a dedicated instance of clamd with this one-click install link.
  2. Select the project: select project
  3. Click on “Create”: click on create
  4. Make sure you are running at least storage version 0.4.0 and enable the antivirus: update settings
  5. Wait for the service to update and try to upload a sample virus file like eicar upload virus
  6. If the setup is working the upload should fail upload fails
  7. You can also head to hasura and verify entries were added to the virus table: click on create

That entry should have useful information about like the filename, the virus found and the user session. In addition, the information on that table can be used a source for events.