Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v6.24.0 #706

Merged
merged 41 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a6c9307
Allow overriding the unhandled flag
imjoehaines Sep 17, 2021
9bc1f5d
Update changelog
imjoehaines Sep 21, 2021
dc40149
Merge pull request #698 from bugsnag/allow-unhandled-override
imjoehaines Sep 22, 2021
b2da768
Add Bugsnag::Utility::Duplicator
imjoehaines Sep 24, 2021
e622cc3
Add global metadata
imjoehaines Sep 23, 2021
63875e2
JRuby now includes 'new' in stacktraces
imjoehaines Sep 24, 2021
cff4f3f
Update changelog
imjoehaines Sep 27, 2021
d52a274
Merge pull request #699 from bugsnag/add-global-metadata
imjoehaines Sep 28, 2021
69db436
Add request body, cookies & protocol as metadata
imjoehaines Sep 28, 2021
cc25a42
Add tests for request body in Rack app
imjoehaines Sep 28, 2021
26ce3d9
Add tests for cookies in a Rack app
imjoehaines Sep 28, 2021
d641ad1
Update changelog
imjoehaines Sep 29, 2021
d4f93dd
Deprecate reading the request body from `params`
imjoehaines Sep 29, 2021
0b3c1c1
Merge pull request #700 from bugsnag/more-request-data
imjoehaines Sep 30, 2021
17ff7ed
Restrict Postgres image to v13
imjoehaines Oct 4, 2021
b3a7268
Merge pull request #702 from bugsnag/fix-que-tests
imjoehaines Oct 4, 2021
c23e18a
Add EndpointConfiguration class
imjoehaines Sep 30, 2021
d31ed01
Add validation for EndpointConfiguration
imjoehaines Sep 30, 2021
aa84d9f
Use the new endpoint configuration
imjoehaines Sep 30, 2021
46f9d7c
Disable sending events if endpoints are invalid
imjoehaines Sep 30, 2021
e6fa886
Update changelog
imjoehaines Sep 30, 2021
ef3c82e
Correct missing URL error messages
imjoehaines Oct 1, 2021
91be3a0
Merge pull request #701 from bugsnag/endpoint-configuration
imjoehaines Oct 4, 2021
50957b4
Add 'redacted_keys' to replace metadata filters
imjoehaines Oct 4, 2021
3be10d3
Add maze runner test for redacted keys
imjoehaines Oct 4, 2021
c899ace
Update changelog
imjoehaines Oct 4, 2021
f4b0151
Clear the current session between tests
imjoehaines Oct 4, 2021
3b26ec3
Add SessionTracker#pause_session & #resume_session
imjoehaines Oct 4, 2021
f2c5563
Add forwarding methods for pause/resume session
imjoehaines Oct 4, 2021
eddc747
Don't attach events to the session if it's paused
imjoehaines Oct 4, 2021
af1b904
Update changelog
imjoehaines Oct 5, 2021
358f381
Add negative checks to redacted_keys specs
imjoehaines Oct 5, 2021
383c808
Improve YARD doc for redacted_keys
imjoehaines Oct 5, 2021
6bc099f
Merge pull request #703 from bugsnag/add-redacted-keys
imjoehaines Oct 5, 2021
9595bbe
Merge branch 'pause-resume-sessions' into next
imjoehaines Oct 5, 2021
7d7c6d6
Add vendor_paths to replace vendor_path
imjoehaines Oct 5, 2021
48a6293
Update changelog
imjoehaines Oct 5, 2021
a04b13d
Clarify vendor_paths YARD doc
imjoehaines Oct 5, 2021
008a332
Merge pull request #705 from bugsnag/vendor-paths
imjoehaines Oct 6, 2021
2de1fe6
Bump version
imjoehaines Oct 6, 2021
291906f
Add version to changelog
imjoehaines Oct 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
Changelog
=========

## v6.24.0 (6 October 2021)

### Enhancements

