sqreen 1.21.0 → 1.21.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: acfd752e97a36e2f1f2d0cb224e72a409334d379a6e8c3e05b002bade311e097
4
- data.tar.gz: cb15f77dbc7e21faa5136a3cfc2493dd576164f2e49c532573c9f8adfa331e77
3
+ metadata.gz: 6611caf7add24e05a248fce4026be48a4c47612335c5fc9a26c64c33cd0409e9
4
+ data.tar.gz: 8381eba611e37df32a8744848661bcf144eaffe00c818e306355508fe0267394
5
5
  SHA512:
6
- metadata.gz: a4025d0a2500ff46db50b33eb7f3340065ae687f3e8d218a14ca3f2690ccecee4412b4901a4dcd93fd67a7fc0036ee025f4f4cf08a6d254101741ddaf4bbcf07
7
- data.tar.gz: 54755c74c6211c7aad3ae75aa8f2a5c307a074acef5ebf182ee31a5f50580a3115bd499be80d24cd5566ce16ef82c169f50ee9bed18531e7d0944e6864e7f610
6
+ metadata.gz: 65c820c306961ed812360c2c73a1f37396433238cff8fd79e2676132d7842eaa86d3555bf860d7c2f6fd465783f8c1aeb59100c94349b8c53588d83513265d2e
7
+ data.tar.gz: 38cda532df6f1037ac243c8cd5ccaecd708b880ff377d3fcbcecad329be184d40ec9f27deb61b69124be3d37ff74a16f88a7ab1032a6e6a0f6b5387645181027
@@ -1,3 +1,7 @@
1
+ ## 1.21.1
2
+
3
+ * Work around NewRelic initialisation (see https://github.com/newrelic/newrelic-ruby-agent/issues/461)
4
+
1
5
  ## 1.21.0
2
6
 
3
7
  * Add support for transport and tracing facilities
@@ -25,6 +25,14 @@ module Sqreen
25
25
  end
26
26
  end
27
27
 
28
+ def to_app_hook_strategy
29
+ if Sqreen::Dependency::NewRelic.bundled? || Sqreen::Dependency::NewRelic.required?
30
+ :chain
31
+ else
32
+ :prepend
33
+ end
34
+ end
35
+
28
36
  def hook(&block)
29
37
  Sqreen.log.debug "[#{Process.pid}] Startup command: #{$0}"
30
38
 
@@ -34,7 +42,7 @@ module Sqreen
34
42
  Sqreen::Dependency::Rails.insert_sqreen_middlewares
35
43
  end if Sqreen::Dependency::Rails.required?
36
44
 
37
- Sqreen::Graft::Hook.add('Rack::Builder#to_app') do
45
+ Sqreen::Graft::Hook.add('Rack::Builder#to_app', to_app_hook_strategy) do
38
46
  after do
39
47
  Sqreen::Dependency::Rails.inspect_middlewares
40
48
  end
@@ -48,7 +56,7 @@ module Sqreen
48
56
  end
49
57
  end.install if Sqreen::Dependency::Sinatra.required?
50
58
 
51
- Sqreen::Graft::Hook.add('Rack::Builder#to_app') do
59
+ Sqreen::Graft::Hook.add('Rack::Builder#to_app', to_app_hook_strategy) do
52
60
  after do |call|
53
61
  builder = call.instance
54
62
 
@@ -58,7 +66,7 @@ module Sqreen
58
66
 
59
67
  # ensure startup of thread in request handling processes
60
68
 
61
- Sqreen::Graft::Hook.add('Rack::Builder#to_app') do
69
+ Sqreen::Graft::Hook.add('Rack::Builder#to_app', to_app_hook_strategy) do
62
70
  after do |call|
63
71
  callback = call.callback
64
72
 
@@ -8,8 +8,17 @@ module Sqreen
8
8
  module NewRelic
9
9
  module_function
10
10
 
11
+ def bundled?
12
+ defined?(Gem) && Gem.respond_to?(:loaded_specs) && !Gem.loaded_specs['newrelic_rpm'].nil?
13
+ end
14
+
15
+ def required?
16
+ Sqreen::Dependency.const_exist?('NewRelic::Agent::Agent')
17
+ end
18
+
11
19
  def ignore_sqreen_exceptions
12
- return unless defined?(NewRelic::Agent::Agent)
20
+ return unless required?
21
+
13
22
  NewRelic::Agent::Agent.instance.error_collector.ignore(['Sqreen::AttackBlocked'])
14
23
  rescue ::Exception => e # rubocop:disable Lint/RescueException
15
24
  Sqreen.log.warn "Failed ignoring AttackBlocked on NewRelic: #{e.inspect}"
@@ -4,5 +4,5 @@
4
4
  # Please refer to our terms for more information: https://www.sqreen.com/terms.html
5
5
 
6
6
  module Sqreen
7
- VERSION = '1.21.0'.freeze
7
+ VERSION = '1.21.1'.freeze
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sqreen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqreen-backport