Skip to content

fix: skip rescan-on-download when no malware scanner is bound#783

Merged
Schmarvinius merged 3 commits intomainfrom
fix/skip-rescan-when-no-scanner-bound
Apr 10, 2026
Merged

fix: skip rescan-on-download when no malware scanner is bound#783
Schmarvinius merged 3 commits intomainfrom
fix/skip-rescan-when-no-scanner-bound

Conversation

@Schmarvinius
Copy link
Copy Markdown
Collaborator

@Schmarvinius Schmarvinius commented Apr 9, 2026

Fix: Skip Rescan-on-Download When No Malware Scanner Is Bound

Bug Fix

🐛 Fixed an issue where the ReadAttachmentsHandler would attempt to trigger rescan-on-download logic even when no malware scanner service is bound. When scanClient is null (i.e., no malware scanning service is available), stale or unscanned attachments should not be queued for rescanning on download.

Changes

  • Registration.java: Passes scanClient != null as the scannerAvailable flag when constructing ReadAttachmentsHandler, ensuring the handler is aware of whether a malware scanner is actually bound.

  • ReadAttachmentsHandler.java: Added a scannerAvailable boolean field and updated the constructor to accept it. The verifyStatus method now short-circuits the rescan check when scannerAvailable is false, preventing unnecessary scan attempts when no scanner is configured.

  • ReadAttachmentsHandlerTest.java: Updated the existing handler instantiation to pass true for scannerAvailable. Added three new test cases covering the scannerAvailable = false scenario:

    • Stale clean attachments are not re-triggered for scanning.
    • Clean attachments with a null scannedAt timestamp are not re-triggered.
    • Attachments with UNSCANNED status still fail validation as expected (status validation is unaffected by scanner availability).
  • 🔄 Regenerate and Update Summary

📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!

PR Bot Information

Version: 1.20.4 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template
  • Event Trigger: pull_request.opened
  • File Content Strategy: Full file content
  • Summary Prompt: Default Prompt
  • Correlation ID: 9c915e60-33f6-11f1-8c2d-1502b3e0d84c

Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is well-structured and the core logic change is correct. The only notable issue is the repeated construction of handlerWithoutScanner across three test methods, which should be refactored into a shared helper to reduce duplication and improve maintainability. The production code changes in ReadAttachmentsHandler and Registration are clean and correctly implement the intended behavior.

PR Bot Information

Version: 1.20.4 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.opened
  • File Content Strategy: Full file content
  • Correlation ID: 9c915e60-33f6-11f1-8c2d-1502b3e0d84c

@Schmarvinius Schmarvinius requested a review from a team April 9, 2026 11:48
@Schmarvinius Schmarvinius merged commit 6894501 into main Apr 10, 2026
12 checks passed
@Schmarvinius Schmarvinius deleted the fix/skip-rescan-when-no-scanner-bound branch April 10, 2026 07:55
@hyperspace-insights hyperspace-insights Bot mentioned this pull request Apr 10, 2026
1 task
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.

2 participants