sqreen 1.17.2.beta1-java → 1.17.2.beta2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/sqreen/dependency/detector.rb +13 -0
- data/lib/sqreen/dependency/sinatra.rb +54 -0
- data/lib/sqreen/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01c3c821c21de60612d7bea58944b0d350e97c31bc2506200c712f366b866285
|
4
|
+
data.tar.gz: be7c642d80bb226edb19e54d478ee3835eb1c1e61dd704b966d42bc7b12ae831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c5f2ea96cf758cd23628213ffae12c0183eba93106e59f0fbc40ee2237c2801ee635db7bf8448459644d7a70a1e6d7f7bcebdf7401583c7b7b8e534e62f6a29
|
7
|
+
data.tar.gz: 74c1989008d6b3053e15168c36e468e64af87ef088d91680538a47af3782ccf7925eb2da8d4aec96c4aaf72f2eadc21da26e4227993520d132f34c254d4b3be7
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'sqreen/dependency/hook'
|
5
5
|
require 'sqreen/dependency/rails'
|
6
|
+
require 'sqreen/dependency/sinatra'
|
6
7
|
require 'sqreen/dependency/rack'
|
7
8
|
require 'sqreen/dependency/sentry'
|
8
9
|
require 'sqreen/dependency/new_relic'
|
@@ -37,6 +38,18 @@ module Sqreen
|
|
37
38
|
end
|
38
39
|
end if Sqreen::Dependency::Rails.required?
|
39
40
|
|
41
|
+
Sqreen::Dependency::Hook.add('Sinatra::Base.setup_default_middleware') do
|
42
|
+
after do |_, _, _, args|
|
43
|
+
Sqreen::Dependency::Sinatra.insert_sqreen_middlewares(args.first)
|
44
|
+
end
|
45
|
+
end.install if Sqreen::Dependency::Sinatra.required?
|
46
|
+
|
47
|
+
Sqreen::Dependency::Hook.add('Rack::Builder#to_app') do
|
48
|
+
after do |_, builder|
|
49
|
+
Sqreen::Dependency::Sinatra.inspect_middlewares(builder)
|
50
|
+
end
|
51
|
+
end if Sqreen::Dependency::Sinatra.required?
|
52
|
+
|
40
53
|
# ensure startup of thread in request handling processes
|
41
54
|
|
42
55
|
Sqreen::Dependency::Hook.add('Rack::Builder#to_app') do
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
+
# Please refer to our terms for more information: https://www.sqreen.io/terms.html
|
3
|
+
|
4
|
+
module Sqreen
|
5
|
+
module Dependency
|
6
|
+
module Sinatra
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def required?
|
10
|
+
Sqreen::Dependency.const_exist?('Sinatra::Base')
|
11
|
+
end
|
12
|
+
|
13
|
+
def insert_sqreen_middlewares(builder, *args, &block)
|
14
|
+
Sqreen.log.debug { 'Inserting Sqreen middlewares for Sinatra' }
|
15
|
+
middleware = Sqreen::ErrorHandlingMiddleware
|
16
|
+
use = builder.instance_variable_get('@use')
|
17
|
+
|
18
|
+
p = proc { |app| middleware.new(app, *args, &block) }
|
19
|
+
|
20
|
+
return if middlewares(builder).include?(middleware)
|
21
|
+
|
22
|
+
if middlewares(builder).include?(::Sinatra::ShowExceptions)
|
23
|
+
Sqreen.log.warn('Sinatra :show_exceptions detected: Sinatra exception handling may prevent the Sqreen error page to display on attacks.')
|
24
|
+
end
|
25
|
+
|
26
|
+
if (i = middlewares(builder).index(::Rack::Head))
|
27
|
+
use.insert(i, p)
|
28
|
+
elsif (i = middlewares(builder).index(::Rack::MethodOverride))
|
29
|
+
use.insert(i + 1, p)
|
30
|
+
elsif (i = middlewares(builder).index(::Sinatra::ExtendedRack))
|
31
|
+
use.insert(i + 1, p)
|
32
|
+
else
|
33
|
+
use.insert(0, p)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def inspect_middlewares(builder)
|
38
|
+
Sqreen.log.debug do
|
39
|
+
"Middlewares: " << middlewares(builder).map(&:inspect).inspect
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def middlewares(builder)
|
44
|
+
builder.instance_variable_get(:@use).map do |p|
|
45
|
+
unless p.respond_to?(:binding) && p.binding.local_variable_defined?(:middleware)
|
46
|
+
next :unknown
|
47
|
+
end
|
48
|
+
|
49
|
+
p.binding.local_variable_get(:middleware)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/sqreen/version.rb
CHANGED
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.17.2.
|
4
|
+
version: 1.17.2.beta2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/sqreen/dependency/rack.rb
|
76
76
|
- lib/sqreen/dependency/rails.rb
|
77
77
|
- lib/sqreen/dependency/sentry.rb
|
78
|
+
- lib/sqreen/dependency/sinatra.rb
|
78
79
|
- lib/sqreen/event.rb
|
79
80
|
- lib/sqreen/events/attack.rb
|
80
81
|
- lib/sqreen/events/remote_exception.rb
|