opbeat 3.0.10 → 3.0.11

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
  SHA1:
3
- metadata.gz: 7fe06da9948bd4b055bbbd4a2cdfd9fb65ea47df
4
- data.tar.gz: 03c5ef6ef57c78a97c11008a00bf2b669840448f
3
+ metadata.gz: db912bc5fa2bac6f5cf53c5dd625948771535c17
4
+ data.tar.gz: b71746960e7ad4cf3f028fe4862ce195d170821c
5
5
  SHA512:
6
- metadata.gz: 3d0c1f9114d890b1cd2ffc4d901c69b0e2670eb4b49ebb7cc636bc0007cb687db67758148bef69b7c8b2793f38522ec936663bfcb01879c73576013070ea5834
7
- data.tar.gz: 6bc4bcd743a8d3bcb439d2d3f3b185967f6f90b27b40c07f98e47f023491940a16359a3422674325fe1136545981c42d226f514b776a0b6c3930083790db0168
6
+ metadata.gz: 98d4cc3c08c7c821cfbcb8e78378defbc8b52443dfd52270ad1220a317b82bec57ddc8c1a9e7eadc491bba14cc16cae497aae19da7ae7dbdd442f2840dbca68d
7
+ data.tar.gz: 595b034fb2c2e294d13da6e5f392708377af9e6331f508ea0b48b9c9074f9f834ed5119f8e25faeb38b410b28e8ef6554962d960b6da70e480126f794f35f41e
@@ -7,7 +7,8 @@ rvm:
7
7
  - 2.0.0
8
8
  - 2.1.6
9
9
  - 2.2.3
10
- - 2.3.1
10
+ - 2.3.3
11
+ - 2.4.0
11
12
  gemfile:
12
13
  - gemfiles/Gemfile.rails-3.2.x
13
14
  - gemfiles/Gemfile.rails-4.0.x
@@ -16,7 +17,7 @@ gemfile:
16
17
  - gemfiles/Gemfile.rails-5.0.x
17
18
  matrix:
18
19
  include:
19
- - rvm: 2.3.1
20
+ - rvm: 2.3.3
20
21
  gemfile: gemfiles/Gemfile.rails-HEAD
21
22
 
22
23
  exclude:
@@ -24,6 +25,14 @@ matrix:
24
25
  gemfile: gemfiles/Gemfile.rails-5.0.x
25
26
  - rvm: 2.1.6
26
27
  gemfile: gemfiles/Gemfile.rails-5.0.x
28
+ - rvm: 2.4.0
29
+ gemfile: gemfiles/Gemfile.rails-3.2.x
30
+ - rvm: 2.4.0
31
+ gemfile: gemfiles/Gemfile.rails-4.0.x
32
+ - rvm: 2.4.0
33
+ gemfile: gemfiles/Gemfile.rails-4.1.x
34
+ - rvm: 2.4.0
35
+ gemfile: gemfiles/Gemfile.rails-4.2.x
27
36
 
28
37
  notifications:
