bugsnag 6.27.0 → 6.27.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: f2c3cbc7d3aee2477dd5ae66758ea1b76bde5bfd156ce68b35a555de5d82638d
4
- data.tar.gz: 5c093940afd91f221ff636beeea9cb16b855504ff9081a8c8eefee59ec30754c
3
+ metadata.gz: 7f8eb06e59bf516cfc5ca7f5539ae3b0fdbd9c4ea86a82252d6c2ea787a7c255
4
+ data.tar.gz: 01be8584412260118dfb14548808e1c4c4444aadd040bbbd6c6ad5dee3da1dbc
5
5
  SHA512:
6
- metadata.gz: de4dcfb6fc4688d52ea058d5f82ad31906abd2f54d65b4170646f0a7c06b69d4d39a3e0aee8a35a3dddde4e86a8529e7e425993e52b76f48299e0126f25ff48e
7
- data.tar.gz: 4dbf3896e89cc1cab18928d54145034d0db68cfd41d9e362310f66235982151f2e9672a1df34cc024c294d0426c88a9a2a593d84c726fc7311a6b6ebb23026da
6
+ metadata.gz: bebc3030e22bbc50423792c701185d061b0d7834c6a741c805cafa6223753e941cd893a73c65792b8726fc6adf9f9c47ea30715c14381f5a2ac87c52d345ba98
7
+ data.tar.gz: 1923948f57cc1f032eaf249912d6f5e65423c853bc2cffe89b1b198aead96bc34303aa3aec95f9699911176579cbee14797e805986f24aff2834458413dc5066
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v6.27.1 (18 June 2024)
5
+
6
+ ### Fixes
7
+
8
+ * Only read Rack request body if it's rewindable
9
+ | [#829](https://github.com/bugsnag/bugsnag-ruby/pull/829)
10
+ * Fix circular require warning
11
+ | [#828](https://github.com/bugsnag/bugsnag-ruby/pull/828)
12
+
4
13
  ## v6.27.0 (23 May 2024)
5
14
 
6
15
  ### Enhancements
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.27.0
1
+ 6.27.1
@@ -1,5 +1,3 @@
1
- require "set"
2
-
3
1
  module Bugsnag::Breadcrumbs
4
2
  class OnBreadcrumbCallbackList
5
3
  def initialize(configuration)
@@ -1,5 +1,3 @@
1
- require 'bugsnag/breadcrumbs/breadcrumbs'
2
-
3
1
  module Bugsnag::Breadcrumbs
4
2
  ##
5
3
  # Validates a given breadcrumb before it is stored
@@ -1,5 +1,3 @@
1
- require 'uri'
2
-
3
1
  module Bugsnag
4
2
  # @api private
5
3
  class Cleaner
@@ -1,20 +1,28 @@
1
- require "set"
2
- require "socket"
3
- require "logger"
4
- require "bugsnag/middleware_stack"
1
+ require "bugsnag/breadcrumbs/on_breadcrumb_callback_list"
2
+
3
+ require "bugsnag/endpoint_configuration"
4
+ require "bugsnag/endpoint_validator"
5
+
6
+ require "bugsnag/middleware/breadcrumbs"
5
7
  require "bugsnag/middleware/callbacks"
8
+ require "bugsnag/middleware/classify_error"
9
+ require "bugsnag/middleware/clearance_user"
10
+ require "bugsnag/middleware/delayed_job"
6
11
  require "bugsnag/middleware/discard_error_class"
7
12
  require "bugsnag/middleware/exception_meta_data"
8
13
  require "bugsnag/middleware/ignore_error_class"
9
- require "bugsnag/middleware/suggestion_data"
10
- require "bugsnag/middleware/classify_error"
14
+ require "bugsnag/middleware/mailman"
15
+ require "bugsnag/middleware/rack_request"
16
+ require "bugsnag/middleware/rails3_request"
17
+ require "bugsnag/middleware/rake"
11
18
  require "bugsnag/middleware/session_data"
12
- require "bugsnag/middleware/breadcrumbs"
19
+ require "bugsnag/middleware/sidekiq"
20
+ require "bugsnag/middleware/suggestion_data"
21
+ require "bugsnag/middleware/warden_user"
22
+
23
+ require "bugsnag/middleware_stack"
24
+
13
25
  require "bugsnag/utility/circular_buffer"
14
- require "bugsnag/breadcrumbs/breadcrumbs"
15
- require "bugsnag/breadcrumbs/on_breadcrumb_callback_list"
16
- require "bugsnag/endpoint_configuration"
17
- require "bugsnag/endpoint_validator"
18
26
 
19
27
  module Bugsnag
20
28
  class Configuration
@@ -1,5 +1,4 @@
1
1
  require "net/https"
2
- require "uri"
3
2
 
4
3
  module Bugsnag
5
4
  module Delivery
@@ -1,5 +1,3 @@
1
- require "thread"
2
-
3
1
  module Bugsnag
4
2
  module Delivery
5
3
  class ThreadQueue < Synchronous
data/lib/bugsnag/event.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "bugsnag/report"
2
-
3
1
  module Bugsnag
4
2
  # For now Event is just an alias of Report. This points to the same object so
5
3
  # any changes to Report will also affect Event
@@ -1,8 +1,3 @@
1
- require 'uri'
2
- require 'set'
3
- require 'json'
4
-
5
-
6
1
  module Bugsnag
7
2
  module Helpers # rubocop:todo Metrics/ModuleLength
8
3
  MAX_STRING_LENGTH = 3072
@@ -1,5 +1,4 @@
1
1
  require 'mongo'
2
- require 'bugsnag/breadcrumbs/breadcrumbs'
3
2
 
4
3
  module Bugsnag
5
4
  ##
@@ -1,5 +1,3 @@
1
- require 'set'
2
-
3
1
  module Bugsnag::Rails
4
2
  module ActiveJob
5
3
  SEVERITY = 'error'
@@ -1,5 +1,3 @@
1
- require "bugsnag/breadcrumbs/breadcrumbs"
2
-
3
1
  module Bugsnag::Rails
4
2
  DEFAULT_RAILS_BREADCRUMBS = [
5
3
  {
@@ -1,10 +1,6 @@
1
1
  # Rails 3.x hooks
2
2
 
3
- require "json"
4
3
  require "rails"
5
- require "bugsnag"
6
- require "bugsnag/middleware/rails3_request"
7
- require "bugsnag/middleware/rack_request"
8
4
  require "bugsnag/integrations/rails/rails_breadcrumbs"
9
5
 
10
6
  module Bugsnag
@@ -1,4 +1,7 @@
1
- require 'bugsnag'
1
+ # this file can either be required manually by a user, in which case 'bugsnag'
2
+ # needs to be required, or it can be required automatically in the railtie,
3
+ # in which case 'bugsnag' has already been required
4
+ require 'bugsnag' unless defined?(Bugsnag)
2
5
 
3
6
  Rake::TaskManager.record_task_metadata = true
4
7
 
@@ -1,5 +1,3 @@
1
- require "json"
2
-
3
1
  module Bugsnag::Middleware
4
2
  ##
5
3
  # Extracts and attaches rack data to an error report
@@ -17,7 +15,15 @@ module Bugsnag::Middleware
17
15
 
18
16
  request = ::Rack::Request.new(env)
19
17
 
20
- params = request.params rescue {}
18
+ params =
19
+ # if the request body isn't rewindable then we can't read request.POST
20
+ # which is used internally by request.params
21
+ if request.body.respond_to?(:rewind)
22
+ request.params rescue {}
23
+ else
24
+ request.GET rescue {}
25
+ end
26
+
21
27
  client_ip = request.ip.to_s rescue SPOOF
22
28
  session = env["rack.session"]
23
29
 
@@ -106,7 +112,11 @@ module Bugsnag::Middleware
106
112
  end
107
113
 
108
114
  def add_request_body(report, request, env)
109
- body = parsed_request_body(request, env)
115
+ begin
116
+ body = parsed_request_body(request, env)
117
+ rescue StandardError
118
+ return nil
119
+ end
110
120
 
111
121
  # this request may not have a body
112
122
  return unless body.is_a?(Hash) && !body.empty?
@@ -115,26 +125,34 @@ module Bugsnag::Middleware
115
125
  end
116
126
 
117
127
  def parsed_request_body(request, env)
118
- return request.POST rescue nil if request.form_data?
128
+ # if the request is not rewindable then either:
129
+ # - it's been read already and so is impossible to read
130
+ # - it hasn't been read yet and us reading it will prevent the user from
131
+ # reading it themselves
132
+ # in either case we should avoid attempting to
133
+ return nil unless request.body.respond_to?(:rewind)
134
+
135
+ if request.form_data?
136
+ begin
137
+ return request.POST
138
+ ensure
139
+ request.body.rewind
140
+ end
141
+ end
119
142
 
120
143
  content_type = env["CONTENT_TYPE"]
121
144
 
122
145
  return nil if content_type.nil?
146
+ return nil unless content_type.include?('/json') || content_type.include?('+json')
123
147
 
124
- if content_type.include?('/json') || content_type.include?('+json')
125
- begin
126
- body = request.body
148
+ begin
149
+ body = request.body
127
150
 
128
- return JSON.parse(body.read)
129
- rescue StandardError
130
- return nil
131
- ensure
132
- # the body must be rewound so other things can read it after we do
133
- body.rewind
134
- end
151
+ JSON.parse(body.read)
152
+ ensure
153
+ # the body must be rewound so other things can read it after we do
154
+ body.rewind
135
155
  end
136
-
137
- nil
138
156
  end
139
157
 
140
158
  def add_cookies(report, request)
@@ -1,4 +1,3 @@
1
- require "json"
2
1
  require "pathname"
3
2
  require "bugsnag/error"
4
3
  require "bugsnag/stacktrace"
data/lib/bugsnag.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  require "rubygems"
2
2
  require "thread"
3
+ require "set"
4
+ require "json"
5
+ require "uri"
6
+ require "socket"
7
+ require "logger"
3
8
 
4
9
  require "bugsnag/version"
5
10
  require "bugsnag/utility/feature_data_store"
@@ -21,21 +26,9 @@ require "bugsnag/feature_flag"
21
26
  # as it doesn't auto-configure when loaded
22
27
  require "bugsnag/integrations/rack"
23
28
 
24
- require "bugsnag/middleware/rack_request"
25
- require "bugsnag/middleware/warden_user"
26
- require "bugsnag/middleware/clearance_user"
27
- require "bugsnag/middleware/callbacks"
28
- require "bugsnag/middleware/rails3_request"
29
- require "bugsnag/middleware/sidekiq"
30
- require "bugsnag/middleware/mailman"
31
- require "bugsnag/middleware/rake"
32
- require "bugsnag/middleware/classify_error"
33
- require "bugsnag/middleware/delayed_job"
34
-
35
29
  require "bugsnag/breadcrumb_type"
36
30
  require "bugsnag/breadcrumbs/validator"
37
31
  require "bugsnag/breadcrumbs/breadcrumb"
38
- require "bugsnag/breadcrumbs/breadcrumbs"
39
32
 
40
33
  require "bugsnag/utility/duplicator"
41
34
  require "bugsnag/utility/metadata_delegate"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.27.0
4
+ version: 6.27.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-23 00:00:00.000000000 Z
11
+ date: 2024-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -107,7 +107,7 @@ homepage: https://github.com/bugsnag/bugsnag-ruby
107
107
  licenses:
108
108
  - MIT
109
109
  metadata:
110
- changelog_uri: https://github.com/bugsnag/bugsnag-ruby/blob/v6.27.0/CHANGELOG.md
110
+ changelog_uri: https://github.com/bugsnag/bugsnag-ruby/blob/v6.27.1/CHANGELOG.md
111
111
  documentation_uri: https://docs.bugsnag.com/platforms/ruby/
112
112
  source_code_uri: https://github.com/bugsnag/bugsnag-ruby/
113
113
  rubygems_mfa_required: 'true'