Skip to content

Commit 54acb0d

Browse files
authored
Release v6.27.1
2 parents cf63309 + b19ea1a commit 54acb0d

File tree

24 files changed

+171
-72
lines changed

24 files changed

+171
-72
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

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+
413
## v6.27.0 (23 May 2024)
514

615
### Enhancements

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.27.0
1+
6.27.1

features/fixtures/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ services:
8888
- BUGSNAG_API_KEY
8989
- BUGSNAG_ENDPOINT
9090
- BUGSNAG_METADATA_FILTERS
91+
- BUGSNAG_RACK_NO_REWIND
9192
restart: "no"
9293
ports:
9394
- target: 3000

features/fixtures/rack/app/Gemfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ gem 'webrick' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('3.0.0')
66

77
# Some functionality provided by Rack was moved to the 'rackup' gem in Rack v3
88
# Specifically the test app uses Rack::Server, which is now Rackup::Server
9-
if ENV['RACK_VERSION'] == '3'
10-
gem 'rackup', '~> 0.2.3'
11-
end
9+
gem 'rackup' if ENV['RACK_VERSION'] >= '3'

features/fixtures/rack/app/app.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ def call(env)
7171
end
7272
end
7373

74+
app = Bugsnag::Rack.new(BugsnagTests.new)
75+
7476
Server =
7577
if defined?(Rack::Server)
7678
Rack::Server
7779
else
7880
require 'rackup'
81+
82+
app = Rack::RewindableInput::Middleware.new(app) unless ENV["BUGSNAG_RACK_NO_REWIND"] == "true"
83+
7984
Rackup::Server
8085
end
8186

82-
Server.start(app: Bugsnag::Rack.new(BugsnagTests.new), Host: '0.0.0.0', Port: 3000)
87+
Server.start(app: app, Host: '0.0.0.0', Port: 3000)

features/rack.feature

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ Scenario: A POST request with form data sends a report with the parsed request b
6464
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
6565
And the event "metaData.request.params.a" equals "123"
6666
And the event "metaData.request.params.b" equals "456"
67+
And the event "metaData.request.params.name" equals "baba"
68+
And the event "metaData.request.params.favourite_letter" equals "z"
69+
And the event "metaData.request.params.password" equals "[FILTERED]"
6770
And the event "metaData.request.referer" is null
6871
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
6972

@@ -86,6 +89,9 @@ Scenario: A POST request with JSON sends a report with the parsed request body a
8689
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
8790
And the event "metaData.request.params.a" equals "123"
8891
And the event "metaData.request.params.b" equals "456"
92+
And the event "metaData.request.params.name" is null
93+
And the event "metaData.request.params.favourite_letter" is null
94+
And the event "metaData.request.params.password" is null
8995
And the event "metaData.request.referer" is null
9096
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
9197

@@ -172,3 +178,55 @@ Scenario: clearing feature flags for an unhandled error
172178
And I wait to receive an error
173179
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
174180
And the event has no feature flags
181+
182+
@not-rack-1
183+
@not-rack-2
184+
Scenario: An unrewindable POST request with form data does not attach request body
185+
Given I set environment variable "BUGSNAG_RACK_NO_REWIND" to "true"
186+
And I start the rack service
187+
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following form data:
188+
| name | baba |
189+
| favourite_letter | z |
190+
| password | password1 |
191+
And I wait to receive an error
192+
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
193+
And the event "metaData.request.body" is null
194+
And the event "metaData.request.clientIp" is not null
195+
And the event "metaData.request.cookies" is null
196+
And the event "metaData.request.headers.Host" is not null
197+
And the event "metaData.request.headers.User-Agent" is not null
198+
And the event "metaData.request.httpMethod" equals "POST"
199+
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
200+
And the event "metaData.request.params.a" equals "123"
201+
And the event "metaData.request.params.b" equals "456"
202+
And the event "metaData.request.params.name" is null
203+
And the event "metaData.request.params.favourite_letter" is null
204+
And the event "metaData.request.params.password" is null
205+
And the event "metaData.request.referer" is null
206+
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
207+
208+
@not-rack-1
209+
@not-rack-2
210+
Scenario: An unrewindable POST request with JSON does not attach request body
211+
Given I set environment variable "BUGSNAG_RACK_NO_REWIND" to "true"
212+
And I start the rack service
213+
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following JSON:
214+
| name | baba |
215+
| favourite_letter | z |
216+
| password | password1 |
217+
And I wait to receive an error
218+
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
219+
And the event "metaData.request.body" is null
220+
And the event "metaData.request.clientIp" is not null
221+
And the event "metaData.request.cookies" is null
222+
And the event "metaData.request.headers.Host" is not null
223+
And the event "metaData.request.headers.User-Agent" is not null
224+
And the event "metaData.request.httpMethod" equals "POST"
225+
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
226+
And the event "metaData.request.params.a" equals "123"
227+
And the event "metaData.request.params.b" equals "456"
228+
And the event "metaData.request.params.name" is null
229+
And the event "metaData.request.params.favourite_letter" is null
230+
And the event "metaData.request.params.password" is null
231+
And the event "metaData.request.referer" is null
232+
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"

features/support/env.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ def current_ip
6363
Maze::Runner.environment["BUGSNAG_ENDPOINT"] = "http://#{host}:#{Maze.config.port}/notify"
6464
Maze::Runner.environment["BUGSNAG_SESSION_ENDPOINT"] = "http://#{host}:#{Maze.config.port}/sessions"
6565
end
66+
67+
Before("@not-rack-1") do
68+
skip_this_scenario if ENV["RACK_VERSION"] == "1"
69+
end
70+
71+
Before("@not-rack-2") do
72+
skip_this_scenario if ENV["RACK_VERSION"] == "2"
73+
end

lib/bugsnag.rb

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
require "rubygems"
22
require "thread"
3+
require "set"
4+
require "json"
5+
require "uri"
6+
require "socket"
7+
require "logger"
38

49
require "bugsnag/version"
510
require "bugsnag/utility/feature_data_store"
@@ -21,21 +26,9 @@
2126
# as it doesn't auto-configure when loaded
2227
require "bugsnag/integrations/rack"
2328

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-
3529
require "bugsnag/breadcrumb_type"
3630
require "bugsnag/breadcrumbs/validator"
3731
require "bugsnag/breadcrumbs/breadcrumb"
38-
require "bugsnag/breadcrumbs/breadcrumbs"
3932

4033
require "bugsnag/utility/duplicator"
4134
require "bugsnag/utility/metadata_delegate"

lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require "set"
2-
31
module Bugsnag::Breadcrumbs
42
class OnBreadcrumbCallbackList
53
def initialize(configuration)

lib/bugsnag/breadcrumbs/validator.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'bugsnag/breadcrumbs/breadcrumbs'
2-
31
module Bugsnag::Breadcrumbs
42
##
53
# Validates a given breadcrumb before it is stored

0 commit comments

Comments
 (0)