feat(malwaremanager): remove the ClamAV scanner - #927
Conversation
ClamAV was the only in-tree implementation of the MalwareScanner
interface. It is obsolete: its alerts never reach the hash-signature
matcher (that path handles rule R6000 only), and the dashboard's
"Malware Name" field reads a signature name that only the hash path
fills, so a ClamAV alert renders it empty.
Removed:
- pkg/malwaremanager/v1/clamav (the scanner)
- clamav/ (the sidecar image: Dockerfile, Makefile, init and
database-filter scripts)
- the CLAMAV_SOCKET wiring in CreateMalwareManager
- the ClamAV surface of the CI test chart
- the ClamAV claims in README, docs/CONFIGURATION.md and the demo
Kept:
- the MalwareScanner, MalwareResult and MalwareManagerClient
interfaces, and pkg/malwaremanager/v1/types. They are the extension
point for out-of-tree scanners, and downstream exporters build on
MalwareResult.
- the malware manager itself and malwareDetectionEnabled. With no
scanner registered the manager cannot alert, so it now logs a
warning that says exactly that instead of failing silently.
The matching chart change removes the sidecar from
kubescape/helm-charts. The two are independent: this agent ignores an
absent CLAMAV_SOCKET, and a running sidecar with no client is inert.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
matthyx
left a comment
There was a problem hiding this comment.
Reviewed. The removal itself is clean (interface, MalwareResult, and MalwareManagerClient are correctly kept as the extension point; chart/docs/demo cleanup is consistent), but there's one real blocker: CI is red on Test_10_MalwareDetectionTest, and it will stay red permanently since this PR removes the only scanner that test's assertion depends on — see the inline comment for detail and the fix needed. Also note this PR is still a Draft. Not approving until the failing test is addressed and CI is green.
There was a problem hiding this comment.
Blocker: component-tests (Test_10_MalwareDetectionTest) is red on this PR (https://github.com/kubescape/node-agent/actions/runs/32974296987/job/98196942880). That test deploys quay.io/petr_ruzicka/malware-cryptominer-container:2.0.2 and asserts a malware alert with malware_name == "Multios.Coinminer.Miner-6781728-2.UNOFFICIAL" — a ClamAV signature name (tests/component_test.go). With malwareScanners now permanently empty (no in-tree scanner ever gets appended here), that alert can never be produced, so this test fails deterministically on every future run, not just this one.
Since the PR intentionally removes the only scanner that could satisfy this test, the test itself needs to go too — please delete Test_10_MalwareDetectionTest (and its entry in .github/workflows/component-tests.yaml) as part of this change, or gate it clearly, so CI reflects the new "no in-tree scanner" reality instead of staying red.
Minor/non-blocking nit: since malwareScanners is now always empty at this point (nothing appends to it), if len(malwareScanners) == 0 { ... } is dead code — could just be an unconditional logger.L().Warning(...). Not blocking, just flagging in case a future scanner registration is added here later and this branch is expected to become conditional again.
Summary
ClamAV is the only in-tree implementation of the
MalwareScannerinterface, and it is obsolete.Its alerts never reach the hash-signature matcher — that path handles rule R6000 only — and the
dashboard's "Malware Name" field reads a signature name that only the hash path fills, so a
ClamAV alert renders it empty today. This removes the scanner, the sidecar image and the claims
about it, and keeps the interface.
BREAKING CHANGE: the node-agent no longer ships a malware scanner.
malwareDetectionEnabledstill starts the malware manager, but with no scanner registered it cannot produce an alert, so
it logs a warning saying exactly that.
Ticket
None — this repository has no ticket link. Tracked internally as part of the file-hash detection
GA work.
Changes
pkg/malwaremanager/v1/clamav— the scanner.clamav/— the sidecar image: Dockerfile, Makefile, the init script and thedatabase-filter script.
CLAMAV_SOCKETwiring inCreateMalwareManager, and warn when the manager startswith no scanner registered.
tests/chart.README.md,docs/CONFIGURATION.mdand the demo walkthrough, andthe demo screenshot the removed section used.
go mod tidydropsgithub.com/dutchcoders/go-clamd.Kept on purpose:
MalwareScanner,MalwareResult,MalwareManagerClientandpkg/malwaremanager/v1/types. They are the extension point for an out-of-tree scanner, anddownstream exporters build on
MalwareResult.The matching chart change removes the sidecar from
kubescape/helm-charts. The two areindependent and can merge in either order: this agent ignores an absent
CLAMAV_SOCKET, and arunning sidecar with no client is inert.
Testing
go build ./...andgo vet ./...forGOOS=linux→ pass. The test suite does not run onmacOS — the dependency tree is Linux-only — so CI is the gate for the tests.
helm templateontests/chartwithcapabilities.malwareDetection=enable→ renders, no ClamAV.AI-skills: armosec-shared-rules:agent-dispatch-policy