rollbar 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.5.2
4
+
5
+ Bug fixes:
6
+
7
+ - Use ACCEPT header to check json requests. See [#328](https://github.com/rollbar/rollbar-gem/pull/333)
8
+ - Fix URL scrubbing when using a malformed URL. See [#328](https://github.com/rollbar/rollbar-gem/pull/332)
9
+
3
10
  ## 2.5.1
4
11
 
5
12
  Bug fix:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.5.1)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.5.2)](https://travis-ci.org/rollbar/rollbar-gem/branches)
2
2
 
3
3
  <!-- RemoveNext -->
4
4
  [Rollbar](https://rollbar.com) is an error tracking service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
@@ -12,7 +12,7 @@ This is the Ruby library for Rollbar. It will instrument many kinds of Ruby appl
12
12
  Add this line to your application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'rollbar', '~> 2.5.1'
15
+ gem 'rollbar', '~> 2.5.2'
16
16
  ```
17
17
 
18
18
  If you are not using JRuby we suggest using [Oj](https://github.com/ohler55/oj) for JSON serialization. In order to install Oj you can add this line to your Gemfile:
@@ -15,3 +15,5 @@ gem "rubinius-developer_tools", :platform => :rbx
15
15
  gem "rails", "3.2.22"
16
16
 
17
17
  gemspec :path => "../"
18
+
19
+ gem 'debugger'
@@ -137,7 +137,7 @@ module Rollbar
137
137
  correct_method = rack_req.post? || rack_req.put? || rack_req.patch?
138
138
 
139
139
  return {} unless correct_method
140
- return {} unless rack_req.env['CONTENT_TYPE'] =~ %r{application/json}i
140
+ return {} unless json_request?(rack_req)
141
141
 
142
142
  Rollbar::JSON.load(rack_req.body.read)
143
143
  rescue
@@ -146,6 +146,11 @@ module Rollbar
146
146
  rack_req.body.rewind
147
147
  end
148
148
 
149
+ def json_request?(rack_req)
150
+ !!(rack_req.env['CONTENT_TYPE'] =~ %r{application/json} ||
151
+ rack_req.env['ACCEPT'] =~ /\bjson\b/)
152
+ end
153
+
149
154
  def rollbar_request_params(env)
150
155
  env['action_dispatch.request.parameters'] || {}
151
156
  end
@@ -28,6 +28,8 @@ module Rollbar
28
28
  uri.query = filter_query(uri.query)
29
29
 
30
30
  uri.to_s
31
+ rescue
32
+ url
31
33
  end
32
34
 
33
35
  private
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
@@ -388,6 +388,18 @@ describe HomeController do
388
388
  end
389
389
  end
390
390
 
391
+ context 'with json ACCEPT header', :type => 'request' do
392
+ let(:params) { { :foo => :bar } }
393
+
394
+ it 'parses the correct headers' do
395
+ expect do
396
+ post '/cause_exception', params, { 'ACCEPT' => 'application/vnd.github.v3+json' }
397
+ end.to raise_exception
398
+
399
+ expect(Rollbar.last_report[:request][:params]['foo']).to be_eql('bar')
400
+ end
401
+ end
402
+
391
403
  context 'with params to be scrubed from URL', :type => :request do
392
404
  next unless Rollbar::LanguageSupport.can_scrub_url?
393
405
 
@@ -4,7 +4,7 @@ Dummy::Application.routes.draw do
4
4
  member { post :start_session }
5
5
  end
6
6
 
7
- get '/cause_exception' => 'home#cause_exception'
7
+ match '/cause_exception' => 'home#cause_exception', :via => [:get, :post]
8
8
  put '/deprecated_report_exception' => 'home#deprecated_report_exception'
9
9
  match '/report_exception' => 'home#report_exception',
10
10
  :via => [:get, :post, :put]
@@ -144,13 +144,21 @@ describe Rollbar::Middleware::Sinatra, :reconfigure_notifier => true do
144
144
  }
145
145
  end
146
146
 
147
- it 'appear in the sent payload' do
147
+ it 'appears in the sent payload when application/json is the content type' do
148
148
  expect do
149
149
  post '/crash_post', params.to_json, { 'CONTENT_TYPE' => 'application/json' }
150
150
  end.to raise_error(exception)
151
151
 
152
152
  expect(Rollbar.last_report[:request][:params]).to be_eql(params)
153
153
  end
154
+
155
+ it 'appears in the sent payload when the accepts header contains json' do
156
+ expect do
157
+ post '/crash_post', params, { 'ACCEPT' => 'application/vnd.github.v3+json' }
158
+ end.to raise_error(exception)
159
+
160
+ expect(Rollbar.last_report[:request][:params]).to be_eql(params)
161
+ end
154
162
  end
155
163
 
156
164
  it 'resets the notifier in every request' do
@@ -98,6 +98,14 @@ describe Rollbar::Scrubbers::URL do
98
98
  expect(subject.call(url)).to match(expected_url)
99
99
  end
100
100
  end
101
+
102
+ context 'with malformed URL or not able to be parsed' do
103
+ let(:url) { '\this\is\not\a\valid\url' }
104
+
105
+ it 'return the same url' do
106
+ expect(subject.call(url)).to be_eql(url)
107
+ end
108
+ end
101
109
  end
102
110
  end
103
111
  end
metadata CHANGED
@@ -1,209 +1,238 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Rollbar, Inc.
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
12
+ date: 2015-11-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 3.0.0
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 3.0.0
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rspec-rails
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 2.14.0
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: 2.14.0
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: database_cleaner
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - "~>"
51
+ - - ~>
46
52
  - !ruby/object:Gem::Version
47
53
  version: 1.0.0
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - "~>"
59
+ - - ~>
53
60
  - !ruby/object:Gem::Version
54
61
  version: 1.0.0
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: girl_friday
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - ">="
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: 0.11.1
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - ">="
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: 0.11.1
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: sucker_punch
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - ">="
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: 1.0.0
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - ">="
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: 1.0.0
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: sidekiq
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - ">="
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: 2.13.0
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - ">="
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: 2.13.0
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: genspec
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - ">="
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: 0.2.8
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - ">="
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: 0.2.8
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: sinatra
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - ">="
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: '0'
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - ">="
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: '0'
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: resque
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - ">="
147
+ - - ! '>='
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - ">="
155
+ - - ! '>='
137
156
  - !ruby/object:Gem::Version
138
157
  version: '0'
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: delayed_job
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
- - - ">="
163
+ - - ! '>='
144
164
  - !ruby/object:Gem::Version
145
165
  version: '0'
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - ">="
171
+ - - ! '>='
151
172
  - !ruby/object:Gem::Version
152
173
  version: '0'
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: rake
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
- - - ">="
179
+ - - ! '>='
158
180
  - !ruby/object:Gem::Version
159
181
  version: 0.9.0
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
- - - ">="
187
+ - - ! '>='
165
188
  - !ruby/object:Gem::Version
166
189
  version: 0.9.0
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: redis
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
- - - ">="
195
+ - - ! '>='
172
196
  - !ruby/object:Gem::Version
173
197
  version: '0'
174
198
  type: :development
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
- - - ">="
203
+ - - ! '>='
179
204
  - !ruby/object:Gem::Version
180
205
  version: '0'
181
206
  - !ruby/object:Gem::Dependency
182
207
  name: multi_json
183
208
  requirement: !ruby/object:Gem::Requirement
209
+ none: false
184
210
  requirements:
185
- - - ">="
211
+ - - ! '>='
186
212
  - !ruby/object:Gem::Version
187
213
  version: '0'
188
214
  type: :runtime
189
215
  prerelease: false
190
216
  version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
191
218
  requirements:
192
- - - ">="
219
+ - - ! '>='
193
220
  - !ruby/object:Gem::Version
194
221
  version: '0'
195
222
  - !ruby/object:Gem::Dependency
196
223
  name: oj
197
224
  requirement: !ruby/object:Gem::Requirement
225
+ none: false
198
226
  requirements:
199
- - - "~>"
227
+ - - ~>
200
228
  - !ruby/object:Gem::Version
201
229
  version: 2.12.14
202
230
  type: :development
203
231
  prerelease: false
204
232
  version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
205
234
  requirements:
206
- - - "~>"
235
+ - - ~>
207
236
  - !ruby/object:Gem::Version
208
237
  version: 2.12.14
209
238
  description: Easy and powerful exception tracking for Ruby
@@ -214,8 +243,8 @@ executables:
214
243
  extensions: []
215
244
  extra_rdoc_files: []
216
245
  files:
217
- - ".gitignore"
218
- - ".travis.yml"
246
+ - .gitignore
247
+ - .travis.yml
219
248
  - Appraisals
220
249
  - CHANGELOG.md
221
250
  - Gemfile
@@ -383,26 +412,27 @@ files:
383
412
  homepage: https://rollbar.com
384
413
  licenses:
385
414
  - MIT
386
- metadata: {}
387
415
  post_install_message:
388
416
  rdoc_options: []
389
417
  require_paths:
390
418
  - lib
391
419
  required_ruby_version: !ruby/object:Gem::Requirement
420
+ none: false
392
421
  requirements:
393
- - - ">="
422
+ - - ! '>='
394
423
  - !ruby/object:Gem::Version
395
424
  version: '0'
396
425
  required_rubygems_version: !ruby/object:Gem::Requirement
426
+ none: false
397
427
  requirements:
398
- - - ">="
428
+ - - ! '>='
399
429
  - !ruby/object:Gem::Version
400
430
  version: '0'
401
431
  requirements: []
402
432
  rubyforge_project:
403
- rubygems_version: 2.4.5
433
+ rubygems_version: 1.8.23
404
434
  signing_key:
405
- specification_version: 4
435
+ specification_version: 3
406
436
  summary: Reports exceptions to Rollbar
407
437
  test_files:
408
438
  - spec/cacert.pem
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 624449078b1bb27b9cc3823079379c16f911a436
4
- data.tar.gz: 9b8264e3a4b51ff029f9bc8911d0acc3611ba5a3
5
- SHA512:
6
- metadata.gz: 4703b2a859825b5b23f682e9e0b3d5e784c1e3f0448e31716d254a1b8ef39295f456b630dfc94589bf866e96101e7a1b9883e7ec0a20caa466a92190de001686
7
- data.tar.gz: ebe79ef4941d4bcc616e4c353c2eff00c19e049128357fe6245f3d451cad2d7e52f6cd335a5b6bea3285924073738f509726f2735ce78847b3ebd0479325c2f4