29
38
  email: false
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 3.0.11
2
+
3
+ - Fix parameter filtering with symbols (#37 [@simitt](https://github.com/simitt))
4
+
1
5
  # 3.0.10
2
6
 
3
7
  - Fix Sinatra with `config.disable_performance` (#44 [@skogsmaskin](https://github.com/skogsmaskin))
data/README.md CHANGED
@@ -121,7 +121,7 @@ To enable Opbeat for [resque](https://github.com/resque/resque), add the followi
121
121
  require "resque/failure/multiple"
122
122
  require "opbeat/integration/resque"
123
123
 
124
- Resque::Failure::Multiple.classes = [Resque::Failure::Opbeat]
124
+ Resque::Failure::Multiple.classes = [Opbeat::Integration::Resque]
125
125
  Resque::Failure.backend = Resque::Failure::Multiple
126
126
  ```
127
127
 
@@ -1,4 +1,5 @@
1
1
  eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
2
 
3
3
  gem 'rails', '~> 4.2.0'
4
+ gem 'nokogiri', '< 1.7'
4
5
  gem 'sinatra'
@@ -69,7 +69,7 @@ module Opbeat
69
69
 
70
70
  def validate!
71
71
  %w{app_id secret_token organization_id}.each do |key|
72
- raise Error.new("Configuration missing `#{key}'") unless self.send(key)
72
+ raise Error.new("Opbeat Configuration missing `#{key}'") unless self.send(key)
73
73
  end
74
74
 
75
75
  true
@@ -29,6 +29,7 @@ module Opbeat
29
29
  attr_reader :config
30
30
  attr_accessor :message
31
31
  attr_reader :timestamp
32
+ attr_reader :filter
32
33
  attr_accessor :level
33
34
  attr_accessor :logger
34
35
  attr_accessor :culprit
@@ -61,7 +62,7 @@ module Opbeat
61
62
  end
62
63
 
63
64
  if env = opts[:rack_env]
64
- error_message.http = HTTP.from_rack_env env, filter: @filter
65
+ error_message.http = HTTP.from_rack_env env, filter: error_message.filter
65
66
  error_message.user = User.from_rack_env config, env
66
67
  end
67
68
 
@@ -39,13 +39,7 @@ module Opbeat
39
39
  end
40
40
 
41
41
  def sanitize key, value
42
- return value unless value.is_a?(String)
43
-
44
- if should_filter?(key)
45
- return MASK
46
- end
47
-
48
- value
42
+ should_filter?(key) ? MASK : value
49
43
  end
50
44
 
51
45
  private
@@ -53,7 +47,7 @@ module Opbeat
53
47
  def should_filter? key
54
48
  @params.any? do |param|
55
49
  case param
56
- when String
50
+ when String, Symbol
57
51
  key.to_s == param.to_s
58
52
  when Regexp
59
53
  param.match(key)
@@ -1,3 +1,3 @@
1
1
  module Opbeat
2
- VERSION = "3.0.10"
2
+ VERSION = "3.0.11"
3
3
  end
@@ -6,6 +6,13 @@ module Opbeat
6
6
  it "has defaults" do
7
7
  conf = Configuration.new
8
8
  expect(conf.timeout).to be 100
9
+ expect(conf.filter_parameters).to eq [/(authorization|password|passwd|secret)/i]
10
+ end
11
+
12
+ it "overwrites defaults when config given" do
13
+ conf = Configuration.new(filter_parameters: [:secret])
14
+ expect(conf.timeout).to be 100
15
+ expect(conf.filter_parameters).to eq [:secret]
9
16
  end
10
17
 
11
18
  it "can initialize with a hash" do
@@ -56,6 +56,12 @@ module Opbeat
56
56
  expect(error.http.url).to eq 'http://example.org/'
57
57
  end
58
58
 
59
+ it "uses proper filter options" do
60
+ env = Rack::MockRequest.env_for '/nested/path?foo=bar&password=SECRET'
61
+ error = ErrorMessage.from_exception config, real_exception, rack_env: env
62
+ expect(error.http.query_string).to eq "foo=bar&password=[FILTERED]"
63
+ end
64
+
59
65
  class DummyController
60
66
  def current_user
61
67
  Struct.new(:id, :email, :username).new(1, 'john@example.com', 'leroy')
@@ -2,7 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  module Opbeat
4
4
  RSpec.describe Filter do
5
- let(:config) { Configuration.new filter_parameters: [/password/, 'passwd'] }
5
+ let(:config) do
6
+ Configuration.new filter_parameters: [/password/, 'pwd', :_secret, :int_secret, 'non_existing']
7
+ end
6
8
 
7
9
  subject do
8
10
  Filter.new config
@@ -10,13 +12,19 @@ module Opbeat
10
12
 
11
13
  describe "#apply" do
12
14
  it "filters a string" do
13
- filtered = subject.apply "password=SECRET&foo=bar"
14
- expect(filtered).to eq 'password=[FILTERED]&foo=bar'
15
+ data = "password=SECRET&foo=bar&_secret=abc&pwd=de1&int_secret=123"
16
+ filtered_data = "password=[FILTERED]&foo=bar&_secret=[FILTERED]&pwd=[FILTERED]&int_secret=[FILTERED]"
17
+ expect(subject.apply data).to eq filtered_data
15
18
  end
16
19
 
17
20
  it "filters a hash" do
18
- filtered = subject.apply({ passwd: 'SECRET' })
19
- expect(filtered).to eq({ passwd: '[FILTERED]' })
21
+ data = { password: 'SECRET', foo: :bar, _secret: 'abc', pwd: 'de1', int_secret: 123 }
22
+ filtered_data = { password: '[FILTERED]',
23
+ foo: :bar,
24
+ _secret: '[FILTERED]',
25
+ pwd: '[FILTERED]',
26
+ int_secret: '[FILTERED]'}
27
+ expect(subject.apply data).to eq filtered_data
20
28
  end
21
29
  end
22
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opbeat
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.10
4
+ version: 3.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  requirements: []
155
155
  rubyforge_project:
156
- rubygems_version: 2.5.1
156
+ rubygems_version: 2.5.2
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: The official Opbeat Ruby client library