rubocop-gitlab-security 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/rubocop/cop/gitlab-security/deep_munge.rb +2 -2
- data/lib/rubocop/cop/gitlab-security/json_serialization.rb +5 -5
- data/lib/rubocop/cop/gitlab-security/public_send.rb +1 -1
- data/lib/rubocop/cop/gitlab-security/redirect_to_params_update.rb +2 -2
- data/lib/rubocop/cop/gitlab-security/send_file_params.rb +3 -3
- data/lib/rubocop/cop/gitlab-security/sql_injection.rb +2 -2
- data/lib/rubocop/cop/gitlab-security/system_command_injection.rb +2 -2
- data/lib/rubocop/gitlab-security/hook.rb +1 -1
- data/lib/rubocop/gitlab-security/version.rb +1 -1
- data/rubocop-gitlab-security.gemspec +4 -6
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 418947a57b9293b3d1d3a11af563ff17249ae717
|
4
|
+
data.tar.gz: 79cfcb1bb7a3ef41e152a9539f7a98140de119b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95d9e45787487cd75eedbf0a333253fa93c89d9da7bc404ac459f0376cc118de697f922dbdac836683ab1c2714b0bb3c8a8c0bb668cd206ae61675302f975493
|
7
|
+
data.tar.gz: a176a812a0e0a6bb93ccc6aebe0f43e2b42ba39dfc329e4a75e8e097653b83eff9c98fca93d38fc90790d7b1a76e7aa9077d5b123cba42194e13f4208605821b
|
data/Gemfile
CHANGED
@@ -16,13 +16,13 @@ module RuboCop
|
|
16
16
|
MSG = 'Never disable the deep munge security option.'.freeze
|
17
17
|
|
18
18
|
def_node_matcher :disable_deep_munge?, <<-PATTERN
|
19
|
-
(send (send (send nil :config) :action_dispatch) :perform_deep_munge= (false))
|
19
|
+
(send (send (send nil? :config) :action_dispatch) :perform_deep_munge= (false))
|
20
20
|
PATTERN
|
21
21
|
|
22
22
|
def on_send(node)
|
23
23
|
return unless disable_deep_munge?(node)
|
24
24
|
|
25
|
-
add_offense(node, :selector)
|
25
|
+
add_offense(node, location: :selector)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -34,7 +34,7 @@ module RuboCop
|
|
34
34
|
# Check for `to_json` sent to any object that's not a Hash literal or
|
35
35
|
# Serializer instance
|
36
36
|
def_node_matcher :json_serialization?, <<~PATTERN
|
37
|
-
(send !{nil hash #serializer?} ${:to_json :as_json} $...)
|
37
|
+
(send !{nil? hash #serializer?} ${:to_json :as_json} $...)
|
38
38
|
PATTERN
|
39
39
|
|
40
40
|
# Check if node is a `only: ...` pair
|
@@ -54,7 +54,7 @@ module RuboCop
|
|
54
54
|
|
55
55
|
# Check for `SomeConstant.new`
|
56
56
|
def_node_search :constant_init, <<~PATTERN
|
57
|
-
(send (const nil $_) :new ...)
|
57
|
+
(send (const nil? $_) :new ...)
|
58
58
|
PATTERN
|
59
59
|
|
60
60
|
def on_send(node)
|
@@ -66,7 +66,7 @@ module RuboCop
|
|
66
66
|
|
67
67
|
if matched.last.nil? || matched.last.empty?
|
68
68
|
# Empty `to_json` call
|
69
|
-
add_offense(node, :selector, format_message)
|
69
|
+
add_offense(node, location: :selector, message: format_message)
|
70
70
|
else
|
71
71
|
check_arguments(node, matched)
|
72
72
|
end
|
@@ -98,7 +98,7 @@ module RuboCop
|
|
98
98
|
# Add a top-level offense for the entire argument list, but only if
|
99
99
|
# we haven't yet added any offenses to the child Hash values (such
|
100
100
|
# as `include`)
|
101
|
-
add_offense(node.children.last, :expression, format_message)
|
101
|
+
add_offense(node.children.last, location: :expression, message: format_message)
|
102
102
|
end
|
103
103
|
|
104
104
|
def check_pair(pair)
|
@@ -110,7 +110,7 @@ module RuboCop
|
|
110
110
|
includes.each_child_node do |child_node|
|
111
111
|
next if contains_only?(child_node)
|
112
112
|
|
113
|
-
add_offense(child_node, :expression, format_message)
|
113
|
+
add_offense(child_node, location: :expression, message: format_message)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -17,13 +17,13 @@ module RuboCop
|
|
17
17
|
MSG = 'Avoid using redirect_to(params.update()). Only pass whitelisted arguments into redirect_to() (e.g. not including `host`)'.freeze
|
18
18
|
|
19
19
|
def_node_matcher :redirect_to_params_update_node, <<-PATTERN
|
20
|
-
(send nil :redirect_to (send (send nil :params) ${:update :merge} ...))
|
20
|
+
(send nil :redirect_to (send (send nil? :params) ${:update :merge} ...))
|
21
21
|
PATTERN
|
22
22
|
|
23
23
|
def on_send(node)
|
24
24
|
return unless redirect_to_params_update_node(node)
|
25
25
|
|
26
|
-
add_offense(node, :selector)
|
26
|
+
add_offense(node, location: :selector)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -23,14 +23,14 @@ module RuboCop
|
|
23
23
|
this warning can be disabled using `#rubocop:disable GitlabSecurity/SendFileParams`'.freeze
|
24
24
|
|
25
25
|
def_node_search :params_node?, <<-PATTERN
|
26
|
-
(send (send nil :params) ... )
|
26
|
+
(send (send nil? :params) ... )
|
27
27
|
PATTERN
|
28
28
|
|
29
29
|
def on_send(node)
|
30
30
|
return unless node.command?(:send_file)
|
31
|
-
return unless node.
|
31
|
+
return unless node.arguments.any? { |e| params_node?(e) }
|
32
32
|
|
33
|
-
add_offense(node, :selector)
|
33
|
+
add_offense(node, location: :selector)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -28,9 +28,9 @@ module RuboCop
|
|
28
28
|
|
29
29
|
def on_send(node)
|
30
30
|
return unless where_user_input?(node)
|
31
|
-
return unless node.
|
31
|
+
return unless node.arguments.any? { |e| string_var_string?(e) }
|
32
32
|
|
33
|
-
add_offense(node, :selector)
|
33
|
+
add_offense(node, location: :selector)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -25,9 +25,9 @@ module RuboCop
|
|
25
25
|
|
26
26
|
def on_send(node)
|
27
27
|
return unless node.command?(:system)
|
28
|
-
return unless node.
|
28
|
+
return unless node.arguments.any? { |e| system_var?(e) }
|
29
29
|
|
30
|
-
add_offense(node, :selector)
|
30
|
+
add_offense(node, location: :selector)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,15 +1,13 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
2
|
require 'rubocop/gitlab-security/version'
|
5
3
|
|
6
4
|
Gem::Specification.new do |spec|
|
7
5
|
spec.name = 'rubocop-gitlab-security'
|
8
6
|
spec.summary = 'Basic security checks for projects'
|
9
|
-
spec.description =
|
7
|
+
spec.description = <<~DESCRIPTION
|
10
8
|
Basic security checking for Ruby files.
|
11
9
|
A plugin for the RuboCop code style enforcing & linting tool.
|
12
|
-
|
10
|
+
DESCRIPTION
|
13
11
|
spec.homepage = 'https://gitlab.com/gitlab-org/rubocop-gitlab-security/'
|
14
12
|
spec.authors = ['Brian Neel']
|
15
13
|
spec.email = [
|
@@ -19,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
19
17
|
|
20
18
|
spec.version = RuboCop::GitlabSecurity::Version::STRING
|
21
19
|
spec.platform = Gem::Platform::RUBY
|
22
|
-
spec.required_ruby_version = '>= 2.
|
20
|
+
spec.required_ruby_version = '>= 2.3.0'
|
23
21
|
|
24
22
|
spec.require_paths = ['lib']
|
25
23
|
spec.files = Dir[
|
@@ -30,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
30
28
|
]
|
31
29
|
spec.extra_rdoc_files = ['MIT-LICENSE.md', 'README.md']
|
32
30
|
|
33
|
-
spec.add_runtime_dependency 'rubocop', '>= 0.
|
31
|
+
spec.add_runtime_dependency 'rubocop', '>= 0.51'
|
34
32
|
|
35
33
|
spec.add_development_dependency 'rake'
|
36
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-gitlab-security
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Neel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.51'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.51'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,9 +38,9 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: |
|
42
|
-
|
43
|
-
|
41
|
+
description: |
|
42
|
+
Basic security checking for Ruby files.
|
43
|
+
A plugin for the RuboCop code style enforcing & linting tool.
|
44
44
|
email:
|
45
45
|
- brian@gitlab.com
|
46
46
|
executables: []
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
requirements:
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 2.
|
93
|
+
version: 2.3.0
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.6.11
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Basic security checks for projects
|