Skip to content

Commit f7175d0

Browse files
authored
ci: add clamav malware scan job (#639)
1 parent 86d621b commit f7175d0

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/vulnerability-check.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,34 @@ jobs:
3030
scanners: 'vuln,license,secret,misconfig'
3131
skip-version-check: true
3232

33+
clamav_scan:
34+
name: ClamAV Malware Scan
35+
runs-on: ubuntu-latest
36+
if: github.event_name == 'pull_request'
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
- name: Install ClamAV
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y clamav
46+
47+
- name: Update ClamAV signatures
48+
run: |
49+
sudo systemctl stop clamav-freshclam
50+
# Retry up to 3 times, as ClamAV's CDN may be rate-limited.
51+
for i in {0..2}; do
52+
sudo freshclam && exit 0
53+
[ "$i" -lt 2 ] && sleep 10
54+
done
55+
exit 1
56+
57+
- name: Run ClamAV to check for malware
58+
# Enforce a 10MB file/archive limit, and fail when exceeded.
59+
run: clamscan --recursive --infected --exclude-dir="(^|/)\.git$" --max-filesize=10M --max-scansize=10M --alert-exceeds-max .
60+
3361
trivy_report:
3462
name: Trivy Vulnerability Report
3563
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)