clamby 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: adc57fe159207dd73de944b79537cfc443fd1dea
4
- data.tar.gz: 23d0a824e8ea4d1a4c2f492a96cb4e9b29a27b66
2
+ SHA256:
3
+ metadata.gz: e11cf21ff5f74654f10a44017053c0b883f382ab423e38c6fe0a46af9ce314ac
4
+ data.tar.gz: 233cc4ea434c05f575885336aebbba53884b019317d507855b0688179546d116
5
5
  SHA512:
6
- metadata.gz: f08b205ae90fde3ec92e6fa0bbfd192bc6687feffe489421683cc8f964f09700a0be558c95ae66e66da943d14f6f09ee0236df1ca22639684fcf2762c9ef5a1b
7
- data.tar.gz: 3f8af7ce3aa9716d593ee1cbd107fe2b86814ccf1741fe646ef98441353c074267b0009fe9f416cea0e7cd291ff086534c80bc384e3d36e2326a34ad6c5f14e2
6
+ metadata.gz: eee15a0059ebd4bf338cfda8ae30428ed0160b8bf14a2d10296bccccf41bb17bab07aea2f4de3ebd8bbb85664131fb050a5a8b64786be107c1d25c689867dab1
7
+ data.tar.gz: '092f0f57aee3984ab4085cf84960686cce96033095d41bd1c0ff61cb5b5ab7bafcaeec6d1563e1167b6641917d4bf95a3a80cc456553b7c36b3dbcdc1de211e6'
@@ -1,3 +1,6 @@
1
+ # v1.3.2
2
+ - [emilong](https://github.com/kobaltz/clamby/commits/master?author=emilong) added `stream` option
3
+
1
4
  # v1.3.1
2
5
  - [zealot128](https://github.com/kobaltz/clamby/commits/master?author=zealot128) added `silence_output` option
3
6
 
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dave@k-innovations.net. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/README.md CHANGED
@@ -74,6 +74,10 @@ Setting the `fdpass` configuration option to `true` will pass the `--fdpass` opt
74
74
 
75
75
  `--fdpass : Pass the file descriptor permissions to clamd. This is useful if clamd is running as a different user as it is faster than streaming the file to clamd. Only available if connected to clamd via local(unix) socket.`
76
76
 
77
+ Setting the `stream` configuration option will stream the file to the daemon. This may be useful for forcing streaming as a test for local development. Only works when also specifying `daemonize`. From the clamdscan man page:
78
+
79
+ `--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.`
80
+
77
81
  ```ruby
78
82
  Clamby.configure({
79
83
  :check => false,
@@ -82,7 +86,8 @@ Setting the `fdpass` configuration option to `true` will pass the `--fdpass` opt
82
86
  :error_file_missing => false,
83
87
  :error_file_virus => false,
84
88
  :fdpass => false,
85
- :silence_output => false
89
+ :silence_output => false,
90
+ :stream => false
86
91
  })
87
92
  ```
88
93
 
@@ -92,7 +97,10 @@ I highly recommend using the `daemonize` set to true. This will allow for clamsc
92
97
 
93
98
  ***Ubuntu***
94
99
 
95
- `sudo apt-get install clamav`
100
+ `sudo apt-get install clamav clamav-daemon`
101
+
102
+ Note, `clamav-daemon` is optional but recommended. It's needed if you wish to
103
+ run ClamAV in daemon mode.
96
104
 
97
105
  ***Apple***
98
106
 
@@ -1,16 +1,18 @@
1
1
  require "clamby/version"
2
2
  require "clamby/exception"
3
3
  module Clamby
4
-
5
- @config = {
4
+ DEFAULT_CONFIG = {
6
5
  :check => true,
7
6
  :daemonize => false,
8
7
  :error_clamscan_missing => true,
9
8
  :error_file_missing => true,
10
9
  :error_file_virus => false,
11
10
  :fdpass => false,
12
- :silence_output => false
13
- }
11
+ :silence_output => false,
12
+ :stream => false
13
+ }.freeze
14
+
15
+ @config = DEFAULT_CONFIG.dup
14
16
 
15
17
  @valid_config_keys = @config.keys
16
18
 
@@ -31,6 +33,7 @@ module Clamby
31
33
  command = [].tap do |cmd|
32
34
  cmd << clamd_executable_name
33
35
  cmd << '--fdpass' if @config[:fdpass]
36
+ cmd << '--stream' if @config[:stream] && @config[:daemonize]
34
37
  cmd << path
35
38
  cmd << '--no-summary'
36
39
  cmd << { out: File::NULL } if @config[:silence_output]
@@ -1,3 +1,3 @@
1
1
  module Clamby
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -4,6 +4,8 @@ good_path = 'README.md'
4
4
  bad_path = 'BAD_FILE.md'
5
5
 
6
6
  describe Clamby do
7
+ before { Clamby.configure(Clamby::DEFAULT_CONFIG.dup) }
8
+
7
9
  it "should find files." do
8
10
  expect(Clamby.file_exists?(good_path)).to be true
9
11
  end
@@ -25,6 +27,7 @@ describe Clamby do
25
27
  end
26
28
 
27
29
  it "should scan file and return nil" do
30
+ Clamby.configure({:error_file_missing => false})
28
31
  expect(Clamby.safe?(bad_path)).to be nil
29
32
  expect(Clamby.virus?(bad_path)).to be nil
30
33
  end
@@ -68,4 +71,30 @@ describe Clamby do
68
71
  expect(Clamby.system_command(good_path)).to eq ["clamscan", "--fdpass", good_path, "--no-summary"]
69
72
  end
70
73
  end
74
+
75
+ # From the clamscan man page:
76
+ # Forces file streaming to clamd. This is generally not needed as clamdscan
77
+ # detects automatically if streaming is required. This option only exists for
78
+ # debugging and testing purposes, in all other cases --fdpass is preferred.
79
+ context 'stream option' do
80
+ it 'is false by default' do
81
+ expect(Clamby.config[:stream]).to eq false
82
+ end
83
+ it 'accepts an stream option in the config' do
84
+ Clamby.configure(stream: true)
85
+ expect(Clamby.config[:stream]).to eq true
86
+ end
87
+ it 'does not include stream in the command by default' do
88
+ Clamby.configure(stream: false)
89
+ expect(Clamby.system_command(good_path)).to eq ["clamscan", good_path, "--no-summary"]
90
+ end
91
+ it 'omits the stream option when invoking clamscan if it is set, but daemonize isn\'t' do
92
+ Clamby.configure(stream: true)
93
+ expect(Clamby.system_command(good_path)).to eq ["clamscan", good_path, "--no-summary"]
94
+ end
95
+ it 'passes the stream option when invoking clamscan if it is set with daemonize' do
96
+ Clamby.configure(stream: true, daemonize: true)
97
+ expect(Clamby.system_command(good_path)).to eq ["clamdscan", "--stream", good_path, "--no-summary"]
98
+ end
99
+ end
71
100
  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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaltz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-04 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,7 @@ files:
65
65
  - ".rspec"
66
66
  - ".travis.yml"
67
67
  - CHANGELOG.md
68
+ - CODE_OF_CONDUCT.md
68
69
  - Gemfile
69
70
  - LICENSE.txt
70
71
  - README.md
@@ -97,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.6.13
101
+ rubygems_version: 2.7.6
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Scan file uploads with ClamAV