High-performance Rust HTTP virus scanner (ClamAV CVD) - #1
Conversation
Parse official ClamAV CVD/CLD containers (header, MD5, RSA dsig), load hash/NDB/LDB signatures, and serve streamable file and hash scans over HTTP. Bake databases into the Docker image and hot-swap verified updates without restarting the server. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Use a single Aho-Corasick pass with sparse logical-signature counts so scans no longer allocate a 269k-row matrix. Document release-mode throughput and official daily.cvd load time. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Bind a live TCP listener in Criterion and drive /scan, /scan/hash, and concurrent uploads with keep-alive HTTP. Record on-disk and unpacked sizes for main/daily/bytecode, and parse PE section hashes as Size:MD5:Name. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Match other Appwrite image repos: cargo tests on PRs, a multi-arch Docker build without push, and a Release workflow that publishes appwrite/defender to Docker Hub on GitHub Releases. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Ship a shadcn/TanStack Start UI in its own container that proxies defender, parses scan/hash JSON into structured verdicts, and documents the payload fields. docker compose up runs scanner + UI. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
- Change default port mapping in docker-compose to allow for environment variable override. - Update README to reflect new port and clarify UI functionality. - Rename playground to Defender UI for consistency and clarity. - Enhance scan result display with clearer status messages and technical details. - Refactor code for better organization and readability, including the introduction of an accordion for technical details. - Adjust manifest and route titles for better alignment with the application purpose. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
- Update README to reflect the new application name and provide a clearer description. - Remove the manifest.json file as it is no longer needed. - Introduce a new font-face for improved typography in the UI. - Refactor theme toggle component to improve rendering logic. - Enhance API call functions for better error handling and response management. - Update various components to improve layout and loading states. Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Greptile SummaryThe PR adds a native Rust HTTP virus scanner, CVD parsing and updates, container/release automation, and a browser playground. The target-filtering fix closes the reported unknown-file false-positive path but makes several supported target-specific signature classes unreachable.
Confidence Score: 4/5The PR is not yet safe to merge because target-specific signatures for several supported formats are now skipped unconditionally. The strict target predicate receives Any for HTML, OLE2, mail, text, Flash, Java, graphics, and other inputs because detect_kind cannot emit those target types, so matching NDB/LDB signatures produce false-negative scan verdicts. Files Needing Attention: src/engine/mod.rs and src/signatures/ndb.rs Important Files Changed
Prompt To Fix All With AI### Issue 1
src/engine/mod.rs:561-563
**Target signatures become unreachable**
When an HTML, OLE2, mail, text, Flash, Java, graphics, or other file is scanned, `detect_kind` returns `Any`, so this strict equality rejects signatures targeting the file's actual format and causes matching malware to receive a clean verdict.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (2): Last reviewed commit: "Refactor target matching logic and add c..." | Re-trigger Greptile |
- Simplify the target_ok function by removing unnecessary condition. - Introduce a new test case to validate behavior of target matching for unknown file types. - Ensure that the scan results for different target types are correctly asserted in the tests.
Native Rust HTTP virus scanner that parses ClamAV public CVD/CLD databases (no libclamav), streams file and hash uploads, and hot-reloads verified signature updates with zero downtime.
Playground
TanStack Start + shadcn UI in a second Docker container, wired through
docker-compose.yml:duration_us)/api/*proxies to defender (DEFENDER_URL)CI
GitHub Actions matching other Appwrite Docker image repos (
console,assistant):cargo test --lockedplus playgroundnpm test/ typechecklinux/amd64,linux/arm64) Docker build on PRs/main,push: falsevars.DOCKERHUB_USERNAME/secrets.DOCKERHUB_TOKENand pushesappwrite/defenderwith semver tags (x.y.z,x.y,x)Virus database sizes (18 Aug 2026)
main.cvddaily.cvdbytecode.cvdmain+daily)Loaded engine (main+daily, PUA off): ~540k file hashes, ~102k body, ~307k logical. RSS ≈ 1.4 GiB.
HTTP e2e benchmarks (live TCP, Criterion, 4× x86_64)
Synthetic engine:
GET /healthPOST /scanEICARPOST /scan/hashPOST /scanclean 64 KiBPOST /scanclean 1 MiBOfficial
daily.cvdover HTTP: EICAR 44.5 µs; hash lookup 43.6 µs; clean 64 KiB 667 µs (93.7 MiB/s); EICAR ×16 concurrent 54.0 k req/s.What it does
ClamAV-VDBheader, gzip+tar body, MD5 integrity, and official RSAcli_versig.hdb/.hsb(Hash:Size:Name),.mdb/.msb(Size:Hash:Name),.ndb,.ldb, FP/ignorePOST /scan,POST /scan/hash,POST /scan/hashesarc-swaps the engine with zero downtime