sqreen 1.18.3.beta2 → 1.18.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/LICENSE +3 -0
- data/lib/sqreen/configuration.rb +2 -0
- data/lib/sqreen/dependency/libsqreen.rb +28 -0
- data/lib/sqreen/rules/waf_cb.rb +3 -11
- data/lib/sqreen/runtime_infos.rb +2 -9
- data/lib/sqreen/util/capped_array.rb +4 -1
- data/lib/sqreen/util/capped_hash.rb +4 -1
- data/lib/sqreen/util/capped_string.rb +3 -1
- data/lib/sqreen/util/capper.rb +10 -2
- data/lib/sqreen/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f332381788705ff90de8cf2f0b3955ace893140821e77ba7cb4d07c2f1e0c06f
|
4
|
+
data.tar.gz: 8553b7fc6cfc0f363599518b95ca78142ec21b6c85d34c68b106129a196f3a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35640b7a9a1bcebec2db55feaf2df1b79ed0cba99c1f39b3427a8383b25bf4f61172ca71ba9700eb37c85f9194467179913fb690beb8bec0e7db0a5426258f7c
|
7
|
+
data.tar.gz: fca777b7585ed34bcd8a9f8c4a0f4708b0ece8e0a9c81bdbb2c33f9bc3814b09027462af6697c4578f5751b77be8822df5c075ef5e5ead082ee656f10c743e87
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 1.18.3
|
2
|
+
|
3
|
+
* Improve PII protection
|
4
|
+
* Improve performance on sizeable request payloads
|
5
|
+
* Improve handling of Rails without a database
|
6
|
+
* Improve compatibility with Rack and Sinatra middlewares
|
7
|
+
* Support JSON payloads with rack-contrib PostBodyContentParser
|
8
|
+
* Add libsqreen toggle to configuration
|
9
|
+
* Prepare for Ruby 2.7 support
|
10
|
+
* Include license file in gem
|
11
|
+
|
1
12
|
## 1.18.2
|
2
13
|
|
3
14
|
* Improve internal WAF error reporting
|
data/LICENSE
ADDED
data/lib/sqreen/configuration.rb
CHANGED
@@ -34,6 +34,8 @@ module Sqreen
|
|
34
34
|
CONFIG_DESCRIPTION = [
|
35
35
|
{ :env => :SQREEN_DISABLE, :name => :disable,
|
36
36
|
:default => false, :convert => :to_bool },
|
37
|
+
{ :env => :SQREEN_LIBSQREEN, :name => :libsqreen,
|
38
|
+
:default => true, :convert => :to_bool },
|
37
39
|
{ :env => :SQREEN_URL, :name => :url,
|
38
40
|
:default => 'https://back.sqreen.io' },
|
39
41
|
{ :env => :SQREEN_TOKEN, :name => :token,
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
+
# Please refer to our terms for more information: https://www.sqreen.com/terms.html
|
3
|
+
|
4
|
+
module Sqreen
|
5
|
+
module Dependency
|
6
|
+
module LibSqreen
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def require_libsqreen
|
10
|
+
raise LoadError, 'libsqreen forcefully disabled by configuration' unless Sqreen.config_get('libsqreen')
|
11
|
+
require 'libsqreen'
|
12
|
+
@libsqreen = true
|
13
|
+
rescue LoadError => e
|
14
|
+
Sqreen.log.warn("libsqreen gem not required: #{e.message}")
|
15
|
+
@libsqreen = false
|
16
|
+
end
|
17
|
+
|
18
|
+
def required?
|
19
|
+
require_libsqreen if @libsqreen.nil?
|
20
|
+
Sqreen::Dependency.const_exist?('LibSqreen')
|
21
|
+
end
|
22
|
+
|
23
|
+
def stub?
|
24
|
+
!::LibSqreen.respond_to?(:version)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/sqreen/rules/waf_cb.rb
CHANGED
@@ -8,23 +8,15 @@ require 'sqreen/rules/rule_cb'
|
|
8
8
|
require 'sqreen/safe_json'
|
9
9
|
require 'sqreen/exception'
|
10
10
|
require 'sqreen/util/capper'
|
11
|
+
require 'sqreen/dependency/libsqreen'
|
11
12
|
|
12
13
|
module Sqreen
|
13
14
|
module Rules
|
14
15
|
class WAFCB < RuleCB
|
15
16
|
BUDGET_MAX = 5000
|
16
17
|
|
17
|
-
# TODO: move to Dependency
|
18
|
-
begin
|
19
|
-
require 'libsqreen'
|
20
|
-
@libsqreen = true
|
21
|
-
rescue LoadError
|
22
|
-
Sqreen.log.warn('libsqreen gem not found')
|
23
|
-
@libsqreen = false
|
24
|
-
end
|
25
|
-
|
26
18
|
def self.libsqreen?
|
27
|
-
|
19
|
+
Sqreen::Dependency::LibSqreen.required?
|
28
20
|
end
|
29
21
|
|
30
22
|
def self.waf?
|
@@ -38,7 +30,7 @@ module Sqreen
|
|
38
30
|
@overtimeable = false
|
39
31
|
|
40
32
|
unless WAFCB.libsqreen? && WAFCB.waf?
|
41
|
-
Sqreen.log.warn('libsqreen gem not found')
|
33
|
+
Sqreen.log.warn('libsqreen gem with waf not found')
|
42
34
|
return
|
43
35
|
end
|
44
36
|
|
data/lib/sqreen/runtime_infos.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'sqreen/version'
|
5
5
|
require 'sqreen/frameworks'
|
6
|
+
require 'sqreen/dependency/libsqreen'
|
6
7
|
|
7
8
|
require 'socket'
|
8
9
|
require 'digest/sha1'
|
@@ -71,15 +72,7 @@ module Sqreen
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def libsqreen?
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
def libsqreen_loaded?
|
78
|
-
Kernel.const_defined?('LibSqreen')
|
79
|
-
end
|
80
|
-
|
81
|
-
def libsqreen_stub?
|
82
|
-
!::LibSqreen.respond_to?(:version)
|
75
|
+
Sqreen::Dependency::LibSqreen.required? && !Sqreen::Dependency::LibSqreen.stub?
|
83
76
|
end
|
84
77
|
|
85
78
|
def libsqreen_version
|
@@ -6,7 +6,10 @@ require 'sqreen/util'
|
|
6
6
|
class Sqreen::Util::CappedArray < Array
|
7
7
|
attr_reader :size_cap, :depth_cap
|
8
8
|
|
9
|
-
def initialize(*args,
|
9
|
+
def initialize(*args, &block)
|
10
|
+
opts = args.last.is_a?(Hash) ? args.pop : {}
|
11
|
+
size_cap = opts[:size_cap] || 150
|
12
|
+
depth_cap = opts[:depth_cap] || 10
|
10
13
|
@size_cap = size_cap
|
11
14
|
@depth_cap = depth_cap
|
12
15
|
|
@@ -6,7 +6,10 @@ require 'sqreen/util'
|
|
6
6
|
class Sqreen::Util::CappedHash < Hash
|
7
7
|
attr_reader :size_cap, :depth_cap
|
8
8
|
|
9
|
-
def initialize(*args,
|
9
|
+
def initialize(*args, &block)
|
10
|
+
opts = args.last.is_a?(Hash) ? args.pop : {}
|
11
|
+
size_cap = opts[:size_cap] || 150
|
12
|
+
depth_cap = opts[:depth_cap] || 10
|
10
13
|
@size_cap = size_cap
|
11
14
|
@depth_cap = depth_cap
|
12
15
|
|
@@ -6,7 +6,9 @@ require 'sqreen/util'
|
|
6
6
|
class Sqreen::Util::CappedString < String
|
7
7
|
attr_reader :size_cap
|
8
8
|
|
9
|
-
def initialize(*args,
|
9
|
+
def initialize(*args, &block)
|
10
|
+
opts = args.last.is_a?(Hash) ? args.pop : {}
|
11
|
+
size_cap = opts[:size_cap] || 4096
|
10
12
|
@size_cap = size_cap
|
11
13
|
super(*args, &block)
|
12
14
|
end
|
data/lib/sqreen/util/capper.rb
CHANGED
@@ -9,7 +9,12 @@ require 'sqreen/util/capped_array'
|
|
9
9
|
class Sqreen::Util::Capper
|
10
10
|
attr_reader :string_size_cap, :size_cap, :depth_cap
|
11
11
|
|
12
|
-
def initialize(
|
12
|
+
def initialize(opts = {})
|
13
|
+
string_size_cap = opts[:string_size_cap] || 4096
|
14
|
+
size_cap = opts[:size_cap] || 150
|
15
|
+
depth_cap = opts[:depth_cap] || 10
|
16
|
+
flat_size_cap = opts[:flat_size_cap] || 10000
|
17
|
+
|
13
18
|
@string_size_cap = string_size_cap
|
14
19
|
@size_cap = size_cap
|
15
20
|
@depth_cap = depth_cap
|
@@ -22,7 +27,10 @@ class Sqreen::Util::Capper
|
|
22
27
|
|
23
28
|
private
|
24
29
|
|
25
|
-
def r_call(e,
|
30
|
+
def r_call(e, opts = {})
|
31
|
+
size = opts[:size] || @flat_size_cap
|
32
|
+
depth = opts[:depth] || @depth_cap
|
33
|
+
|
26
34
|
case e
|
27
35
|
when Hash
|
28
36
|
h = Sqreen::Util::CappedHash.new(size_cap: size_cap, depth_cap: depth)
|
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.18.3
|
4
|
+
version: 1.18.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sq_mini_racer
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- CHANGELOG.md
|
49
49
|
- CODE_OF_CONDUCT.md
|
50
|
+
- LICENSE
|
50
51
|
- README.md
|
51
52
|
- Rakefile
|
52
53
|
- lib/sqreen.rb
|
@@ -88,6 +89,7 @@ files:
|
|
88
89
|
- lib/sqreen/dependency/detector.rb
|
89
90
|
- lib/sqreen/dependency/hook.rb
|
90
91
|
- lib/sqreen/dependency/hook_point.rb
|
92
|
+
- lib/sqreen/dependency/libsqreen.rb
|
91
93
|
- lib/sqreen/dependency/new_relic.rb
|
92
94
|
- lib/sqreen/dependency/rack.rb
|
93
95
|
- lib/sqreen/dependency/rails.rb
|
@@ -217,9 +219,7 @@ homepage: https://www.sqreen.com/
|
|
217
219
|
licenses:
|
218
220
|
- Sqreen
|
219
221
|
metadata: {}
|
220
|
-
post_install_message:
|
221
|
-
This is a Sqreen beta release and may not work in all situations.
|
222
|
-
Make sure to review CHANGELOG.md for important details.
|
222
|
+
post_install_message:
|
223
223
|
rdoc_options: []
|
224
224
|
require_paths:
|
225
225
|
- lib
|
@@ -230,11 +230,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
230
|
version: 1.9.3
|
231
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
232
|
requirements:
|
233
|
-
- - "
|
233
|
+
- - ">="
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
version:
|
235
|
+
version: '0'
|
236
236
|
requirements: []
|
237
|
-
|
237
|
+
rubyforge_project:
|
238
|
+
rubygems_version: 2.7.7
|
238
239
|
signing_key:
|
239
240
|
specification_version: 4
|
240
241
|
summary: Sqreen Ruby agent
|