Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Conversation

@drags
Copy link

@drags drags commented Mar 12, 2020

Currently if the ClamAV exec fails for any reason the script was simply raising an exception and dying. This causes confusion for both users and admins and could lead to endless re-scanning for files that would never complete.

This PR does a few things:

  • Introduces an AV_STATUS_FAILED status variable to explicitly denote that a scan failed to complete
  • Sends metrics for failed scans
  • Catches disk space exhaustion exceptions when downloading files from s3
  • Refactors scan.pys lambda_handler method to reduce size and so that pieces of it can be re-used. The new methods are remove_file and download_clamav_databases

drags added 2 commits March 11, 2020 14:24
Adds AV_STATUS_FAILED configuration variable to be set as the status
when a file cannot be scanned. Previously files that failed scanning
would never be tagged, which means they would be picked up in every
subsequent re-scan as well as ambiguous in status for users.
Files may fail to scan if they are too large (due to either being larger
than lambda's /tmp, or just large enough that clamscan fails when trying
to mmap the signature databases). This commit cleans up the
lambda_handler a bit and handles OSError from the s3 download running
out of disk space.
@CLAassistant
Copy link

CLAassistant commented Mar 12, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants