newrelic_rpm 3.18.0.329 → 3.18.1.330

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
  SHA1:
3
- metadata.gz: 3c1e2869b811ed3b76c7a71c8386d238e53fef6b
4
- data.tar.gz: cdd29e0fce09cca5e0c72d07a2471b33ffe57282
3
+ metadata.gz: aea433d0e5dddee05b76a21d682702ef9b6858e1
4
+ data.tar.gz: f9bd9e91d487865e5d33630eda81c49cadb29757
5
5
  SHA512:
6
- metadata.gz: 1207f33db770af8824c989fea1658d55ac2a9e1630f2fea50044a498908257e6d51081aaecaae94f09a8238ceba070b7b3744026f390c98e377b688a2c59c3ea
7
- data.tar.gz: 61ee001c5fc41aabfdb89b3ba741bfc9a37eb3b74bb8b16ef1e374f918dd3baba9ab1308e968c38c89b146a1720af347324e808031f968f365f16135cfc4b7c2
6
+ metadata.gz: 41eb55392a0eb008ef66bd77979e15cd45617536cbe81e331a36cf86a1f1606301250bb538b2b48049b057818116e90bc8e5bf5d1c4d191c4225b240bc99d506
7
+ data.tar.gz: 537960507a71710172aaa29442595c172559921fe7ee8c4c071a1f864e7f7e4917042c10442decd3a169008abf3ebce2755d1432c418eab519d1e7c3ae7ed9b8
@@ -1,5 +1,20 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v3.18.1 ##
4
+
5
+ * Ensure Mongo aggregate queries are properly obfuscated
6
+
7
+ Instrumentation for the Mongo 2.x driver had a bug where the `pipeline`
8
+ attribute of Mongo aggregate queries was not properly obfuscated. Users
9
+ who have sensitive data in their `aggregate` queries are strongly encouraged
10
+ to upgrade to this version of the agent. Users who are unable to upgrade are
11
+ encouraged to turn off query collection using by setting
12
+ `mongo.capture_queries` to false in their newrelic.yml files.
13
+
14
+ * Early access Redis 4.0 instrumentation
15
+
16
+ Our Redis instrumentation has been tested against Redis 4.0.0.rc1.
17
+
3
18
  ## v3.18.0 ##
4
19
 
5
20
  * Ruby 2.4.0 support
@@ -10,7 +10,7 @@ module NewRelic
10
10
  module EventFormatter
11
11
 
12
12
  # Keys that will get their values replaced with '?'.
13
- OBFUSCATE_KEYS = [ 'filter', 'query' ].freeze
13
+ OBFUSCATE_KEYS = [ 'filter', 'query', 'pipeline' ].freeze
14
14
 
15
15
  # Keys that will get completely removed from the statement.
16
16
  BLACKLISTED_KEYS = [ 'deletes', 'documents', 'updates' ].freeze
@@ -11,25 +11,30 @@ module NewRelic
11
11
  WHITELIST = [:operation].freeze
12
12
 
13
13
  def self.obfuscate_statement(source, whitelist = WHITELIST)
14
- obfuscated = {}
15
- source.each do |key, value|
16
- if whitelist.include?(key)
17
- obfuscated[key] = value
18
- else
19
- obfuscated[key] = obfuscate_value(value, whitelist)
14
+ if source.is_a? Hash
15
+ obfuscated = {}
16
+ source.each do |key, value|
17
+ if whitelist.include?(key)
18
+ obfuscated[key] = value
19
+ else
20
+ obfuscated[key] = obfuscate_value(value, whitelist)
21
+ end
20
22
  end
23
+ obfuscated
24
+ else
25
+ obfuscate_value(source, whitelist)
21
26
  end
22
-
23
- obfuscated
24
27
  end
25
28
 
29
+ QUESTION_MARK = '?'.freeze
30
+
26
31
  def self.obfuscate_value(value, whitelist = WHITELIST)
27
32
  if value.is_a?(Hash)
28
33
  obfuscate_statement(value, whitelist)
29
34
  elsif value.is_a?(Array)
30
35
  value.map {|v| obfuscate_value(v, whitelist)}
31
36
  else
32
- '?'
37
+ QUESTION_MARK
33
38
  end
34
39
  end
35
40
  end
@@ -12,7 +12,7 @@ module NewRelic
12
12
 
13
13
  MAJOR = 3
14
14
  MINOR = 18
15
- TINY = 0
15
+ TINY = 1
16
16
 
17
17
  begin
18
18
  require File.join(File.dirname(__FILE__), 'build')
@@ -12,12 +12,11 @@ else
12
12
  end
13
13
 
14
14
  gem 'rack-test'
15
- gem 'json', '< 2.0.0' if RUBY_VERSION == "1.8.7"
15
+ gem 'json', '< 1.8.5' if RUBY_VERSION == "1.8.7"
16
16
 
17
17
  platforms :rbx do
18
18
  gem "rubysl"
19
19
  gem "rubysl-test-unit"
20
- gem "json", '< 2.0.0'
21
20
  gem "psych"
22
21
  gem "racc" # https://github.com/rubinius/rubinius/issues/2632
23
22
  end
@@ -24,7 +24,8 @@ gem 'hometown', '~> 0.2.5'
24
24
 
25
25
  if RUBY_VERSION < '1.9'
26
26
  gem 'git', '< 1.3' # git 1.3.0 requires Ruby version >= 1.9
27
- gem 'json_pure', '< 2.0'
27
+ gem 'json_pure', '< 1.8.5'
28
+ gem 'json', '< 1.8.5'
28
29
  gem 'rdoc', '4.2.0'
29
30
  end
30
31
 
@@ -25,7 +25,8 @@ gem 'hometown', '~> 0.2.5'
25
25
 
26
26
  if RUBY_VERSION < '1.9'
27
27
  gem 'git', '< 1.3' # git 1.3.0 requires Ruby version >= 1.9
28
- gem 'json_pure', '< 2.0'
28
+ gem 'json_pure', '< 1.8.5'
29
+ gem 'json', '< 1.8.5'
29
30
  gem 'rdoc', '4.2.0'
30
31
  end
31
32
 
@@ -7,6 +7,7 @@ gem 'minitest', '~>4.7.5'
7
7
  gem 'mocha', :require => false
8
8
  gem 'rack', '< 2.0.0'
9
9
  gem 'rack-test'
10
+ gem 'json', '< 1.8.5' if RUBY_VERSION == "1.8.7"
10
11
 
11
12
  if RUBY_VERSION < '2.0'
12
13
  gem 'rdoc', '4.2.0'
@@ -7,6 +7,7 @@ gem 'minitest', '~>4.7.5'
7
7
  gem 'mocha', :require => false
8
8
  gem 'rack', '< 2.0.0'
9
9
  gem 'rack-test'
10
+ gem 'json', '< 1.8.5' if RUBY_VERSION == "1.8.7"
10
11
 
11
12
  gem 'newrelic_rpm', :path => '../../..'
12
13
 
@@ -8,6 +8,7 @@ gem 'minitest', '~>4.7.5'
8
8
  gem 'mocha', :require => false
9
9
  gem 'rack', '< 2.0.0'
10
10
  gem 'rack-test'
11
+ gem 'json', '< 1.8.5' if RUBY_VERSION == "1.8.7"
11
12
 
12
13
  gem 'newrelic_rpm', :path => '../../..'
13
14
 
@@ -8,6 +8,7 @@ gem 'minitest', '~>4.7.5'
8
8
  gem 'mocha', :require => false
9
9
  gem 'rack', '< 2.0.0'
10
10
  gem 'rack-test'
11
+ gem 'json', '< 1.8.5' if RUBY_VERSION == "1.8.7"
11
12
 
12
13
  gem "newrelic_rpm", :path => "../../.."
13
14
 
@@ -177,7 +177,7 @@ module Multiverse
177
177
  f.puts minitest_line unless gemfile_text =~ /^\s*gem .minitest[^_]./
178
178
  f.puts rake_line unless gemfile_text =~ /^\s*gem .rake[^_]./ || suite == 'rake'
179
179
  if RUBY_VERSION == "1.8.7"
180
- f.puts "gem 'json', '< 2.0.0'" unless gemfile_text =~ /^\s.*gem .json./
180
+ f.puts "gem 'json', '< 1.8.5'" unless gemfile_text =~ /^\s.*gem .json./
181
181
  end
182
182
 
183
183
  rbx_gemfile_lines(f, gemfile_text)
@@ -297,6 +297,8 @@ module Multiverse
297
297
  case
298
298
  when RUBY_VERSION >= '2.4'
299
299
  '~> 2.0.2'