* Allow overriding an event's unhandled flag
| [#698](https://github.com/bugsnag/bugsnag-ruby/pull/698)
* Add the ability to store metadata globally
| [#699](https://github.com/bugsnag/bugsnag-ruby/pull/699)
* Add `cookies`, `body` and `httpVersion` to the automatically captured request data for Rack apps
| [#700](https://github.com/bugsnag/bugsnag-ruby/pull/700)
* Add `Configuration#endpoints` for reading the notify and sessions endpoints and `Configuration#endpoints=` for setting them
| [#701](https://github.com/bugsnag/bugsnag-ruby/pull/701)
* Add `Configuration#redacted_keys`. This is like `meta_data_filters` but matches strings with case-insensitive equality, rather than matching based on inclusion
| [#703](https://github.com/bugsnag/bugsnag-ruby/pull/703)
* Allow pausing and resuming sessions, giving more control over the stability score
| [#704](https://github.com/bugsnag/bugsnag-ruby/pull/704)
* Add `Configuration#vendor_paths` to replace `Configuration#vendor_path`
| [#705](https://github.com/bugsnag/bugsnag-ruby/pull/705)

### Deprecated

* In the next major release, `params` will only contain query string parameters. Currently it also contains the request body for form data requests, but this is deprecated in favour of the new `body` property
* The `Configuration#set_endpoints` method is now deprecated in favour of `Configuration#endpoints=`
* The `Configuration#meta_data_filters` option is now deprecated in favour of `Configuration#redacted_keys`
* The `Configuration#vendor_path` option is now deprecated in favour of `Configuration#vendor_paths`

## v6.23.0 (21 September 2021)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.23.0
6.24.0
5 changes: 4 additions & 1 deletion features/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
image: redis

postgres:
image: postgres
image: postgres:13
environment:
- POSTGRES_PASSWORD=test_password

Expand Down Expand Up @@ -35,6 +35,7 @@ services:
- BUGSNAG_PROXY_PASSWORD
- BUGSNAG_PROXY_PORT
- BUGSNAG_PROXY_USER
- BUGSNAG_REDACTED_KEYS
- BUGSNAG_RELEASE_STAGE
- BUGSNAG_SEND_CODE
- BUGSNAG_SEND_ENVIRONMENT
Expand Down Expand Up @@ -85,6 +86,7 @@ services:
environment:
- BUGSNAG_API_KEY
- BUGSNAG_ENDPOINT
- BUGSNAG_METADATA_FILTERS
restart: "no"

rack2:
Expand All @@ -95,6 +97,7 @@ services:
environment:
- BUGSNAG_API_KEY
- BUGSNAG_ENDPOINT
- BUGSNAG_METADATA_FILTERS
restart: "no"

rails3:
Expand Down
1 change: 1 addition & 0 deletions features/fixtures/plain/app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def configure_using_environment
conf.proxy_password = ENV["BUGSNAG_PROXY_PASSWORD"] if ENV.include? "BUGSNAG_PROXY_PASSWORD"
conf.proxy_port = ENV["BUGSNAG_PROXY_PORT"] if ENV.include? "BUGSNAG_PROXY_PORT"
conf.proxy_user = ENV["BUGSNAG_PROXY_USER"] if ENV.include? "BUGSNAG_PROXY_USER"
conf.redacted_keys << ENV["BUGSNAG_REDACTED_KEYS"] if ENV.include? "BUGSNAG_REDACTED_KEYS"
conf.send_environment = ENV["BUGSNAG_SEND_ENVIRONMENT"] != "false"
conf.send_code = ENV["BUGSNAG_SEND_CODE"] != "false"
conf.timeout = ENV["BUGSNAG_TIMEOUT"] if ENV.include? "BUGSNAG_TIMEOUT"
Expand Down
7 changes: 5 additions & 2 deletions features/fixtures/rack1/app/app.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require 'bugsnag'
require 'rack'
require 'json'

Bugsnag.configure do |config|
puts "Configuring `api_key` to #{ENV['BUGSNAG_API_KEY']}"
config.api_key = ENV['BUGSNAG_API_KEY']
puts "Configuring `endpoint` to #{ENV['BUGSNAG_ENDPOINT']}"
config.endpoint = ENV['BUGSNAG_ENDPOINT']

if ENV.key?('BUGSNAG_METADATA_FILTERS')
config.meta_data_filters = JSON.parse(ENV['BUGSNAG_METADATA_FILTERS'])
end
end

class BugsnagTests
Expand Down
7 changes: 5 additions & 2 deletions features/fixtures/rack2/app/app.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require 'bugsnag'
require 'rack'
require 'json'

Bugsnag.configure do |config|
puts "Configuring `api_key` to #{ENV['BUGSNAG_API_KEY']}"
config.api_key = ENV['BUGSNAG_API_KEY']
puts "Configuring `endpoint` to #{ENV['BUGSNAG_ENDPOINT']}"
config.endpoint = ENV['BUGSNAG_ENDPOINT']

if ENV.key?('BUGSNAG_METADATA_FILTERS')
config.meta_data_filters = JSON.parse(ENV['BUGSNAG_METADATA_FILTERS'])
end
end

class BugsnagTests
Expand Down
7 changes: 7 additions & 0 deletions features/plain_features/filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ Scenario: Additional filters can be added to the filter list
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "metaData.filter.filter_me" equals "[FILTERED]"

Scenario: Redacted keys can also be used to filter sensitive data
Given I set environment variable "BUGSNAG_REDACTED_KEYS" to "filter_me"
When I run the service "plain-ruby" with the command "bundle exec ruby filters/additional_filters.rb"
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "metaData.filter.filter_me" equals "[FILTERED]"
119 changes: 117 additions & 2 deletions features/rack.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Bugsnag raises errors in Rack

Scenario: An unhandled RuntimeError sends a report
Given I start the rack service
When I navigate to the route "/unhandled" on the rack app
When I navigate to the route "/unhandled?a=123&b=456" on the rack app
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "unhandled" is true
Expand All @@ -11,14 +11,129 @@ Scenario: An unhandled RuntimeError sends a report
And the event "severityReason.attributes.framework" equals "Rack"
And the event "app.type" equals "rack"
And the exception "errorClass" equals "RuntimeError"
And the event "metaData.request.body" is null
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.headers.Version" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"

Scenario: A handled RuntimeError sends a report
Given I start the rack service
When I navigate to the route "/handled" on the rack app
When I navigate to the route "/handled?a=123&b=456" on the rack app
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "unhandled" is false
And the event "severity" equals "warning"
And the event "severityReason.type" equals "handledException"
And the event "app.type" equals "rack"
And the exception "errorClass" equals "RuntimeError"
And the event "metaData.request.body" is null
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.headers.Version" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/handled?a=123&b=456"

Scenario: A POST request with form data sends a report with the parsed request body attached
Given I start the rack service
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following form data:
| name | baba |
| favourite_letter | z |
| password | password1 |
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "metaData.request.body.name" equals "baba"
And the event "metaData.request.body.favourite_letter" equals "z"
And the event "metaData.request.body.password" equals "[FILTERED]"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.headers.Version" is not null
And the event "metaData.request.httpMethod" equals "POST"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"

Scenario: A POST request with JSON sends a report with the parsed request body attached
Given I start the rack service
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following JSON:
| name | baba |
| favourite_letter | z |
| password | password1 |
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "metaData.request.body.name" equals "baba"
And the event "metaData.request.body.favourite_letter" equals "z"
And the event "metaData.request.body.password" equals "[FILTERED]"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.headers.Version" is not null
And the event "metaData.request.httpMethod" equals "POST"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"

Scenario: A request with cookies will be filtered out by default
Given I start the rack service
When I navigate to the route "/unhandled?a=123&b=456" on the rack app with these cookies:
| a | b |
| c | d |
| e | f |
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "metaData.request.cookie" is null
And the event "metaData.request.headers.Cookie" equals "[FILTERED]"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.headers.Version" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"

Scenario: A request with cookies and no matching filter will set cookies in metadata
Given I set environment variable "BUGSNAG_METADATA_FILTERS" to '["password"]'
And I start the rack service
When I navigate to the route "/unhandled?a=123&b=456" on the rack app with these cookies:
| a | b |
| c | d |
| e | f |
And I wait to receive a request
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
And the event "metaData.request.cookies.a" equals "b"
And the event "metaData.request.cookies.c" equals "d"
And the event "metaData.request.cookies.e" equals "f"
And the event "metaData.request.headers.Cookie" equals "a=b;c=d;e=f"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.headers.Version" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
34 changes: 34 additions & 0 deletions features/steps/ruby_notifier_steps.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require "json"
require "net/http"

Then(/^the "(.+)" of the top non-bugsnag stackframe equals (\d+|".+")$/) do |element, value|
stacktrace = read_key_path(Server.current_request[:body], 'events.0.exceptions.0.stacktrace')
frame_index = stacktrace.find_index { |frame| ! /.*lib\/bugsnag.*\.rb/.match(frame["file"]) }
Expand Down Expand Up @@ -91,6 +94,37 @@
}
end

When("I navigate to the route {string} on the rack app with these cookies:") do |route, data|
rack_version = ENV["RACK_VERSION"]
uri = URI("http://rack#{rack_version}:3000#{route}")

# e.g. { "a" => "b", "c" => "d" } -> "a=b;c=d"
cookie = data.rows_hash.map { |key, value| "#{key}=#{value}" }.join(";")

http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request["Cookie"] = cookie

http.request(request)
end

When("I send a POST request to {string} in the rack app with the following form data:") do |route, data|
rack_version = ENV["RACK_VERSION"]
uri = URI("http://rack#{rack_version}:3000#{route}")

Net::HTTP.post_form(uri, data.rows_hash)
end

When("I send a POST request to {string} in the rack app with the following JSON:") do |route, data|
rack_version = ENV["RACK_VERSION"]

Net::HTTP.post(
URI("http://rack#{rack_version}:3000#{route}"),
JSON.generate(data.rows_hash),
{ "Content-Type" => "application/json" }
)
end

Then("the payload field {string} matches the appropriate Sidekiq handled payload") do |field|
# Sidekiq 2 doesn't include the "created_at" field
created_at_present = ENV["SIDEKIQ_VERSION"] > "2"
Expand Down
Loading