Skip to content

Commit

Permalink
Item14149: Treat any scan errors as fatal
Browse files Browse the repository at this point in the history
If mandatory scanning is requested, errors should be fatal.
  • Loading branch information
gac410 committed Aug 30, 2016
1 parent 251c472 commit 2532dc8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Foswiki/Plugins/ClamAVScanPlugin.pm
Expand Up @@ -222,7 +222,9 @@ sub beforeUploadHandler {
params => [ $attrs->{attachment}, $virus ]
);
}
elsif ( $ok eq 'ERROR' ) {
elsif ($ok eq 'ERROR'
&& $Foswiki::cfg{Plugins}{ClamAVScanPlugin}{mandatoryScan} )
{
Foswiki::Func::writeWarning( "ERROR detected in scan: $virus"
. $web . '.'
. $topic
Expand Down Expand Up @@ -265,6 +267,13 @@ sub beforeSaveHandler {
"$virus detected in $web.$topic text during save - Save blocked.");
throw Foswiki::OopsException( 'clamavsave', params => [$virus] );
}
elsif ($ok eq 'ERROR'
&& $Foswiki::cfg{Plugins}{ClamAVScanPlugin}{mandatoryScan} )
{
Foswiki::Func::writeWarning(
"ERROR detected in scan: $virus" . "Save blocked." );
throw Foswiki::OopsException( 'clamavsave', params => [$virus] );
}

return 1;
}
Expand Down

0 comments on commit 2532dc8

Please sign in to comment.