ratonvirus-clamby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +7 -8
- data/lib/ratonvirus/clamby.rb +5 -3
- data/lib/ratonvirus/clamby/version.rb +1 -1
- data/lib/ratonvirus/scanner/clamby.rb +27 -26
- metadata +42 -15
- data/Rakefile +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbbf31447a05facfeb03d9c2549eff8a7213217dcf94e69efd3c7803dff9c99c
|
4
|
+
data.tar.gz: 42526d14c2b6abfbc698d727ae0e5bbc6eab286f46407c1d36b67dcac0ab7809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d60272c1828bf8e95ab5a604ef4b044bdf3d99f43d79091e68419957fd8d5861549e78f9c74b8b7259e473109ba662be93d67a2487fe4a6a57819ce857b53b14
|
7
|
+
data.tar.gz: 8ce13e2af541516995c31b567ff0ffa34f1b1c1d1113a5aadfc18c1f6b4730149f80e52ac62040d84e7bfe8ee09f9eca31ebdab4b5e6cee11bae3b208c01ad9f
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -123,18 +123,19 @@ the application folder or the folder where the users are uploading the files in
|
|
123
123
|
order to ensure that ClamAV daemon is able to access that folder and read files
|
124
124
|
from it.
|
125
125
|
|
126
|
-
Also note that
|
127
|
-
[CarrierWave](https://github.com/carrierwaveuploader/carrierwave)
|
128
|
-
|
129
|
-
|
126
|
+
Also note that applications using
|
127
|
+
[CarrierWave](https://github.com/carrierwaveuploader/carrierwave) or other file
|
128
|
+
upload management system may store temporary files in specific configured
|
129
|
+
temporary paths (e.g. `tmp/storage`). Make sure you are also testing that the
|
130
|
+
files are scannable in all possible temporary paths.
|
130
131
|
|
131
132
|
## Installation
|
132
133
|
|
133
134
|
Add this line to your application's Gemfile:
|
134
135
|
|
135
136
|
```ruby
|
136
|
-
gem
|
137
|
-
gem
|
137
|
+
gem "ratonvirus"
|
138
|
+
gem "ratonvirus-clamby"
|
138
139
|
```
|
139
140
|
|
140
141
|
Then execute:
|
@@ -177,8 +178,6 @@ Shown when the `clamdscan` executable returns with the exit code other than 0 or
|
|
177
178
|
|
178
179
|
### antivirus_client_error ("could not be processed for virus scan")
|
179
180
|
|
180
|
-
This means that the given file contains a virus detected by ClamAV.
|
181
|
-
|
182
181
|
In this case the `clamdscan` executable did not finish its work successfully and
|
183
182
|
an error was produced. This can be generally caused by the `clamav-daemon`
|
184
183
|
service because of few different reasons:
|
data/lib/ratonvirus/clamby.rb
CHANGED
@@ -16,11 +16,11 @@ module Ratonvirus
|
|
16
16
|
# We want Ratonvirus to report issues on file missing errors.
|
17
17
|
error_file_missing: true,
|
18
18
|
# No output is required not to fill the logs. The scanning errors
|
19
|
-
output_level:
|
19
|
+
output_level: "off"
|
20
20
|
).freeze
|
21
21
|
|
22
22
|
class << self
|
23
|
-
def configure(config={})
|
23
|
+
def configure(config = {})
|
24
24
|
::Clamby.configure(config)
|
25
25
|
end
|
26
26
|
|
@@ -44,32 +44,33 @@ module Ratonvirus
|
|
44
44
|
end
|
45
45
|
|
46
46
|
protected
|
47
|
-
def run_scan(path)
|
48
|
-
# In case the file is not present at all, scanning should always pass
|
49
|
-
# because nil is not a virus.
|
50
|
-
return if path.nil?
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
48
|
+
def run_scan(path)
|
49
|
+
# In case the file is not present at all, scanning should always pass
|
50
|
+
# because nil is not a virus.
|
51
|
+
return if path.nil?
|
52
|
+
|
53
|
+
begin
|
54
|
+
errors << :antivirus_virus_detected if ::Clamby.virus?(path)
|
55
|
+
rescue ::Clamby::ClamscanClientError
|
56
|
+
# This can happen e.g. if the clamdscan utility does not have access
|
57
|
+
# to read the file path. For debugging, try to run the clamdscan
|
58
|
+
# utility manually for the same file:
|
59
|
+
# clamdscan /path/to/file.pdf
|
60
|
+
#
|
61
|
+
# Also, make sure that the file uploads store directory is readable
|
62
|
+
# by the clamdscan utility. E.g. /path/to/app/public/uploads/tmp.
|
63
|
+
#
|
64
|
+
# Another possible reason is that in case there are too many
|
65
|
+
# concurrent virus checks ongoing, it may also trigger this error.
|
66
|
+
errors << :antivirus_client_error
|
67
|
+
rescue ::Clamby::FileNotFound
|
68
|
+
# This should be pretty rare since the scanner should not be even
|
69
|
+
# called when the file is not available. As the storage backend may
|
70
|
+
# be configured, this may still happen with some storage backends.
|
71
|
+
errors << :antivirus_file_not_found
|
72
72
|
end
|
73
|
+
end
|
73
74
|
|
74
75
|
# Make sure we are starting up with the default configuration.
|
75
76
|
reset
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratonvirus-clamby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antti Hukkanen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: clamby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: ratonvirus
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,42 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.18.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.18.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.86.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.86.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.40'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
108
|
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
110
|
+
version: '1.40'
|
83
111
|
description: Provides ClamAV scanner backed by Clamby for the Ratonvirus gem.
|
84
112
|
email:
|
85
113
|
- antti.hukkanen@mainiotech.fi
|
@@ -87,9 +115,9 @@ executables: []
|
|
87
115
|
extensions: []
|
88
116
|
extra_rdoc_files: []
|
89
117
|
files:
|
118
|
+
- CHANGELOG.md
|
90
119
|
- LICENSE
|
91
120
|
- README.md
|
92
|
-
- Rakefile
|
93
121
|
- lib/ratonvirus/clamby.rb
|
94
122
|
- lib/ratonvirus/clamby/version.rb
|
95
123
|
- lib/ratonvirus/scanner/clamby.rb
|
@@ -112,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
140
|
- !ruby/object:Gem::Version
|
113
141
|
version: '0'
|
114
142
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.7.7
|
143
|
+
rubygems_version: 3.0.3
|
117
144
|
signing_key:
|
118
145
|
specification_version: 4
|
119
146
|
summary: Clamby scanner for Ratonvirus.
|
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rspec/core/rake_task'
|
4
|
-
|
5
|
-
# Run all tests, with coverage report
|
6
|
-
RSpec::Core::RakeTask.new(:coverage) do |t, task_args|
|
7
|
-
ENV['CODECOV'] = '1'
|
8
|
-
t.verbose = false
|
9
|
-
end
|
10
|
-
|
11
|
-
# Run all tests, include all
|
12
|
-
RSpec::Core::RakeTask.new(:spec) do |t, task_args|
|
13
|
-
t.verbose = false
|
14
|
-
end
|
15
|
-
|
16
|
-
# Run both by default
|
17
|
-
task default: [:spec, :coverage]
|