300
+ when RUBY_VERSION == '1.8.7'
301
+ '< 1.8.5'
300
302
  else
301
303
  '< 2.0.0'
302
304
  end
@@ -11,7 +11,6 @@ adapter_gems = <<-RB
11
11
  RB
12
12
 
13
13
  gemfile <<-RB
14
- gem 'json', '>= 1.8.1'
15
14
  gem 'datamapper', '~> 1.2.0', :require => 'data_mapper'
16
15
  gem 'dm-ar-finders', '~> 1.2.0'
17
16
  gem 'addressable', '2.3.8', :require => 'addressable/uri' # addressable >= 2.4.0 does not support Ruby 1.8.7
@@ -1,5 +1,5 @@
1
1
  after_2_0_0 = [ '~> 2.0.2' ]
2
- before_2_4_0 = [ '~> 1.8.1' ]
2
+ before_2_4_0 = [ '< 1.8.5' ]
3
3
  before_2_2_0 = [ '~> 1.7.7', '~> 1.6.8', '~> 1.5.5' ]
4
4
  before_2_0_0 = [ '~> 1.4.6', '~> 1.2.4', '~> 1.1.9' ]
5
5
  before_1_9_2 = [ '1.1.2' ]
@@ -24,7 +24,7 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
24
24
  @collection_name = "tribbles-#{SecureRandom.hex(16)}"
25
25
  @collection = @database.collection(@collection_name)
26
26
 
27
- @tribbles = [{'name' => 'soterios johnson'}, {'name' => 'wes mantooth'}]
27
+ @tribbles = [{'name' => 'soterios johnson', 'count' => 1}, {'name' => 'wes mantooth', 'count' => 2}]
28
28
 
29
29
  NewRelic::Agent::Transaction.stubs(:recording_web_transaction?).returns(true)
30
30
  NewRelic::Agent.drop_buffered_data
@@ -205,6 +205,54 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
205
205
  assert_metrics_recorded(expected)
206
206
  end
207
207
 
208
+ def test_records_metrics_for_aggregate
209
+ in_transaction do
210
+ @collection.aggregate([
211
+ {'$group' => {'_id' => "name", "max" => {'$max'=>"$count"}}},
212
+ {'$match' => {'max' => {'$gte' => 1}}}
213
+ ]).to_a
214
+ end
215
+
216
+ metrics = build_test_metrics(:aggregate, true)
217
+ expected = metrics_with_attributes(metrics)
218
+
219
+ assert_metrics_recorded(expected)
220
+ end
221
+
222
+ def test_aggregate_pipeline_obfuscated_by_default
223
+ in_transaction do
224
+ @collection.aggregate([
225
+ {'$group' => {'_id' => "name", "max" => {'$max'=>"$count"}}},
226
+ {'$match' => {'max' => {'$gte' => 1}}}
227
+ ]).to_a
228
+ end
229
+
230
+ sample = NewRelic::Agent.instance.transaction_sampler.last_sample
231
+ metric = "Datastore/statement/MongoDB/#{@collection_name}/aggregate"
232
+ node = find_node_with_name(sample, metric)
233
+
234
+ expected = [
235
+ {"$group"=>{"_id"=>"?", "max"=>{"$max"=>"?"}}},
236
+ {"$match"=>{"max"=>{"$gte"=>"?"}}}
237
+ ]
238
+
239
+ assert_equal expected, node[:statement]["pipeline"]
240
+ end
241
+
242
+ def test_filter_obfuscated_by_default
243
+ in_transaction do
244
+ @collection.find("name" => "Wes Mantooth", "count" => {"$gte" => 1}).to_a
245
+ end
246
+
247
+ sample = NewRelic::Agent.instance.transaction_sampler.last_sample
248
+ metric = "Datastore/statement/MongoDB/#{@collection_name}/find"
249
+ node = find_node_with_name(sample, metric)
250
+
251
+ expected = {"name"=>"?", "count"=>{"$gte"=>"?"}}
252
+
253
+ assert_equal expected, node[:statement]["filter"]
254
+ end
255
+
208
256
  def test_batched_queries
209
257
  25.times do |i|
210
258
  @collection.insert_one :name => "test-#{i}", :active => true
@@ -1,3 +1,10 @@
1
+ if RUBY_VERSION >= '2.1'
2
+ gemfile <<-RB
3
+ gem 'rack'
4
+ gem 'redis', '~>4.0.0.rc1'
5
+ RB
6
+ end
7
+
1
8
  gemfile <<-RB
