You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'cherry-pick-041f2632-2' into 'master_8.0.x'
CP V8.0 - Bug #14965: Properly handle 'Compressed file is too big to be processed' with scan-avast script.
Bug #14965: Properly handle 'Compressed file is too big to be processed' with scan-avast script.
* Check if mandatory SCAN_PARAMS are correctly set
* Fix wrong return code if there is only 'Compressed file is too big to be processed' in first scan
* Get expected return code during too big loop scan (ignore too big and decompression bomb)
* Better handling reasons and statuses during scan
See merge request vitam/vitam!10698
(cherry picked from commit 041f263)
38995ca Bug #14965: Properly handle 'Compressed file is too big to be processed' with scan-avast script.
Co-authored-by: Julien Georges <julien.georges@culture.gouv.fr>
See merge request vitam/vitam!10704
# The exit status is 0 if no infected files are found and 1 otherwise.
42
48
# If an error occurred, the exit status is 2.
43
49
# Infected status takes precedence over error status, thus a scan where some file could not be scanned and some infection was found returns 1.
44
-
45
-
# Properly handle REASON without -J param
46
-
if [[ $ret_code-eq 2 ]];then
47
-
REASON="Rejected files found !"
48
-
elif [[ $ret_code-eq 1 ]];then
49
-
REASON="Virus found !"
50
-
ret_code=$(($ret_code+1))# Increase the return code to fit the expected Vitam's scan code
51
-
fi
50
+
case$?in
51
+
0)
52
+
REASON="No virus found."
53
+
ret_code=$RET_OK
54
+
;;
55
+
1)
56
+
REASON="Virus found !"
57
+
ret_code=$RET_VIRUS_FOUND_NOTFIXED# Set to fit the expected Vitam's scan code
58
+
;;
59
+
2)
60
+
REASON="Rejected files found !"
61
+
ret_code=$RET_VIRUS_FOUND_FIXED# Temporary set ret_code as fixed to allow custom analysis (we need to determine if the rejected files are too big or ignored patterns)
62
+
;;
63
+
*)
64
+
REASON="Scan not performed, unknown error !"
65
+
ret_code=$RET_FAILURE
66
+
;;
67
+
esac
52
68
53
69
# Analyse JSON logs from scan
54
70
whileread -r line;do
@@ -57,6 +73,22 @@ custom_scan () {
57
73
58
74
path=$(jq -r 'if .path[1] then .path[1] else .path[0] end // empty'<<<"$line")
0 commit comments