Expand description
Optional malware scanning of uploads with a ClamAV daemon (clamd),
spoken to over its INSTREAM protocol on TCP (host:port) or, on Unix,
a socket (unix:/run/clamav/clamd.ctl). No ClamAV code is linked.
The vault scans every file before it moves it to its content address
(Vault::with_scanner), so infected content never reaches objects/.
The check fails closed: when the daemon cannot be reached or answers
with an error, the upload is refused (503) instead of stored unscanned.
Files above the configured size (TEAMCRAFT_CLAMD_MAX_MB, clamd’s own
StreamMaxLength) are stored without a scan and logged.
Structs§
- Scanner
Config - Connection settings of the daemon (
TEAMCRAFT_CLAMD_*).
Enums§
- Verdict
- What the daemon said about a file.
Functions§
- ensure_
clean - Scans a file about to enter the vault and refuses infected content (400).
- parse_
reply - Reads the
zINSTREAManswer:stream: OK,stream: <name> FOUNDor… ERROR. - scan_
file - Scans a file. Errors (daemon unreachable, timeout, an
ERRORanswer) are returned asUnavailable: the caller refuses the upload.