2
9
  gem 'rack'
3
10
  gem 'redis', '~>3.2.1'
@@ -249,7 +249,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
249
249
 
250
250
  def test_records_hostname_on_tt_node_for_get_with_unix_domain_socket
251
251
  redis = Redis.new
252
- redis.client.stubs(:path).returns('/tmp/redis.sock')
252
+ redis.send(client).stubs(:path).returns('/tmp/redis.sock')
253
253
 
254
254
  in_transaction do
255
255
  redis.get("foo")
@@ -279,7 +279,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
279
279
 
280
280
  def test_records_hostname_on_tt_node_for_multi_with_unix_domain_socket
281
281
  redis = Redis.new
282
- redis.client.stubs(:path).returns('/tmp/redis.sock')
282
+ redis.send(client).stubs(:path).returns('/tmp/redis.sock')
283
283
 
284
284
  in_transaction do
285
285
  redis.multi do
@@ -296,7 +296,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
296
296
 
297
297
  def test_records_unknown_unknown_metric_when_error_gathering_instance_data
298
298
  redis = Redis.new
299
- redis.client.stubs(:path).raises StandardError.new
299
+ redis.send(client).stubs(:path).raises StandardError.new
300
300
  in_transaction do
301
301
  redis.get("foo")
302
302
  end
@@ -319,5 +319,13 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
319
319
  assert_equal ['bar', 'bat'], @redis.pipelined { @redis.get('foo'); @redis.get('baz') }
320
320
  assert_equal 2, @redis.del('foo', 'baz')
321
321
  end
322
+
323
+ def client
324
+ if NewRelic::VersionNumber.new(Redis::VERSION).major_version < 4
325
+ :client
326
+ else
327
+ :_client
328
+ end
329
+ end
322
330
  end
323
331
  end
@@ -56,6 +56,14 @@ module NewRelic
56
56
  "deletes" => [{ :q => { :_id => { "$gt" => 1 }}, :limit => 1 }]
57
57
  }.freeze
58
58
 
59
+ AGGREGATE_COMMAND = {
60
+ "aggregate"=>"tribbles",
61
+ "pipeline"=>[
62
+ {"$group"=> {"_id"=>"name", "max"=>{"$max"=>"$count"}}},
63
+ {"$match"=>{"max"=>{"$gte"=>1}}}
64
+ ]
65
+ }
66
+
59
67
  if RUBY_VERSION > "1.9.3"
60
68
 
61
69
  def test_doesnt_modify_incoming_statement
@@ -146,6 +154,22 @@ module NewRelic
146
154
  formatted = EventFormatter.format(:delete, DATABASE, DELETE_COMMAND)
147
155
  assert_equal expected, formatted
148
156
  end
157
+
158
+ def test_event_formatter_obfuscates_pipeline
159
+ expected = {
160
+ :operation => :aggregate,
161
+ :database => DATABASE,
162
+ :collection => "tribbles",
163
+ "aggregate" => "tribbles",
164
+ "pipeline" => [
165
+ {"$group" => {"_id" => "?", "max" => {"$max" => "?"}}},
166
+ {"$match" => {"max" => {"$gte" => "?"}}}
167
+ ]
168
+ }
169
+
170
+ formatted = EventFormatter.format(:aggregate, DATABASE, AGGREGATE_COMMAND)
171
+ assert_equal expected, formatted
172
+ end
149
173
  end
150
174
  end
151
175
  end
@@ -69,6 +69,14 @@ module NewRelic
69
69
  assert_equal expected, obfuscated
70
70
  end
71
71
 
72
+ def test_obfuscates_array_statement
73
+ statement = [{"$group"=>{:_id=>"$says", :total=>{"$sum"=>1}}}]
74
+ expected = [{"$group"=>{:_id=>"?", :total=>{"$sum"=>"?"}}}]
75
+
76
+ obfuscated = Obfuscator.obfuscate_statement(statement)
77
+ assert_equal expected, obfuscated
78
+ end
79
+
72
80
  def test_obfuscate_nested_arrays
73
81
  selector = {
74
82
  "aggregate" => "mongeese",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.0.329
4
+ version: 3.18.1.330
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Krajcar
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-01-10 00:00:00.000000000 Z
14
+ date: 2017-02-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake