Skip to content

Improve scan_for_virus robustness and add missing resource test#2074

Open
dikshaa2909 wants to merge 1 commit intoaboutcode-org:mainfrom
dikshaa2909:fix/clamav-resource-mismatch
Open

Improve scan_for_virus robustness and add missing resource test#2074
dikshaa2909 wants to merge 1 commit intoaboutcode-org:mainfrom
dikshaa2909:fix/clamav-resource-mismatch

Conversation

@dikshaa2909
Copy link

Issues

Changes

This improves the robustness of scan_for_virus when ClamAV reports files that are not indexed in CodebaseResource.

Previously, .get(path=...) could raise DoesNotExist, causing the pipeline to fail when ClamAV returned a file not present in the database.

This change:

  • Avoids exception-driven control flow
  • Preloads indexed resource paths to prevent per-file DB lookups
  • Safely skips non-indexed infected files
  • Preserves existing virus detection behavior
  • Fixes typo in extra_data key (calmavclamav)
  • Adds a regression test covering the missing-resource scenario

Checklist

  • I have read the contributing guidelines
  • I have linked an existing issue above
  • I have added unit tests covering the new code
  • I have reviewed and understood every line of this PR

@dikshaa2909 dikshaa2909 force-pushed the fix/clamav-resource-mismatch branch 3 times, most recently from 26d36ac to fba6bbb Compare March 3, 2026 10:14
…o, and add missing-resource test

Signed-off-by: dikshaa2909 <dikshadeware@gmail.com>
@dikshaa2909 dikshaa2909 force-pushed the fix/clamav-resource-mismatch branch from fba6bbb to 2691c49 Compare March 3, 2026 10:21
@dikshaa2909
Copy link
Author

Hi @tdruez @pombredanne can you pls review !!

@dikshaa2909
Copy link
Author

Hi @tdruez @pombredanne can u pls review it when u have time ! Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scan_for_virus with ClamAV docker container failed: CodebaseResource matching query does not exist

1 participant