paraxial 0.9.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be68560342effbc4099f126d85e25acf0400e0b27dc636f4173192a9a634d3da
4
- data.tar.gz: 489450bae67581a1738754843a8ce3b6128ad098aa88228d1823bf41ce0ebada
3
+ metadata.gz: 51de7f085eec9d82f197fbad24ff3f18554f3faf16218a6fcbc0181815b9eb92
4
+ data.tar.gz: 577e903cbdb3a2730b47fb0078046c9e808737dac5b7538e2b02dd7d02a46db1
5
5
  SHA512:
6
- metadata.gz: edd5307bcc69fcff116b2873d5571b035808f76bf508447403da5a1064d7faea2d230ceb12f0e6318469815b18d23254a6b4adf914b6c0bca009ac807f35d8fd
7
- data.tar.gz: f473320f53f772245dad48f68edeb47271ebe22e921b73b6cfe74506b6e5ccc8925ebf6621f2a4a46f0b6f9c2282c9580f498572f85dc6214fe21359d59dcc52
6
+ metadata.gz: d77946aedb02e58860ce5be2c651acf438e77189c4349f0847e5a5fb32f560b366d31b376f66f880bc2e52c8cee37cfbd2a62f80a72c900a5923c7353a915abe
7
+ data.tar.gz: 3cf38d2d6726f074f7fc38898942030c820d51338109549ce73f2f832ab41d9f703026019ef1e9f8f7e68ad2ed8d4426a561ad34fa2f805fb1481eb5cd3b686c
@@ -130,21 +130,25 @@ module Paraxial
130
130
  end
131
131
 
132
132
  def self.ban_ip_msg(ip, length, msg)
133
- local_ban(ip)
134
-
135
- uri = URI.parse(Paraxial::Helpers.get_ruby_ban_url)
136
- body =
137
- {
138
- bad_ip: ip,
139
- ban_length: length,
140
- msg: msg,
141
- api_key: Paraxial::Helpers.get_api_key
142
- }
143
- r = Net::HTTP.post(uri, body.to_json, @headers)
144
- if r.code == '200'
145
- :ok
133
+ if allow_ip?(ip) == true
134
+ local_ban(ip)
135
+
136
+ uri = URI.parse(Paraxial::Helpers.get_ruby_ban_url)
137
+ body =
138
+ {
139
+ bad_ip: ip,
140
+ ban_length: length,
141
+ msg: msg,
142
+ api_key: Paraxial::Helpers.get_api_key
143
+ }
144
+ r = Net::HTTP.post(uri, body.to_json, @headers)
145
+ if r.code == '200'
146
+ :ok
147
+ else
148
+ :error
149
+ end
146
150
  else
147
- :error
151
+ :already_banned
148
152
  end
149
153
  end
150
154
 
data/lib/paraxial/cli.rb CHANGED
@@ -15,6 +15,7 @@ module Paraxial
15
15
  option :repo_owner, type: :string, desc: 'Repository owner'
16
16
  option :repo_name, type: :string, desc: 'Repository name'
17
17
  option :pr_number, type: :numeric, desc: 'Pull request number'
18
+ option :exit_code, type: :boolean, default: false, desc: 'Non-zero exit code if findings > 0'
18
19
 
19
20
  def scan
20
21
  puts '[Paraxial] Scan starting...'
@@ -27,7 +28,6 @@ module Paraxial
27
28
  puts '- rubocop-erb'
28
29
  end
29
30
 
30
-
31
31
  if Paraxial::Helpers.get_api_key.nil?
32
32
  puts '[Paraxial] Environment variable PARAXIAL_API_KEY not found'
33
33
  else
@@ -36,6 +36,7 @@ module Paraxial
36
36
  repo_owner = options[:repo_owner]
37
37
  repo_name = options[:repo_name]
38
38
  pr_number = options[:pr_number]
39
+ exit_code = options[:exit_code]
39
40
 
40
41
  cops = 'Paraxial,Security/Eval,Security/IoMethods,Security/JSONLoad,Security/MarshalLoad,Security/Open,Security/YAMLLoad'
41
42
  rubocop = `rubocop --require paraxial --only #{cops} --disable-pending-cops --format json`
@@ -95,6 +96,10 @@ module Paraxial
95
96
  else
96
97
  :ok
97
98
  end
99
+
100
+ if exit_code and (findings.length > 0)
101
+ exit(1)
102
+ end
98
103
  end
99
104
  end
100
105
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paraxial
4
- VERSION = '0.9.1'
4
+ VERSION = '1.0.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paraxial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Lubas