brakeman-lib 4.8.0 → 4.8.1

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: 34099e8abef9a4c7108905ea8d956d01afbb6037cab597d2ad0beab8790a9060
4
- data.tar.gz: 982be6bfad0eef60f17627001fef1873bad5a23eef76f687ea434d23773ba9b4
3
+ metadata.gz: a2e421e421971f6309de15b50d5305a37acf839e4023cd5b976cfb644f62b635
4
+ data.tar.gz: cb219b5f4cac1dd286e88b6048dd675adb062be8d273d960364f830ed3fa9493
5
5
  SHA512:
6
- metadata.gz: ce68529ca660b85d86b9569b4f8ddfe41c4b7b3bc724d1afc9860f91fa0a945eb473bbd5bb83b4c9d8e61ac6255ab0b11a42878921671a03a0964d2440912178
7
- data.tar.gz: 1fbd104e129d5fce136d4c4984296a7daa6c88ffd8f22edbb576613cb6519547676f38364a2f728dcc2c9a322119d0024ae845baf7383ecf38b43038e9e129c6
6
+ metadata.gz: b7f76e5da87ef345f47de2a8c489e94f07ba5892a5ab796d9cc5ad147036d599d273d1b339e126ed4f6288efd1b6bfa3a77201787afbcbf83b0279acb6a57459
7
+ data.tar.gz: 1544f86037df9fd49e3674c7bd39b4eec1f1e41378078a6077647506f7ba257db4aaa48191df5b8c11c736bc44ac054fc0e96e6b67d21e155977a2f8b7ce44f0
data/CHANGES.md CHANGED
@@ -1,4 +1,11 @@
1
- # Unreleased
1
+ # 4.8.1 - 2020-04-06
2
+
3
+ * Check SQL query strings using `String#strip` or `String.squish`
4
+ * Handle non-symbol keys in locals hash for render()
5
+ * Warn about global(!) mass assignment
6
+ * Index calls in render arguments
7
+
8
+ # 4.8.0 - 2020-02-18
2
9
 
3
10
  * Add JUnit-XML report format (Naoki Kimura)
4
11
  * Sort ignore files by fingerprint and line (Ngan Pham)
data/README.md CHANGED
@@ -74,12 +74,16 @@ To specify an output file for the results:
74
74
 
75
75
  brakeman -o output_file
76
76
 
77
- The output format is determined by the file extension or by using the `-f` option. Current options are: `text`, `html`, `tabs`, `json`, `markdown`, `csv`, and `codeclimate`.
77
+ The output format is determined by the file extension or by using the `-f` option. Current options are: `text`, `html`, `tabs`, `json`, `junit`, `markdown`, `csv`, and `codeclimate`.
78
78
 
79
79
  Multiple output files can be specified:
80
80
 
81
81
  brakeman -o output.html -o output.json
82
82
 
83
+ To output to both a file and to the console, with color:
84
+
85
+ brakeman --color -o /dev/stdout -o output.json
86
+
83
87
  To suppress informational warnings and just output the report:
84
88
 
85
89
  brakeman -q
@@ -167,6 +171,8 @@ There is a [plugin available](http://brakemanscanner.org/docs/jenkins/) for Jenk
167
171
 
168
172
  For even more continuous testing, try the [Guard plugin](https://github.com/guard/guard-brakeman).
169
173
 
174
+ There are a couple [Github Actions](https://github.com/marketplace?type=actions&query=brakeman) available.
175
+
170
176
  # Building
171
177
 
172
178
  git clone git://github.com/presidentbeef/brakeman.git
@@ -17,6 +17,7 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
17
17
  def run_check
18
18
  check_mass_assignment
19
19
  check_permit!
20
+ check_permit_all_parameters
20
21
  end
21
22
 
22
23
  def find_mass_assign_calls
@@ -193,4 +194,18 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
193
194
  :message => "Parameters should be whitelisted for mass assignment",
194
195
  :confidence => confidence
195
196
  end
197
+
198
+ def check_permit_all_parameters
199
+ tracker.find_call(target: :"ActionController::Parameters", method: :permit_all_parameters=).each do |result|
200
+ call = result[:call]
201
+
202
+ if true? call.first_arg
203
+ warn :result => result,
204
+ :warning_type => "Mass Assignment",
205
+ :warning_code => :mass_assign_permit_all,
206
+ :message => "Parameters should be whitelisted for mass assignment",
207
+ :confidence => :high
208
+ end
209
+ end
210
+ end
196
211
  end
@@ -393,7 +393,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
393
393
  nil
394
394
  end
395
395
 
396
- TO_STRING_METHODS = [:to_s, :strip_heredoc]
396
+ TO_STRING_METHODS = [:to_s, :squish, :strip, :strip_heredoc]
397
397
 
398
398
  #Returns value if interpolated value is not something safe
399
399
  def unsafe_string_interp? exp
@@ -89,7 +89,7 @@ class Brakeman::FindAllCalls < Brakeman::BasicProcessor
89
89
  #Calls to render() are converted to s(:render, ...) but we would
90
90
  #like them in the call cache still for speed
91
91
  def process_render exp
92
- process exp.last if sexp? exp.last
92
+ process_all exp
93
93
 
94
94
  add_simple_call :render, exp
95
95
 
@@ -98,7 +98,9 @@ module Brakeman::RenderHelper
98
98
 
99
99
  if hash? options[:locals]
100
100
  hash_iterate options[:locals] do |key, value|
101
- template_env[Sexp.new(:call, nil, key.value)] = value
101
+ if symbol? key
102
+ template_env[Sexp.new(:call, nil, key.value)] = value
103
+ end
102
104
  end
103
105
  end
104
106
 
@@ -1,3 +1,3 @@
1
1
  module Brakeman
2
- Version = "4.8.0"
2
+ Version = "4.8.1"
3
3
  end
@@ -113,6 +113,7 @@ module Brakeman::WarningCodes
113
113
  :force_ssl_disabled => 109,
114
114
  :unsafe_cookie_serialization => 110,
115
115
  :reverse_tabnabbing => 111,
116
+ :mass_assign_permit_all => 112,
116
117
  :custom_check => 9090,
117
118
  }
118
119
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brakeman-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.0
4
+ version: 4.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Collins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2020-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -406,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
406
406
  - !ruby/object:Gem::Version
407
407
  version: '0'
408
408
  requirements: []
409
- rubygems_version: 3.1.2
409
+ rubygems_version: 3.0.8
410
410
  signing_key:
411
411
  specification_version: 4
412
412
  summary: Security vulnerability scanner for Ruby on Rails.