Skip to main content

Module malware

Module malware 

Source
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§

ScannerConfig
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 zINSTREAM answer: stream: OK, stream: <name> FOUND or … ERROR.
scan_file
Scans a file. Errors (daemon unreachable, timeout, an ERROR answer) are returned as Unavailable: the caller refuses the upload.