This commit addresses issues #264 and #304, where users were not receiving error messages when script execution failed due to antivirus intervention, particularly with Microsoft Defender. Now, desktop app users will see a detailed error message with guidance on next steps if script saving or execution fails due to antivirus removal. Key changes: - Implement a check to detect failure in file writing, including reading the written file back. This method effectively detects antivirus interventions, as the read operation triggers an antivirus scan, leading to file deletion by the antivirus. - Introduce a specific error message for scenarios where an antivirus intervention is detected.
This commit is contained in:
@@ -20,7 +20,7 @@ import ModalDialog from '@/presentation/components/Shared/Modal/ModalDialog.vue'
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
|
||||
import { ScriptFilename } from '@/application/CodeRunner/ScriptFilename';
|
||||
import { Dialog, FileType } from '@/presentation/common/Dialog';
|
||||
import { Dialog, FileType, SaveFileError } from '@/presentation/common/Dialog';
|
||||
import IconButton from '../IconButton.vue';
|
||||
import RunInstructions from './RunInstructions/RunInstructions.vue';
|
||||
|
||||
@@ -45,7 +45,7 @@ export default defineComponent({
|
||||
getType(currentState.value.collection.scripting.language),
|
||||
);
|
||||
if (!success) {
|
||||
showScriptSaveError(dialog, `${error.type}: ${error.message}`);
|
||||
showScriptSaveError(dialog, error);
|
||||
return;
|
||||
}
|
||||
areInstructionsVisible.value = true;
|
||||
@@ -78,8 +78,18 @@ function buildFilename(scripting: IScriptingDefinition) {
|
||||
return ScriptFilename;
|
||||
}
|
||||
|
||||
function showScriptSaveError(dialog: Dialog, technicalDetails: string) {
|
||||
function showScriptSaveError(dialog: Dialog, error: SaveFileError) {
|
||||
const technicalDetails = `[${error.type}] ${error.message}`;
|
||||
dialog.showError(
|
||||
...(
|
||||
error.type === 'FileReadbackVerificationError'
|
||||
? createAntivirusErrorDialog(technicalDetails)
|
||||
: createGenericErrorDialog(technicalDetails)),
|
||||
);
|
||||
}
|
||||
|
||||
function createGenericErrorDialog(technicalDetails: string): Parameters<Dialog['showError']> {
|
||||
return [
|
||||
'Error Saving Script',
|
||||
[
|
||||
'An error occurred while saving the script.',
|
||||
@@ -95,6 +105,32 @@ function showScriptSaveError(dialog: Dialog, technicalDetails: string) {
|
||||
'Technical Details:',
|
||||
technicalDetails,
|
||||
].join('\n'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
function createAntivirusErrorDialog(technicalDetails: string): Parameters<Dialog['showError']> {
|
||||
return [
|
||||
'Potential Antivirus Intervention',
|
||||
[
|
||||
[
|
||||
'It seems your antivirus software might have blocked the saving of the script.',
|
||||
'privacy.sexy is secure, transparent, and open-source, but the scripts might still be mistakenly flagged by antivirus software such as Defender.',
|
||||
].join(' '),
|
||||
'\n',
|
||||
'To resolve this, consider:',
|
||||
'1. Checking your antivirus for any blocking notifications and allowing the script.',
|
||||
'2. Temporarily disabling real-time protection or adding an exclusion for privacy.sexy scripts.',
|
||||
'3. Re-attempting to save the script.',
|
||||
'4. If the problem continues, review your antivirus logs for more details.',
|
||||
'\n',
|
||||
'To handle false warnings in Defender: Open "Virus & threat protection" from the "Start" menu.',
|
||||
'\n',
|
||||
'Always ensure to re-enable your antivirus protection promptly.',
|
||||
'For more guidance, refer to your antivirus documentation.',
|
||||
'\n',
|
||||
'Technical Details:',
|
||||
technicalDetails,
|
||||
].join('\n'),
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -49,11 +49,15 @@
|
||||
</p>
|
||||
<p>
|
||||
These false positives are common for scripts that modify system settings.
|
||||
privacy.sexy is secure, transparent, and open-source.
|
||||
</p>
|
||||
<p>
|
||||
To handle false warnings in Microsoft Defender:
|
||||
<ol>
|
||||
<li>Open <strong>Virus & threat protection</strong> from the Start menu.</li>
|
||||
<li>
|
||||
Open <strong>Virus & threat protection</strong> from
|
||||
the <strong>Start</strong> menu.
|
||||
</li>
|
||||
<li>
|
||||
Locate the event in <strong>Protection history</strong>
|
||||
that pertains to the script.
|
||||
|
||||
Reference in New Issue
Block a user