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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a1340b0e4265b69cea5bb84456f52586f310ccc03aadd9d6974779707d55329
4
- data.tar.gz: 4da37a0e4bd305d18fc06d164683f46dddf830c54a67c3a3f3481a6314efbc34
3
+ metadata.gz: f332381788705ff90de8cf2f0b3955ace893140821e77ba7cb4d07c2f1e0c06f
4
+ data.tar.gz: 8553b7fc6cfc0f363599518b95ca78142ec21b6c85d34c68b106129a196f3a68
5
5
  SHA512:
6
- metadata.gz: 662b2f798f20452c4a8cd328608277f68748584e2e335a9e2f4cc5a3acdc97fd5345136048f23813c76dee8974a0ae1e62bb2018b97b0d2bbe729d31603fbfec
7
- data.tar.gz: 9f4d4c1efad12ed3831dedb528a677d1cf92bb7a0c3c7a07c21c26b5838a5081e2b3a8944bfb3a89c80b6f80f09c9cb676af23839c401187702038aae014c8cf
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
@@ -0,0 +1,3 @@
1
+ Sqreen for Ruby is free-to-use, proprietary software.
2
+
3
+ Please refer to our terms for more information: https://www.sqreen.com/terms.html
@@ -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
@@ -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
- @libsqreen
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
 
@@ -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
- libsqreen_loaded? && !libsqreen_stub?
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, size_cap: 150, depth_cap: 10, &block)
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, size_cap: 150, depth_cap: 10, &block)
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, size_cap: 4096, &block)
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
@@ -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(string_size_cap: 4096, size_cap: 150, depth_cap: 10, flat_size_cap: 10000)
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, size: @flat_size_cap, depth: @depth_cap)
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)
@@ -2,5 +2,5 @@
2
2
  # Please refer to our terms for more information: https://www.sqreen.com/terms.html
3
3
 
4
4
  module Sqreen
5
- VERSION = '1.18.3.beta2'.freeze
5
+ VERSION = '1.18.3'.freeze
6
6
  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.18.3.beta2
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-18 00:00:00.000000000 Z
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: |2
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: 1.3.1
235
+ version: '0'
236
236
  requirements: []
237
- rubygems_version: 3.0.3
237
+ rubyforge_project:
238
+ rubygems_version: 2.7.7
238
239
  signing_key:
239
240
  specification_version: 4
240
241
  summary: Sqreen Ruby agent