Skip to content

Feat/allow switching between windows defender and clamav#927

Merged
egalvis27 merged 40 commits intomainfrom
feat/allow-switching-between-windows-defender-and-clamav
Jul 25, 2025
Merged

Feat/allow switching between windows defender and clamav#927
egalvis27 merged 40 commits intomainfrom
feat/allow-switching-between-windows-defender-and-clamav

Conversation

@egalvis27
Copy link
Copy Markdown
Contributor

  • Antivirus Scan: Scans now use the Antivirus Manager to select the most suitable antivirus engine.
  • Removed Checks: Eliminated validations related to Windows Defender real-time protection.
  • Refactored Initialization: Updated initializeAntivirus to include payment conditions before initializing the antivirus engine.

egalvis39 and others added 27 commits July 10, 2025 17:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 24, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 38.35% 7112 / 18543
🔵 Statements 38.35% 7112 / 18543
🔵 Functions 57.41% 577 / 1005
🔵 Branches 80.34% 1108 / 1379
File CoverageNo changed files found.
Generated in workflow #948 for commit 3d79291 by the Vitest Coverage Report Action

@@ -0,0 +1,14 @@
import { exec } from 'child_process';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you check the usage of import { promisify } from 'util'. I think is going to be easier to execute exec without using callbacks and new Promise.

const exec = promisify(execCallback);

return 'clamav';
}
if (!clamavAvailable) await initializeClamAV();
if (await checkClamdAvailability()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't need to do this check again, just read the result value from initializeClamAV

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Following your recommendation this morning, I kept only one validation. After running some tests, I noticed that ClamAV was never selected as the antivirus engine. This is because when the full antivirus interface is initialized, ClamAV gets loaded. But with just the negated condition remaining, the code never enters the block that returns ClamAV as the engine to be used.

this.isInitialized = true;
} catch (error) {
console.error('Error Initializing ClamAV:', error);
logger.error({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can do throw logger.error so we can have the stack trace using the msg of the logger error

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
13.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@egalvis27 egalvis27 merged commit ac76ec2 into main Jul 25, 2025
3 of 4 checks passed
@egalvis27 egalvis27 deleted the feat/allow-switching-between-windows-defender-and-clamav branch July 25, 2025 09:58
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.

3 participants