clamby 1.6.8 → 1.6.10

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
2
  SHA256:
3
- metadata.gz: 81853e9529f298f606bb599f22da044e9ada2f805d2d6f6635caac455450e93e
4
- data.tar.gz: d122cf67adcfd0187c8fabd7153ca7fe20643b075f9bcfe77c8d482075462f74
3
+ metadata.gz: f3e1a92dd3ace58588a950da63a979a45dd4634006417a4bdfd8b37e5cda339a
4
+ data.tar.gz: 1988703846a4fe4b53049a897b036bf8e1a279faa0c6eb3f52d7b931417f213a
5
5
  SHA512:
6
- metadata.gz: c56dc7d74dfa3e29eeeca5d44b0cee9fc55efbc55269bcee95cd5108cb8c09ac8faa5a353bd6932ae7602adf1686bec8df4671a5afd57997bb0bdf605d2c2bdc
7
- data.tar.gz: 85b9072343ce8061cb67ab7607a52570f6d42459e9ad3467c3497c381a9df6cdea3832435dd276e306b1b5fdc1a8bb415940e0a90371027f65497952f215a89b
6
+ metadata.gz: 2b82f110ca83c57a33f9ba542d77623ab0eb66fa658f2df2f6346d72ed80d456352524b385b4ccabf2c51f5f7f8e2c4a66ddea213b8454148efc240274e375f7
7
+ data.tar.gz: c7288c6c4e8f32756a1334d2a94d7543c3172fe1f001715f88bba7fbc86b99e350b1290bbfbd7ea68ba464cb67e9e2ec25cc361c2c1e91a3450310000d73060b
@@ -0,0 +1,41 @@
1
+ name: Ruby CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-version: ['2.6.10', '2.7.8']
11
+ # ruby-version: ['2.6.10', '2.7.8', '3.0.6', '3.1.4', '3.2.2']
12
+ gemfile: ['Gemfile']
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v2
17
+
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ bundler: 2.4.17
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ sudo apt-get update
27
+ sudo groupadd clamav
28
+ sudo useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav
29
+ sudo apt-get install -y clamav
30
+ sudo systemctl stop clamav-freshclam
31
+ sudo pkill freshclam || true
32
+ sudo freshclam
33
+
34
+ - name: Install Gems
35
+ run: |
36
+ gem install rake
37
+ gem install rspec
38
+ bundle install --jobs 4 --retry 3
39
+
40
+ - name: Run tests
41
+ run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v1.6.10
2
+ - Moved from Travis CI to GitHub Actions
3
+
4
+ # v1.6.9
5
+ - [AndreasRonnqvistCytiva](https://github.com/kobaltz/clamby/commits?author=AndreasRonnqvistCytiva) - Allow reload option #44
6
+
1
7
  # v1.6.8
2
8
  - [codezomb](https://github.com/kobaltz/clamby/commits?author=codezomb) - Allow paths to be escaped #37
3
9
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ![Clamby Logo](https://raw.github.com/kobaltz/clamby/master/clamby_logo.png)
2
2
 
3
3
  [![GemVersion](https://badge.fury.io/rb/clamby.png)](https://badge.fury.io/rb/clamby.png)
4
- [![Build Status](https://travis-ci.org/kobaltz/clamby.svg?branch=master)](https://travis-ci.org/kobaltz/clamby)
4
+ [![Ruby CI](https://github.com/kobaltz/clamby/actions/workflows/ruby-ci.yml/badge.svg)](https://github.com/kobaltz/clamby/actions/workflows/ruby-ci.yml)
5
5
 
6
6
  This gem depends on the [clamscan](http://www.clamav.net/) and `freshclam` daemons to be installed already.
7
7
 
@@ -66,7 +66,7 @@ It's good to note that Clamby will not by default delete files which had a virus
66
66
 
67
67
  ## with ActiveStorage
68
68
 
69
- With ActiveStorage, you don't have access to the file through normal methods, so you'll have to access the file through the `attachment_changes`.
69
+ With ActiveStorage, you don't have access to the file through normal methods, so you'll have to access the file through the `attachment_changes`.
70
70
 
71
71
  ```ruby
72
72
  class User < ApplicationRecord
@@ -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,6 +21,7 @@ module Clamby
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]
@@ -1,3 +1,3 @@
1
1
  module Clamby
2
- VERSION = "1.6.8"
2
+ VERSION = "1.6.10"
3
3
  end
data/lib/clamby.rb CHANGED
@@ -14,6 +14,7 @@ module Clamby
14
14
  :error_file_virus => false,
15
15
  :fdpass => false,
16
16
  :stream => false,
17
+ :reload => false,
17
18
  :output_level => 'medium',
18
19
  :datadir => nil,
19
20
  :executable_path_clamscan => 'clamscan',
@@ -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
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
data/spec/spec_helper.rb CHANGED
@@ -13,7 +13,7 @@ RSpec.configure do |config|
13
13
  end
14
14
 
15
15
  def download(url)
16
- file = open(url)
16
+ file = URI.open(url)
17
17
  file.is_a?(StringIO) ? to_tempfile(file) : file
18
18
  end
19
19
 
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.8
4
+ version: 1.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaltz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2023-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,11 +61,10 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - ".github/workflows/ruby-ci.yml"
64
65
  - ".gitignore"
65
66
  - ".rspec"
66
- - ".travis.yml"
67
67
  - CHANGELOG.md
68
- - CODE_OF_CONDUCT.md
69
68
  - Gemfile
70
69
  - LICENSE.txt
71
70
  - README.md
@@ -83,7 +82,7 @@ files:
83
82
  - spec/fixtures/safe.txt
84
83
  - spec/spec_helper.rb
85
84
  - spec/support/shared_context.rb
86
- homepage: ''
85
+ homepage: https://github.com/kobaltz/clamby
87
86
  licenses:
88
87
  - MIT
89
88
  metadata: {}
@@ -102,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
101
  - !ruby/object:Gem::Version
103
102
  version: '0'
104
103
  requirements: []
105
- rubygems_version: 3.2.32
104
+ rubygems_version: 3.4.19
106
105
  signing_key:
107
106
  specification_version: 4
108
107
  summary: Scan file uploads with ClamAV
data/.travis.yml DELETED
@@ -1,19 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem install bundler -v '1.17.3'
4
- - gem install rake
5
- - gem install rspec
6
- rvm:
7
- - 2.3.4
8
- - 2.4.1
9
- - 2.5.3
10
- - 2.6.3
11
- - 2.6.5
12
- - 2.6.6
13
- - 2.7.2
14
- install:
15
- - sudo apt-get install clamav
16
- - sudo freshclam
17
-
18
- gemfile:
19
- - Gemfile
data/CODE_OF_CONDUCT.md DELETED
@@ -1,46 +0,0 @@
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/