sidekiq-failures 1.0.3 → 1.0.4

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: 0d9628945c34d8f9ed07942963bfa2af8205d62813380126efc72fdb2f357dac
4
- data.tar.gz: 9909e3f78cf4974de23878094751200f7d23b795637524d469b40d26237cf8c0
3
+ metadata.gz: 71e370c4485d8ecc481914afd5d8a489c9f2743c1749975dceb536977607230a
4
+ data.tar.gz: 1a8e989912c378459e478eb9f29c0dd1d53128c126cc135c2bf597375e26ed84
5
5
  SHA512:
6
- metadata.gz: df5f041943257ee40566a7eb740abd0f61c69d8a03e15f0b8a4727bc1a37a72115a6173684f22a11a095c7478c7f4c325e7e73fce1094fe72a147213443384c5
7
- data.tar.gz: b7265f98b1ba526c14d3c2a28a5d17a85dc8fa9231d7233623c964784cb903557518729398db13e07605a6d2367cc143b6084900fb68faff029c6339c0fbe923
6
+ metadata.gz: 49f99dbee68555a41e53d615e27afa48f5852d0f887fd96891864c89fd86f5d72fe552d9eefa5b22f860502d6bed321c38f5a4fd28ea5c4f1dfeea703c9d17eb
7
+ data.tar.gz: f59b94960937b9f7d3482c79f79b905015fac87df83bcde5db946023383658138d7226003431a4ece758780f0ad06e7a1b2785258917d19fc5a9278fe6583267
data/.gitignore CHANGED
@@ -17,4 +17,4 @@ tmp
17
17
  Gemfile.lock
18
18
  .ruby-version
19
19
  .ruby-gemset
20
-
20
+ .tool-versions
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.0.4
4
+
5
+ * Sanitize failure text on the failure details page (#144 @mcasper)
6
+
3
7
  ## 1.0.3
4
8
 
5
9
  * Expand failure descriptions with pure JS (#141 @icyleaf)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Failures
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
@@ -6,12 +6,12 @@
6
6
  <tr>
7
7
  <th><%= t('ErrorClass') %></th>
8
8
  <td>
9
- <code><%= @failure['error_class'] %></code>
9
+ <code><%= h @failure['error_class'] %></code>
10
10
  </td>
11
11
  </tr>
12
12
  <tr>
13
13
  <th><%= t('ErrorMessage') %></th>
14
- <td><%= @failure['error_message'] %></td>
14
+ <td><%= h @failure['error_message'] %></td>
15
15
  </tr>
16
16
  <% if !@failure['error_backtrace'].nil? %>
17
17
  <tr>
@@ -28,4 +28,5 @@ Gem::Specification.new do |gem|
28
28
  gem.add_development_dependency "rack-test"
29
29
  gem.add_development_dependency "sprockets"
30
30
  gem.add_development_dependency "sinatra"
31
+ gem.add_development_dependency "pry"
31
32
  end
@@ -201,17 +201,36 @@ module Sidekiq
201
201
 
202
202
  describe 'when there is specific failure' do
203
203
  describe 'with unescaped data' do
204
- before do
205
- create_sample_failure(args: ['<h1>omg</h1>'], error_message: '<p>wow</p>')
206
- get '/failures'
204
+ describe 'the index page' do
205
+ before do
206
+ create_sample_failure(args: ['<h1>omg</h1>'], error_message: '<p>wow</p>')
207
+ get '/failures'
208
+ end
209
+
210
+ it 'can escape arguments' do
211
+ _(last_response.body).must_match(/&quot;&lt;h1&gt;omg&lt;&#x2F;h1&gt;&quot;/)
212
+ end
213
+
214
+ it 'can escape error message' do
215
+ _(last_response.body).must_match(/ArgumentError: &lt;p&gt;wow&lt;&#x2F;p&gt;/)
216
+ end
207
217
  end
208
218
 
209
- it 'can escape arguments' do
210
- _(last_response.body).must_match(/&quot;&lt;h1&gt;omg&lt;&#x2F;h1&gt;&quot;/)
211
- end
212
-
213
- it 'can escape error message' do
214
- _(last_response.body).must_match(/ArgumentError: &lt;p&gt;wow&lt;&#x2F;p&gt;/)
219
+ describe 'the details page' do
220
+ before do
221
+ failure = create_sample_failure(args: ['<h1>omg</h1>'], error_message: '<p>wow</p>')
222
+ get "/failures/#{failure[:jid]}"
223
+ end
224
+
225
+ it 'can escape arguments' do
226
+ _(last_response.status).must_equal 200
227
+ _(last_response.body).must_match(/<th>Error Message<\/th>\n <td>&lt;p&gt;wow&lt;&#x2F;p&gt;<\/td>/)
228
+ end
229
+
230
+ it 'can escape error message' do
231
+ _(last_response.status).must_equal 200
232
+ _(last_response.body).must_match(/<th>Error Message<\/th>\n <td>&lt;p&gt;wow&lt;&#x2F;p&gt;<\/td>/)
233
+ end
215
234
  end
216
235
  end
217
236
 
@@ -259,6 +278,8 @@ module Sidekiq
259
278
  c.set("stat:failed", 1)
260
279
  end
261
280
  end
281
+
282
+ data
262
283
  end
263
284
 
264
285
  def failed_count
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-failures
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Silveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-13 00:00:00.000000000 Z
11
+ date: 2022-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Keep track of Sidekiq failed jobs
98
112
  email:
99
113
  - marcelo@mhfs.com.br
@@ -146,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
160
  - !ruby/object:Gem::Version
147
161
  version: '0'
148
162
  requirements: []
149
- rubygems_version: 3.3.7
163
+ rubygems_version: 3.0.3.1
150
164
  signing_key:
151
165
  specification_version: 4
152
166
  summary: Keeps track of Sidekiq failed jobs and adds a tab to the Web UI to let you