airbrake 4.3.1 → 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +49 -0
- data/lib/airbrake/capistrano.rb +0 -1
- data/lib/airbrake/rails/controller_methods.rb +27 -5
- data/lib/airbrake/shared_tasks.rb +2 -3
- data/lib/airbrake/tasks/airbrake.cap +0 -1
- data/lib/airbrake/utils/params_cleaner.rb +1 -1
- data/lib/airbrake/version.rb +1 -1
- data/lib/airbrake_tasks.rb +3 -5
- data/resources/README.md +1 -1
- data/resources/airbrake_2_4.xsd +89 -0
- data/resources/notice.xml +1 -1
- data/test/airbrake_tasks_test.rb +1 -7
- data/test/controller_methods_test.rb +62 -2
- data/test/integration.rb +0 -1
- data/test/notice_test.rb +3 -4
- data/test/params_cleaner_test.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9cbcc7af3d4f64af905ebac59cf09f65d8479d8
|
4
|
+
data.tar.gz: 854302ffe9b41145615d10bf6ee677b916efd239
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0145fe2c505bdc19edb661c7c8fcb350f3cd229f472ed0eba4152dc9f98fccd31db1637e6c4c0c76b818706f7e648aa72a0d0b7889f3de2a7c90bd8ad696cb0b
|
7
|
+
data.tar.gz: 4f516bbcf921d6065c7e2f608246538b427486625bd7ed6c81e70c042317fc0e819762bc0b64c507303858f8ff37c112d2d0cecffb5bda5fa1e276b89531a084
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,51 @@
|
|
1
|
+
Version 4.3.2 - 2015-10-16 21:24:49 -0500
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
Alexis (3):
|
5
|
+
don't fail on request param containing |
|
6
|
+
[#419] | test
|
7
|
+
don't fail on request param containing |
|
8
|
+
|
9
|
+
Andres Ivanov (5):
|
10
|
+
Remove API_KEY from capistrano tasks
|
11
|
+
Remove api_key variable sent by airbrake:deploy
|
12
|
+
Merge github.com:airbrake/airbrake
|
13
|
+
Remove api_key opt from AirbrakeTasks.deploy
|
14
|
+
Remove test that checks availability of passing api_key opt
|
15
|
+
|
16
|
+
Iain Beeston (2):
|
17
|
+
Corrected ControllerMethods test that could never fail
|
18
|
+
Protected against errors while gathering user details
|
19
|
+
|
20
|
+
Joe Roberts (1):
|
21
|
+
Fix readme, SSL is available to everyone.
|
22
|
+
|
23
|
+
Kyrylo Silin (15):
|
24
|
+
Merge pull request #409 from airbrake/fix/readme-ssl
|
25
|
+
Merge pull request #411 from TangRufus/master
|
26
|
+
Revert "start using remote XSD file when verifying XML in tests"
|
27
|
+
Merge pull request #420 from alexis779/master
|
28
|
+
Revert "[#419] don't fail on request param containing |"
|
29
|
+
Merge pull request #424 from airbrake/revert-420-master
|
30
|
+
circle: update Ruby from 2.0.0-p0 to 2.2.3
|
31
|
+
Merge pull request #425 from airbrake/update-ruby
|
32
|
+
params_cleaner: do not attempt to "collect" closed IO objects
|
33
|
+
Merge pull request #426 from airbrake/396-closed-io-bug
|
34
|
+
Merge pull request #429 from iainbeeston/incorrect-controller-method-name
|
35
|
+
Merge pull request #430 from iainbeeston/protect-against-user-load-errors
|
36
|
+
test/integration: don't require abstract_controller
|
37
|
+
Merge pull request #431 from airbrake/do-not-require-abstract-controller
|
38
|
+
Merge pull request #427 from alexis779/master
|
39
|
+
|
40
|
+
Marko Šiftar (2):
|
41
|
+
Merge pull request #412 from midN/master
|
42
|
+
Merge pull request #416 from airbrake/415-fix-build
|
43
|
+
|
44
|
+
Tang Rufus (2):
|
45
|
+
Fix airbrake/airbrake#410
|
46
|
+
Backward compatible with Rails 4
|
47
|
+
|
48
|
+
|
1
49
|
Version 4.3.1 - 2015-08-24 21:10:19 -0500
|
2
50
|
===============================================================================
|
3
51
|
|
@@ -1593,5 +1641,6 @@ Nick Quaranto (3):
|
|
1593
1641
|
|
1594
1642
|
|
1595
1643
|
|
1644
|
+
|
1596
1645
|
|
1597
1646
|
|
data/lib/airbrake/capistrano.rb
CHANGED
@@ -82,7 +82,6 @@ module Airbrake
|
|
82
82
|
notify_command << " RAILS_ENV=#{rails_env}" if rails_env
|
83
83
|
notify_command << " airbrake:deploy TO=#{airbrake_env} REVISION=#{current_revision} REPO=#{repository} USER=#{Airbrake::Capistrano::shellescape(local_user)}"
|
84
84
|
notify_command << " DRY_RUN=true" if dry_run
|
85
|
-
notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
|
86
85
|
logger.info "Notifying Airbrake of Deploy (#{notify_command})"
|
87
86
|
if configuration.dry_run
|
88
87
|
logger.info "DRY RUN: Notification not actually run."
|
@@ -2,20 +2,30 @@ module Airbrake
|
|
2
2
|
module Rails
|
3
3
|
module ControllerMethods
|
4
4
|
|
5
|
+
SLASH = "/"
|
6
|
+
|
5
7
|
def airbrake_request_data
|
6
8
|
{
|
7
|
-
:parameters => airbrake_filter_if_filtering(params
|
9
|
+
:parameters => airbrake_filter_if_filtering(to_hash(params)),
|
8
10
|
:session_data => airbrake_filter_if_filtering(airbrake_session_data),
|
9
11
|
:controller => params[:controller],
|
10
12
|
:action => params[:action],
|
11
13
|
:url => airbrake_request_url,
|
12
14
|
:cgi_data => airbrake_filter_if_filtering(request.env),
|
13
|
-
:user => airbrake_current_user
|
15
|
+
:user => airbrake_current_user
|
14
16
|
}
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
18
20
|
|
21
|
+
def to_hash(params)
|
22
|
+
# Rails <= 4
|
23
|
+
return params.to_hash if params.respond_to?(:to_hash)
|
24
|
+
|
25
|
+
# Rails >= 5
|
26
|
+
params.to_unsafe_h
|
27
|
+
end
|
28
|
+
|
19
29
|
# This method should be used for sending manual notifications while you are still
|
20
30
|
# inside the controller. Otherwise it works like Airbrake.notify.
|
21
31
|
def notify_airbrake(hash_or_exception)
|
@@ -90,7 +100,11 @@ module Airbrake
|
|
90
100
|
url << ":#{request.port}"
|
91
101
|
end
|
92
102
|
|
93
|
-
|
103
|
+
unless request.fullpath[0] == SLASH
|
104
|
+
url << SLASH
|
105
|
+
end
|
106
|
+
|
107
|
+
url << request.fullpath
|
94
108
|
end
|
95
109
|
|
96
110
|
def airbrake_current_user
|
@@ -98,9 +112,15 @@ module Airbrake
|
|
98
112
|
|
99
113
|
if user
|
100
114
|
Airbrake.configuration.user_attributes.map(&:to_sym).inject({}) do |hsh, attr|
|
101
|
-
|
102
|
-
|
115
|
+
begin
|
116
|
+
hsh[attr] = user.send(attr) if user.respond_to? attr
|
117
|
+
hsh
|
118
|
+
rescue
|
119
|
+
hsh
|
120
|
+
end
|
103
121
|
end
|
122
|
+
else
|
123
|
+
{}
|
104
124
|
end
|
105
125
|
end
|
106
126
|
|
@@ -112,6 +132,8 @@ module Airbrake
|
|
112
132
|
else
|
113
133
|
nil
|
114
134
|
end
|
135
|
+
rescue
|
136
|
+
nil
|
115
137
|
ensure
|
116
138
|
# The Airbrake middleware is first in the chain, before ActiveRecord::ConnectionAdapters::ConnectionManagement
|
117
139
|
# kicks in to do its thing. This can cause the connection pool to run out of connections.
|
@@ -17,7 +17,6 @@ namespace :airbrake do
|
|
17
17
|
:scm_revision => ENV['REVISION'],
|
18
18
|
:scm_repository => ENV['REPO'],
|
19
19
|
:local_username => ENV['USER'],
|
20
|
-
:api_key => ENV['API_KEY'],
|
21
20
|
:dry_run => ENV['DRY_RUN'])
|
22
21
|
end
|
23
22
|
|
@@ -46,8 +45,8 @@ namespace :airbrake do
|
|
46
45
|
repo = `git config --get remote.origin.url` || ENV["REPO"]
|
47
46
|
|
48
47
|
command = %Q(heroku addons:add deployhooks:http --url="http://airbrake.io/deploys.txt?api_key=#{heroku_api_key})
|
49
|
-
command << "&deploy[local_username]={{user}}"
|
50
|
-
command << "&deploy[scm_revision]={{head_long}}"
|
48
|
+
command << "&deploy[local_username]={{user}}"
|
49
|
+
command << "&deploy[scm_revision]={{head_long}}"
|
51
50
|
command << "&deploy[rails_env]=#{heroku_rails_env}" if heroku_rails_env
|
52
51
|
command << "&deploy[scm_repository]=#{repo}" if repo
|
53
52
|
command << '"'
|
@@ -17,7 +17,6 @@ namespace :airbrake do
|
|
17
17
|
notify_command << " TO=#{airbrake_env}"
|
18
18
|
notify_command << " REVISION=#{fetch(:current_revision)} REPO=#{fetch(:repo_url)}"
|
19
19
|
notify_command << " USER=#{local_user.strip.shellescape}"
|
20
|
-
notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
|
21
20
|
|
22
21
|
info "Notifying Airbrake of Deploy (#{notify_command})"
|
23
22
|
execute :rake, notify_command
|
@@ -125,7 +125,7 @@ module Airbrake
|
|
125
125
|
data.to_hash.inject({}) do |result, (key, value)|
|
126
126
|
result.merge!(key => clean_unserializable_data(value, stack + [data.object_id]))
|
127
127
|
end
|
128
|
-
elsif data.respond_to?(:collect)
|
128
|
+
elsif data.respond_to?(:collect) && !data.respond_to?(:readlines)
|
129
129
|
data = data.collect do |value|
|
130
130
|
clean_unserializable_data(value, stack + [data.object_id])
|
131
131
|
end
|
data/lib/airbrake/version.rb
CHANGED
data/lib/airbrake_tasks.rb
CHANGED
@@ -8,15 +8,13 @@ module AirbrakeTasks
|
|
8
8
|
#
|
9
9
|
# @param [Hash] opts Data about the deploy that is set to Airbrake
|
10
10
|
#
|
11
|
-
# @option opts [String] :api_key Api key of you Airbrake application
|
12
11
|
# @option opts [String] :rails_env Environment of the deploy (production, staging)
|
13
12
|
# @option opts [String] :scm_revision The given revision/sha that is being deployed
|
14
13
|
# @option opts [String] :scm_repository Address of your repository to help with code lookups
|
15
14
|
# @option opts [String] :local_username Who is deploying
|
16
15
|
def self.deploy(opts = {})
|
17
|
-
|
18
|
-
|
19
|
-
puts "I don't seem to be configured with an API key. Please check your configuration."
|
16
|
+
unless Airbrake.configuration.api_key =~ /\S/
|
17
|
+
puts "I don't seem to be configured with an API key. Please check your configuration."
|
20
18
|
return false
|
21
19
|
end
|
22
20
|
|
@@ -26,7 +24,7 @@ module AirbrakeTasks
|
|
26
24
|
end
|
27
25
|
|
28
26
|
dry_run = opts.delete(:dry_run)
|
29
|
-
params = {'api_key' => api_key}
|
27
|
+
params = {'api_key' => Airbrake.configuration.api_key}
|
30
28
|
opts.each {|k,v| params["deploy[#{k}]"] = v }
|
31
29
|
|
32
30
|
host = Airbrake.configuration.host || 'api.airbrake.io'
|
data/resources/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Airbrake Resources
|
2
2
|
==================
|
3
3
|
|
4
|
-
Airbrake has an SSL mode
|
4
|
+
Airbrake has an SSL mode. SSL Certificate Authority (CA) certificates are not kept current by default on many environments. When CA certs are stale, Airbrake cannot verify Airbrake's production SSL cert and error reports fail. To avoid this, we now package local CA certs. The production of these certs is detailed here.
|
5
5
|
|
6
6
|
Building ca-bundle.crt
|
7
7
|
----------------------
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
3
|
+
|
4
|
+
<xs:element name="notice">
|
5
|
+
<xs:complexType>
|
6
|
+
<xs:all>
|
7
|
+
<xs:element name="api-key" type="xs:string"/>
|
8
|
+
<xs:element name="notifier" type="notifier"/>
|
9
|
+
<xs:element name="error" type="error"/>
|
10
|
+
<xs:element name="request" type="request" minOccurs="0"/>
|
11
|
+
<xs:element name="server-environment" type="serverEnvironment"/>
|
12
|
+
<xs:element name="current-user" type="current-user" minOccurs="0"/>
|
13
|
+
<xs:element name="framework" type="xs:string" minOccurs="0"/>
|
14
|
+
</xs:all>
|
15
|
+
<xs:attribute name="version" type="xs:string" use="required"/>
|
16
|
+
</xs:complexType>
|
17
|
+
</xs:element>
|
18
|
+
|
19
|
+
<xs:complexType name="notifier">
|
20
|
+
<xs:all>
|
21
|
+
<xs:element name="name" type="xs:string"/>
|
22
|
+
<xs:element name="version" type="xs:string"/>
|
23
|
+
<xs:element name="url" type="xs:string"/>
|
24
|
+
</xs:all>
|
25
|
+
</xs:complexType>
|
26
|
+
|
27
|
+
<xs:complexType name="error">
|
28
|
+
<xs:all>
|
29
|
+
<xs:element name="class" type="xs:string"/>
|
30
|
+
<xs:element name="message" type="xs:string" minOccurs="0"/>
|
31
|
+
<xs:element name="backtrace" type="backtrace"/>
|
32
|
+
</xs:all>
|
33
|
+
</xs:complexType>
|
34
|
+
|
35
|
+
<xs:complexType name="backtrace">
|
36
|
+
<xs:sequence>
|
37
|
+
<xs:element name="line" maxOccurs="unbounded" minOccurs="0">
|
38
|
+
<xs:complexType>
|
39
|
+
<xs:attribute name="file" type="xs:string" use="required"/>
|
40
|
+
<xs:attribute name="number" type="xs:string" use="required"/>
|
41
|
+
<xs:attribute name="method" type="xs:string" use="optional"/>
|
42
|
+
</xs:complexType>
|
43
|
+
</xs:element>
|
44
|
+
</xs:sequence>
|
45
|
+
</xs:complexType>
|
46
|
+
|
47
|
+
<xs:complexType name="request">
|
48
|
+
<xs:all>
|
49
|
+
<xs:element name="url" type="xs:string"/>
|
50
|
+
<xs:element name="component" type="xs:string"/>
|
51
|
+
<xs:element name="action" type="xs:string" minOccurs="0"/>
|
52
|
+
<xs:element name="params" type="varList" minOccurs="0"/>
|
53
|
+
<xs:element name="session" type="varList" minOccurs="0"/>
|
54
|
+
<xs:element name="cgi-data" type="varList" minOccurs="0"/>
|
55
|
+
</xs:all>
|
56
|
+
</xs:complexType>
|
57
|
+
|
58
|
+
<xs:complexType name="varList">
|
59
|
+
<xs:sequence>
|
60
|
+
<xs:element name="var" type="var" maxOccurs="unbounded"/>
|
61
|
+
</xs:sequence>
|
62
|
+
</xs:complexType>
|
63
|
+
|
64
|
+
<xs:complexType name="var" mixed="true">
|
65
|
+
<xs:sequence>
|
66
|
+
<xs:element name="var" type="var" minOccurs="0" maxOccurs="unbounded"/>
|
67
|
+
</xs:sequence>
|
68
|
+
<xs:attribute name="key" type="xs:string" use="required"/>
|
69
|
+
</xs:complexType>
|
70
|
+
|
71
|
+
<xs:complexType name="serverEnvironment">
|
72
|
+
<xs:sequence>
|
73
|
+
<xs:element name="project-root" type="xs:string" minOccurs="0"/>
|
74
|
+
<xs:element name="environment-name" type="xs:string"/>
|
75
|
+
<xs:element name="app-version" type="xs:string" minOccurs="0"/>
|
76
|
+
<xs:element name="hostname" type="xs:string" minOccurs="0"/>
|
77
|
+
</xs:sequence>
|
78
|
+
</xs:complexType>
|
79
|
+
|
80
|
+
<xs:complexType name="current-user">
|
81
|
+
<xs:all>
|
82
|
+
<xs:element name="id" type="xs:string"/>
|
83
|
+
<xs:element name="name" type="xs:string" minOccurs="0"/>
|
84
|
+
<xs:element name="email" type="xs:string" minOccurs="0"/>
|
85
|
+
<xs:element name="username" type="xs:string" minOccurs="0"/>
|
86
|
+
</xs:all>
|
87
|
+
</xs:complexType>
|
88
|
+
|
89
|
+
</xs:schema>
|
data/resources/notice.xml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?><notice version="2.4"><api-key>myapikey</api-key><notifier><name>Airbrake Notifier</name><version>4.3.
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><notice version="2.4"><api-key>myapikey</api-key><notifier><name>Airbrake Notifier</name><version>4.3.1</version><url>https://github.com/airbrake/airbrake</url></notifier><error><class>RuntimeError</class><message>RuntimeError: some message</message><backtrace><line number="5" file="[PROJECT_ROOT]/app/controllers/test_controller.rb" method="index"/><line number="4" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal/implicit_render.rb" method="send_action"/><line number="150" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/abstract_controller/base.rb" method="process_action"/><line number="11" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal/rendering.rb" method="process_action"/><line number="18" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/abstract_controller/callbacks.rb" method="block in process_action"/><line number="436" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/callbacks.rb" method="_run__20051018944254218__process_action__2531145757131982543__callbacks"/><line number="410" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/callbacks.rb" method="_run_process_action_callbacks"/><line number="94" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/callbacks.rb" method="run_callbacks"/><line number="17" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/abstract_controller/callbacks.rb" method="process_action"/><line number="17" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal/rescue.rb" method="process_action"/><line number="30" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal/instrumentation.rb" method="block in process_action"/><line number="52" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/notifications.rb" method="block in instrument"/><line number="21" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/notifications/instrumenter.rb" method="instrument"/><line number="52" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/notifications.rb" method="instrument"/><line number="29" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal/instrumentation.rb" method="process_action"/><line number="119" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/abstract_controller/base.rb" method="process"/><line number="41" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/abstract_controller/rendering.rb" method="process"/><line number="138" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal.rb" method="dispatch"/><line number="14" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal/rack_delegation.rb" method="dispatch"/><line number="178" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_controller/metal.rb" method="block in action"/><line number="68" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb" method="call"/><line number="68" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb" method="dispatch"/><line number="33" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb" method="call"/><line number="148" file="[GEM_ROOT]/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb" method="block in call"/><line number="93" file="[GEM_ROOT]/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb" method="block in recognize"/><line number="68" file="[GEM_ROOT]/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb" method="optimized_each"/><line number="92" file="[GEM_ROOT]/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb" method="recognize"/><line number="139" file="[GEM_ROOT]/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb" method="call"/><line number="499" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb" method="call"/><line number="17" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/best_standards_support.rb" method="call"/><line number="14" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/head.rb" method="call"/><line number="24" file="[GEM_ROOT]/gems/rack-1.2.8/lib/rack/methodoverride.rb" method="call"/><line number="21" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/params_parser.rb" method="call"/><line number="182" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/flash.rb" method="call"/><line number="149" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/session/abstract_store.rb" method="call"/><line number="302" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/cookies.rb" method="call"/><line number="46" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/callbacks.rb" method="block in call"/><line number="416" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/callbacks.rb" method="_run_call_callbacks"/><line number="44" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/callbacks.rb" method="call"/><line number="106" file="[GEM_ROOT]/gems/rack-1.2.8/lib/rack/sendfile.rb" method="call"/><line number="48" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/remote_ip.rb" method="call"/><line number="47" file="[GEM_ROOT]/gems/actionpack-3.0.20/lib/action_dispatch/middleware/show_exceptions.rb" method="call"/><line number="13" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/rack/logger.rb" method="call"/><line number="17" file="[GEM_ROOT]/gems/rack-1.2.8/lib/rack/runtime.rb" method="call"/><line number="72" file="[GEM_ROOT]/gems/activesupport-3.0.20/lib/active_support/cache/strategy/local_cache.rb" method="call"/><line number="13" file="[GEM_ROOT]/gems/rack-1.2.8/lib/rack/lock.rb" method="block in call"/><line number="13" file="[GEM_ROOT]/gems/rack-1.2.8/lib/rack/lock.rb" method="synchronize"/><line number="13" file="[GEM_ROOT]/gems/rack-1.2.8/lib/rack/lock.rb" method="call"/><line number="168" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/application.rb" method="call"/><line number="77" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/application.rb" method="method_missing"/><line number="4" file="request.rb" method="<top (required)>"/><line number="48" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/commands/runner.rb" method="eval"/><line number="48" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/commands/runner.rb" method="<top (required)>"/><line number="39" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/commands.rb" method="require"/><line number="39" file="[GEM_ROOT]/gems/railties-3.0.20/lib/rails/commands.rb" method="<top (required)>"/><line number="6" file="script/rails" method="require"/><line number="6" file="script/rails" method="<main>"/></backtrace></error><request><url>http://example.com:123/test/index?param=value</url><component>test</component><action>index</action><params><var key="param">value</var><var key="controller">test</var><var key="action">index</var></params><cgi-data><var key="rack.version">["1", "1"]</var><var key="rack.multithread">false</var><var key="rack.multiprocess">true</var><var key="rack.run_once">false</var><var key="REQUEST_METHOD">GET</var><var key="SERVER_NAME">example.com</var><var key="SERVER_PORT">123</var><var key="QUERY_STRING">param=value</var><var key="PATH_INFO">/test/index</var><var key="rack.url_scheme">http</var><var key="HTTPS">off</var><var key="SCRIPT_NAME"></var><var key="CONTENT_LENGTH">0</var><var key="action_dispatch.parameter_filter">["password"]</var><var key="action_dispatch.show_exceptions">true</var><var key="action_dispatch.remote_ip"></var><var key="action_dispatch.request.path_parameters"><var key="controller">test</var><var key="action">index</var></var><var key="action_dispatch.request.content_type"></var><var key="action_dispatch.request.request_parameters"></var><var key="rack.request.query_string">param=value</var><var key="rack.request.query_hash"><var key="param">value</var></var><var key="action_dispatch.request.query_parameters"><var key="param">value</var></var><var key="action_dispatch.request.parameters"><var key="param">value</var><var key="controller">test</var><var key="action">index</var></var><var key="action_dispatch.request.formats">["text/html"]</var></cgi-data></request><server-environment><project-root>/Users/shifi/work/rackspace/code/airbrake/tmp/rails_root</project-root><environment-name>production</environment-name><hostname>shifi-mac.local</hostname></server-environment><framework>Rails: 3.0.20</framework></notice>
|
data/test/airbrake_tasks_test.rb
CHANGED
@@ -92,12 +92,6 @@ class AirbrakeTasksTest < Test::Unit::TestCase
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
before_should "use the :api_key param if it's passed in." do
|
96
|
-
@options[:api_key] = "value"
|
97
|
-
@post.expects(:set_form_data).
|
98
|
-
with(has_entries("api_key" => "value"))
|
99
|
-
end
|
100
|
-
|
101
95
|
before_should "puts the response body on success" do
|
102
96
|
AirbrakeTasks.expects(:puts).with("body")
|
103
97
|
@http_proxy.expects(:request).with(any_parameters).returns(successful_response('body'))
|
@@ -125,7 +119,7 @@ class AirbrakeTasksTest < Test::Unit::TestCase
|
|
125
119
|
|
126
120
|
context "in a configured project with custom host" do
|
127
121
|
setup do
|
128
|
-
Airbrake.configure do |config|
|
122
|
+
Airbrake.configure do |config|
|
129
123
|
config.api_key = "1234123412341234"
|
130
124
|
config.host = "custom.host"
|
131
125
|
end
|
@@ -29,6 +29,27 @@ class CurrentMemberTestController < TestController
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
class CurrentUserErrorTestController < TestController
|
33
|
+
def current_user
|
34
|
+
fail 'Testing broken implementation for #current_user'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class CurrentMemberErrorTestController < TestController
|
39
|
+
def current_member
|
40
|
+
fail 'Testing broken implementation for #current_member'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class CurrentUserAttributeErrorTestController < TestController
|
45
|
+
def current_user
|
46
|
+
user = OpenStruct.new(:id => 123)
|
47
|
+
def user.name
|
48
|
+
fail 'Testing attribute that raises error on #current_user'
|
49
|
+
end
|
50
|
+
user
|
51
|
+
end
|
52
|
+
end
|
32
53
|
|
33
54
|
class NoSessionTestController < TestController
|
34
55
|
def session
|
@@ -36,10 +57,18 @@ class NoSessionTestController < TestController
|
|
36
57
|
end
|
37
58
|
end
|
38
59
|
|
60
|
+
class ParamTestController < TestController
|
61
|
+
QUERY_PARAMS = { name: "|" } # URI parameter with invalid character
|
62
|
+
def request
|
63
|
+
query = QUERY_PARAMS.map { |k, v| "#{k}=#{v}"}.join("&")
|
64
|
+
OpenStruct.new(:port=> 80, :protocol => 'http://', host: 'example.com', :fullpath => "path?#{query}", :env => [])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
39
68
|
class ControllerMethodsTest < Test::Unit::TestCase
|
40
69
|
include DefinesConstants
|
41
70
|
|
42
|
-
context "#
|
71
|
+
context "#airbrake_request_data" do
|
43
72
|
context "without a logged in user" do
|
44
73
|
setup do
|
45
74
|
|
@@ -59,7 +88,7 @@ class ControllerMethodsTest < Test::Unit::TestCase
|
|
59
88
|
end
|
60
89
|
|
61
90
|
should "not call #id on NilClass" do
|
62
|
-
@controller.
|
91
|
+
@controller.airbrake_request_data
|
63
92
|
assert_equal false, NilClass.called
|
64
93
|
end
|
65
94
|
end
|
@@ -102,6 +131,32 @@ class ControllerMethodsTest < Test::Unit::TestCase
|
|
102
131
|
CurrentUserTestController.new.airbrake_request_data
|
103
132
|
end
|
104
133
|
end
|
134
|
+
|
135
|
+
context 'when loading the user raises an error' do
|
136
|
+
should 'send empty user info to Ab when current_user fails' do
|
137
|
+
Airbrake.configuration.user_attributes = %w(id)
|
138
|
+
controller = CurrentUserErrorTestController.new
|
139
|
+
ab_data = controller.airbrake_request_data
|
140
|
+
|
141
|
+
assert_equal( { }, ab_data[:user] )
|
142
|
+
end
|
143
|
+
|
144
|
+
should 'send empty user info to Ab when current_member fails' do
|
145
|
+
Airbrake.configuration.user_attributes = %w(id)
|
146
|
+
controller = CurrentMemberErrorTestController.new
|
147
|
+
ab_data = controller.airbrake_request_data
|
148
|
+
|
149
|
+
assert_equal( { }, ab_data[:user] )
|
150
|
+
end
|
151
|
+
|
152
|
+
should 'exclude any user attributes that raise an error' do
|
153
|
+
Airbrake.configuration.user_attributes = %w(id name)
|
154
|
+
controller = CurrentUserAttributeErrorTestController.new
|
155
|
+
ab_data = controller.airbrake_request_data
|
156
|
+
|
157
|
+
assert_equal( {:id => 123}, ab_data[:user])
|
158
|
+
end
|
159
|
+
end
|
105
160
|
end
|
106
161
|
|
107
162
|
context '#airbrake_session_data' do
|
@@ -122,6 +177,11 @@ class ControllerMethodsTest < Test::Unit::TestCase
|
|
122
177
|
request_url = @controller.send(:airbrake_request_url)
|
123
178
|
assert_equal request_url, "http://example.com/path"
|
124
179
|
end
|
180
|
+
|
181
|
+
should "handle invalid character in param" do
|
182
|
+
request_url = ParamTestController.new.send(:airbrake_request_url)
|
183
|
+
assert_equal request_url, "http://example.com/path?name=|"
|
184
|
+
end
|
125
185
|
end
|
126
186
|
|
127
187
|
context "Rails 3" do
|
data/test/integration.rb
CHANGED
data/test/notice_test.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require File.expand_path '../helper', __FILE__
|
2
2
|
|
3
|
-
|
4
3
|
class NoticeTest < Test::Unit::TestCase
|
5
4
|
|
6
5
|
include DefinesConstants
|
@@ -43,8 +42,8 @@ class NoticeTest < Test::Unit::TestCase
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def assert_valid_notice_document(document)
|
46
|
-
xsd_path =
|
47
|
-
schema = Nokogiri::XML::Schema.new(
|
45
|
+
xsd_path = File.expand_path(File.join(File.dirname(__FILE__),"..", "resources", "airbrake_2_4.xsd"))
|
46
|
+
schema = Nokogiri::XML::Schema.new(IO.read(xsd_path))
|
48
47
|
errors = schema.validate(document)
|
49
48
|
assert errors.empty?, errors.collect{|e| e.message }.join
|
50
49
|
end
|
@@ -189,7 +188,7 @@ class NoticeTest < Test::Unit::TestCase
|
|
189
188
|
build_notice
|
190
189
|
end
|
191
190
|
end
|
192
|
-
|
191
|
+
|
193
192
|
should "accept any object that responds to :to_hash as CGI data" do
|
194
193
|
hashlike_obj = Object.new
|
195
194
|
hashlike_obj.instance_eval do
|
data/test/params_cleaner_test.rb
CHANGED
@@ -181,4 +181,13 @@ class ParamsCleanerTest < Test::Unit::TestCase
|
|
181
181
|
assert_serializes_hash(:cgi_data)
|
182
182
|
assert_serializes_hash(:session_data)
|
183
183
|
end
|
184
|
+
|
185
|
+
should "handle closed IO objects by converting them to strings" do
|
186
|
+
params = {
|
187
|
+
:files => [Tempfile.new('a').tap(&:close), IO.new(0).tap(&:close)]
|
188
|
+
}
|
189
|
+
clean_params = clean(:params_filters => ['files'], :parameters => params)
|
190
|
+
assert_match(/\A#<(Temp)?[Ff]ile:0x.+>\z/, clean_params.parameters[:files][0])
|
191
|
+
assert_match(/\A#<IO:0x.+>\z/, clean_params.parameters[:files][1])
|
192
|
+
end
|
184
193
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -384,6 +384,7 @@ files:
|
|
384
384
|
- lib/templates/rescue.erb
|
385
385
|
- rails/init.rb
|
386
386
|
- resources/README.md
|
387
|
+
- resources/airbrake_2_4.xsd
|
387
388
|
- resources/airbrake_3_0.json
|
388
389
|
- resources/ca-bundle.crt
|
389
390
|
- resources/notice.xml
|