paraxial 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paraxial/checker.rb +18 -14
- data/lib/paraxial/cli.rb +6 -1
- data/lib/paraxial/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51de7f085eec9d82f197fbad24ff3f18554f3faf16218a6fcbc0181815b9eb92
|
4
|
+
data.tar.gz: 577e903cbdb3a2730b47fb0078046c9e808737dac5b7538e2b02dd7d02a46db1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d77946aedb02e58860ce5be2c651acf438e77189c4349f0847e5a5fb32f560b366d31b376f66f880bc2e52c8cee37cfbd2a62f80a72c900a5923c7353a915abe
|
7
|
+
data.tar.gz: 3cf38d2d6726f074f7fc38898942030c820d51338109549ce73f2f832ab41d9f703026019ef1e9f8f7e68ad2ed8d4426a561ad34fa2f805fb1481eb5cd3b686c
|
data/lib/paraxial/checker.rb
CHANGED
@@ -130,21 +130,25 @@ module Paraxial
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def self.ban_ip_msg(ip, length, msg)
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
-
:
|
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
|
|
data/lib/paraxial/version.rb
CHANGED