Files
cpanel-importer/tests
shadowdaoandClaude Sonnet 5.5 2ebb05a6d6 scan-files: fail closed on scan errors masked by hits, unmapped hits and quarantine failures
Review of the scan-scope change (measured on ClamAV 1.4.6 in this image):
- clamscan exits 1, not 2, when one listed file is infected and another
  cannot be read: only the summary says "Total errors: 1". A mode-000
  webshell next to any detected file went unscanned and the run passed
  (privd accepted the attestation, require_scan_scope=true included).
  Now: a summary with Total errors > 0, or no summary at all, fails the run.
- Every hit line must name an EXACT entry of the scan list (the last ": "
  ends the path; signature names never contain one); anything else fails
  the run instead of being skipped.
- The list itself is checked before clamscan sees it: each entry a plain
  absolute path below the extract, <= 1022 bytes, no control character,
  and exactly files_scanned entries.
- A hit that cannot be moved to quarantine fails the run (it used to log a
  WARN and leave the infected file in the tree to be imported). Duplicate
  hits (a link target listed twice) are one action.
- Tests: names with ': ' + ' FOUND', leading '-', \n, \r, >= 1023 bytes;
  rogue hit, Total errors, no summary, unquarantinable hit, list longer
  than files_scanned, entry outside the extract (red on the old script);
  image-scope-test.sh runs a mode-000 file next to EICAR end to end.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-22 07:30:19 -08:00
..