clamby 1.6.6 → 1.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.md +6 -3
- data/README.md +7 -0
- data/clamby.gemspec +1 -2
- data/lib/clamby/command.rb +2 -1
- data/lib/clamby/version.rb +1 -1
- data/lib/clamby.rb +1 -0
- data/spec/clamby/command_spec.rb +34 -6
- data/spec/clamby_spec.rb +12 -0
- data/spec/fixtures/safe (special).txt +2 -0
- data/spec/support/shared_context.rb +1 -0
- metadata +6 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 171036eaf5b847c95d24d69acf689dad2c9eda942a746b5c98182058446e9af0
|
4
|
+
data.tar.gz: 862529ea5008ebd2568c40ea3dd8c2e38cc5467733edf13b97ac67b6ac817e03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c416805c97b12c6f2ed9dbb43843be08841ca0821ea2036f9ab903feceecf7fabde4fc6786fb7a0ef5e1e628123329e29478bfb843540cf416c6709e174cb56
|
7
|
+
data.tar.gz: a5667261a416a5eb2ade0ba75f1982949ae9845849a8f647bcd918091720b5b1e95c30477b838e94a7d297256c45263bc09268aef6b711d2ed2e704845554f51
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v1.6.8
|
2
|
+
- [codezomb](https://github.com/kobaltz/clamby/commits?author=codezomb) - Allow paths to be escaped #37
|
3
|
+
|
1
4
|
# v1.6.5
|
2
5
|
- [bennacer860](https://github.com/kobaltz/clamby/commits?author=bennacer860) - Added config data dir option
|
3
6
|
|
@@ -25,7 +28,7 @@
|
|
25
28
|
|
26
29
|
# v1.3.2
|
27
30
|
- [emilong](https://github.com/kobaltz/clamby/commits/master?author=emilong) added `stream` option
|
28
|
-
|
31
|
+
|
29
32
|
# v1.3.1
|
30
33
|
- [zealot128](https://github.com/kobaltz/clamby/commits/master?author=zealot128) added `silence_output` option
|
31
34
|
|
@@ -43,7 +46,7 @@
|
|
43
46
|
- Refactor of logic
|
44
47
|
- Cleanup
|
45
48
|
- Thanks to @hderms for contributing!
|
46
|
-
|
49
|
+
|
47
50
|
# v1.1.0
|
48
51
|
- Changed `scan()` to `safe?()`
|
49
52
|
- Added `virus?()`
|
@@ -70,7 +73,7 @@ HTTP request sent, awaiting response... 200 OK
|
|
70
73
|
Length: 68 [application/octet-stream]
|
71
74
|
Saving to: 'eicar.com'
|
72
75
|
|
73
|
-
100%[=================>] 68 --.-K/s in 0s
|
76
|
+
100%[=================>] 68 --.-K/s in 0s
|
74
77
|
|
75
78
|
2014-03-10 21:35:50 (13.0 MB/s) - 'eicar.com' saved [68/68]
|
76
79
|
|
data/README.md
CHANGED
@@ -99,6 +99,7 @@ Configuration is rather limited right now. You can exclude the check if `clamsca
|
|
99
99
|
:error_file_virus => false,
|
100
100
|
:fdpass => false,
|
101
101
|
:stream => false,
|
102
|
+
:reload => false,
|
102
103
|
:output_level => 'medium', # one of 'off', 'low', 'medium', 'high'
|
103
104
|
:executable_path_clamscan => 'clamscan',
|
104
105
|
:executable_path_clamdscan => 'clamdscan',
|
@@ -128,6 +129,12 @@ Setting the `stream` configuration option will stream the file to the daemon. Th
|
|
128
129
|
|
129
130
|
`--stream : Forces file streaming to clamd. This is generally not needed as clamdscan detects automatically if streaming is required. This option only exists for debugging and testing purposes, in all other cases --fdpass is preferred.`
|
130
131
|
|
132
|
+
#### Force streaming files to clamd
|
133
|
+
|
134
|
+
Setting the `reload` configuration option to `true` will pass the `--reload` option to the daemon. Only works when also specifying `daemonize`. From the clamdscan man page:
|
135
|
+
|
136
|
+
`--reload : Request clamd to reload virus database.`
|
137
|
+
|
131
138
|
#### Output levels
|
132
139
|
|
133
140
|
- *off*: suppress all output
|
data/clamby.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dave@k-innovations.net"]
|
11
11
|
spec.summary = "Scan file uploads with ClamAV"
|
12
12
|
spec.description = "Clamby allows users to scan files uploaded with Paperclip or Carrierwave. If a file has a virus, then you can delete this file and discard it without causing harm to other users."
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/kobaltz/clamby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -21,5 +21,4 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
|
-
spec.add_development_dependency "byebug"
|
25
24
|
end
|
data/lib/clamby/command.rb
CHANGED
@@ -16,11 +16,12 @@ module Clamby
|
|
16
16
|
def self.scan(path)
|
17
17
|
return nil unless file_exists?(path)
|
18
18
|
|
19
|
-
args = [path, '--no-summary']
|
19
|
+
args = [Shellwords.escape(path), '--no-summary']
|
20
20
|
|
21
21
|
if Clamby.config[:daemonize]
|
22
22
|
args << '--fdpass' if Clamby.config[:fdpass]
|
23
23
|
args << '--stream' if Clamby.config[:stream]
|
24
|
+
args << '--reload' if Clamby.config[:reload]
|
24
25
|
end
|
25
26
|
|
26
27
|
args << "-d #{Clamby.config[:datadir]}" if Clamby.config[:datadir]
|
data/lib/clamby/version.rb
CHANGED
data/lib/clamby.rb
CHANGED
data/spec/clamby/command_spec.rb
CHANGED
@@ -84,6 +84,32 @@ describe Clamby::Command do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
describe 'reloading virus database' do
|
88
|
+
it 'does not include reload in the command by default' do
|
89
|
+
Clamby.configure
|
90
|
+
expect(runner).to receive(:run).with('clamscan', good_path, '--no-summary')
|
91
|
+
allow(described_class).to receive(:new).and_return(runner)
|
92
|
+
|
93
|
+
described_class.scan(good_path)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'omits the reload option when invoking clamscan if it is set, but daemonize isn\'t' do
|
97
|
+
Clamby.configure(reload: true)
|
98
|
+
expect(runner).to receive(:run).with('clamscan', good_path, '--no-summary')
|
99
|
+
allow(described_class).to receive(:new).and_return(runner)
|
100
|
+
|
101
|
+
described_class.scan(good_path)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'passes the reload option when invoking clamscan if it is set with daemonize' do
|
105
|
+
Clamby.configure(reload: true, daemonize: true)
|
106
|
+
expect(runner).to receive(:run).with('clamdscan', good_path, '--no-summary', '--reload')
|
107
|
+
allow(described_class).to receive(:new).and_return(runner)
|
108
|
+
|
109
|
+
described_class.scan(good_path)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
87
113
|
describe 'specifying config-file' do
|
88
114
|
it 'does not include the parameter in the clamscan command by default' do
|
89
115
|
Clamby.configure
|
@@ -134,9 +160,7 @@ describe Clamby::Command do
|
|
134
160
|
|
135
161
|
it 'executes the clamscan executable from the custom path' do
|
136
162
|
expect(runner).to receive(:system).with(
|
137
|
-
"#{custom_path}/clamscan",
|
138
|
-
'--no-summary',
|
139
|
-
good_path,
|
163
|
+
"#{custom_path}/clamscan --no-summary #{good_path}",
|
140
164
|
{}
|
141
165
|
) { system("exit 0", out: File::NULL) }
|
142
166
|
|
@@ -149,9 +173,7 @@ describe Clamby::Command do
|
|
149
173
|
|
150
174
|
it 'executes the clamdscan executable from the custom path' do
|
151
175
|
expect(runner).to receive(:system).with(
|
152
|
-
"#{custom_path}/clamdscan",
|
153
|
-
'--no-summary',
|
154
|
-
good_path,
|
176
|
+
"#{custom_path}/clamdscan --no-summary #{good_path}",
|
155
177
|
{}
|
156
178
|
) { system("exit 0", out: File::NULL) }
|
157
179
|
|
@@ -159,5 +181,11 @@ describe Clamby::Command do
|
|
159
181
|
end
|
160
182
|
end
|
161
183
|
end
|
184
|
+
|
185
|
+
describe 'special filenames' do
|
186
|
+
it 'does not fail' do
|
187
|
+
expect(described_class.scan(special_path)).to be(false)
|
188
|
+
end
|
189
|
+
end
|
162
190
|
end
|
163
191
|
end
|
data/spec/clamby_spec.rb
CHANGED
@@ -66,6 +66,18 @@ describe Clamby do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
# From the clamscan man page:
|
70
|
+
# Request clamd to reload virus database.
|
71
|
+
context 'reload option' do
|
72
|
+
it 'is false by default' do
|
73
|
+
expect(Clamby.config[:reload]).to eq false
|
74
|
+
end
|
75
|
+
it 'accepts an reload option in the config' do
|
76
|
+
Clamby.configure(reload: true)
|
77
|
+
expect(Clamby.config[:reload]).to eq true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
69
81
|
context 'error_clamscan_client_error option' do
|
70
82
|
it 'is false by default' do
|
71
83
|
expect(Clamby.config[:error_clamscan_client_error]).to eq false
|
@@ -1,4 +1,5 @@
|
|
1
1
|
RSpec.shared_context 'paths' do
|
2
|
+
let(:special_path) { File.expand_path('../../fixtures/safe (special).txt', __FILE__) }
|
2
3
|
let(:good_path) { File.expand_path('../../fixtures/safe.txt', __FILE__) }
|
3
4
|
let(:bad_path) { File.expand_path("not-here/#{rand 10e6}.txt", __FILE__) }
|
4
5
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clamby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: byebug
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Clamby allows users to scan files uploaded with Paperclip or Carrierwave.
|
70
56
|
If a file has a virus, then you can delete this file and discard it without causing
|
71
57
|
harm to other users.
|
@@ -93,10 +79,11 @@ files:
|
|
93
79
|
- spec/.DS_Store
|
94
80
|
- spec/clamby/command_spec.rb
|
95
81
|
- spec/clamby_spec.rb
|
82
|
+
- spec/fixtures/safe (special).txt
|
96
83
|
- spec/fixtures/safe.txt
|
97
84
|
- spec/spec_helper.rb
|
98
85
|
- spec/support/shared_context.rb
|
99
|
-
homepage:
|
86
|
+
homepage: https://github.com/kobaltz/clamby
|
100
87
|
licenses:
|
101
88
|
- MIT
|
102
89
|
metadata: {}
|
@@ -115,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
102
|
- !ruby/object:Gem::Version
|
116
103
|
version: '0'
|
117
104
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.4.19
|
119
106
|
signing_key:
|
120
107
|
specification_version: 4
|
121
108
|
summary: Scan file uploads with ClamAV
|
@@ -123,6 +110,7 @@ test_files:
|
|
123
110
|
- spec/.DS_Store
|
124
111
|
- spec/clamby/command_spec.rb
|
125
112
|
- spec/clamby_spec.rb
|
113
|
+
- spec/fixtures/safe (special).txt
|
126
114
|
- spec/fixtures/safe.txt
|
127
115
|
- spec/spec_helper.rb
|
128
116
|
- spec/support/shared_context.rb
|