sqreen 1.18.5 → 1.19.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/lib/sqreen/actions.rb +2 -0
- data/lib/sqreen/actions/actions_index.rb +16 -0
- data/lib/sqreen/actions/base.rb +4 -10
- data/lib/sqreen/actions/block_ip.rb +2 -0
- data/lib/sqreen/actions/block_user.rb +2 -0
- data/lib/sqreen/actions/ip_range_indexed_action_class.rb +4 -24
- data/lib/sqreen/actions/ip_ranges_index.rb +32 -11
- data/lib/sqreen/actions/redirect_ip.rb +2 -0
- data/lib/sqreen/actions/redirect_user.rb +2 -0
- data/lib/sqreen/actions/repository.rb +27 -8
- data/lib/sqreen/actions/unknown_action_type.rb +4 -0
- data/lib/sqreen/actions/user_action_class.rb +5 -30
- data/lib/sqreen/actions/users_index.rb +35 -0
- data/lib/sqreen/agent.rb +2 -1
- data/lib/sqreen/attack_blocked.rb +2 -0
- data/lib/sqreen/backport.rb +2 -0
- data/lib/sqreen/backport/clock_gettime.rb +74 -0
- data/lib/sqreen/backport/original_name.rb +2 -0
- data/lib/sqreen/binding_accessor.rb +2 -0
- data/lib/sqreen/binding_accessor/path_elem.rb +2 -0
- data/lib/sqreen/binding_accessor/transforms.rb +8 -1
- data/lib/sqreen/call_countable.rb +2 -0
- data/lib/sqreen/capped_queue.rb +2 -0
- data/lib/sqreen/cb.rb +2 -0
- data/lib/sqreen/cb_tree.rb +2 -0
- data/lib/sqreen/condition_evaluator.rb +2 -0
- data/lib/sqreen/conditionable.rb +2 -0
- data/lib/sqreen/configuration.rb +14 -0
- data/lib/sqreen/context.rb +2 -0
- data/lib/sqreen/default_cb.rb +2 -0
- data/lib/sqreen/deferred_logger.rb +2 -0
- data/lib/sqreen/deliveries.rb +2 -0
- data/lib/sqreen/deliveries/batch.rb +2 -0
- data/lib/sqreen/deliveries/simple.rb +2 -0
- data/lib/sqreen/dependency.rb +3 -1
- data/lib/sqreen/dependency/detector.rb +22 -14
- data/lib/sqreen/dependency/libsqreen.rb +4 -0
- data/lib/sqreen/dependency/new_relic.rb +2 -0
- data/lib/sqreen/dependency/rack.rb +10 -5
- data/lib/sqreen/dependency/rails.rb +4 -0
- data/lib/sqreen/dependency/sentry.rb +2 -0
- data/lib/sqreen/dependency/sinatra.rb +12 -1
- data/lib/sqreen/encoding_sanitizer.rb +2 -0
- data/lib/sqreen/error_handling_middleware.rb +2 -0
- data/lib/sqreen/event.rb +2 -0
- data/lib/sqreen/events/attack.rb +2 -0
- data/lib/sqreen/events/remote_exception.rb +2 -0
- data/lib/sqreen/events/request_record.rb +2 -0
- data/lib/sqreen/exception.rb +2 -0
- data/lib/sqreen/formatter_with_tid.rb +2 -0
- data/lib/sqreen/framework_cb.rb +2 -0
- data/lib/sqreen/frameworks.rb +2 -0
- data/lib/sqreen/frameworks/generic.rb +2 -0
- data/lib/sqreen/frameworks/rails.rb +1 -0
- data/lib/sqreen/frameworks/rails3.rb +2 -0
- data/lib/sqreen/frameworks/request_recorder.rb +2 -0
- data/lib/sqreen/frameworks/sinatra.rb +2 -0
- data/lib/sqreen/frameworks/sqreen_test.rb +2 -0
- data/lib/sqreen/graft.rb +12 -0
- data/lib/sqreen/graft/call.rb +150 -0
- data/lib/sqreen/{dependency → graft}/callback.rb +12 -4
- data/lib/sqreen/graft/hook.rb +316 -0
- data/lib/sqreen/{dependency → graft}/hook_point.rb +152 -33
- data/lib/sqreen/graft/hook_point_error.rb +10 -0
- data/lib/sqreen/invalid_signature_exception.rb +2 -0
- data/lib/sqreen/js.rb +2 -0
- data/lib/sqreen/js/call_context.rb +2 -0
- data/lib/sqreen/js/context_pool.rb +2 -0
- data/lib/sqreen/js/exec_js_runnable.rb +2 -0
- data/lib/sqreen/js/execjs_adapter.rb +2 -0
- data/lib/sqreen/js/executable_js.rb +2 -0
- data/lib/sqreen/js/js_service.rb +2 -0
- data/lib/sqreen/js/js_service_adapter.rb +2 -0
- data/lib/sqreen/js/mini_racer_adapter.rb +2 -0
- data/lib/sqreen/js/mini_racer_executable_js.rb +2 -0
- data/lib/sqreen/js/thread_local_exec_js_runnable.rb +2 -0
- data/lib/sqreen/legacy.rb +8 -0
- data/lib/sqreen/{instrumentation.rb → legacy/instrumentation.rb} +31 -2
- data/lib/sqreen/log.rb +2 -0
- data/lib/sqreen/log/loggable.rb +28 -0
- data/lib/sqreen/logger.rb +2 -0
- data/lib/sqreen/metrics.rb +2 -0
- data/lib/sqreen/metrics/average.rb +2 -0
- data/lib/sqreen/metrics/base.rb +2 -0
- data/lib/sqreen/metrics/binning.rb +2 -0
- data/lib/sqreen/metrics/collect.rb +2 -0
- data/lib/sqreen/metrics/sum.rb +2 -0
- data/lib/sqreen/metrics_store.rb +2 -0
- data/lib/sqreen/metrics_store/already_registered_metric.rb +2 -0
- data/lib/sqreen/metrics_store/unknown_metric.rb +2 -0
- data/lib/sqreen/metrics_store/unregistered_metric.rb +2 -0
- data/lib/sqreen/middleware.rb +2 -0
- data/lib/sqreen/mono_time.rb +2 -0
- data/lib/sqreen/node.rb +2 -0
- data/lib/sqreen/not_implemented_yet.rb +2 -0
- data/lib/sqreen/null_logger.rb +2 -0
- data/lib/sqreen/payload_creator.rb +2 -0
- data/lib/sqreen/payload_creator/header_section.rb +2 -0
- data/lib/sqreen/performance_notifications.rb +2 -0
- data/lib/sqreen/performance_notifications/binned_metrics.rb +2 -0
- data/lib/sqreen/performance_notifications/log.rb +2 -0
- data/lib/sqreen/performance_notifications/log_performance.rb +2 -0
- data/lib/sqreen/performance_notifications/metrics.rb +2 -0
- data/lib/sqreen/performance_notifications/newrelic.rb +2 -0
- data/lib/sqreen/prefix.rb +2 -0
- data/lib/sqreen/rails_middleware.rb +2 -0
- data/lib/sqreen/remote_command.rb +2 -0
- data/lib/sqreen/remote_command/failure_output.rb +5 -0
- data/lib/sqreen/rules.rb +2 -0
- data/lib/sqreen/rules/attrs.rb +2 -0
- data/lib/sqreen/rules/auth_track_cb.rb +2 -0
- data/lib/sqreen/rules/binding_accessor_matcher_cb.rb +2 -0
- data/lib/sqreen/rules/binding_accessor_metrics.rb +2 -0
- data/lib/sqreen/rules/blacklist_ips_cb.rb +2 -0
- data/lib/sqreen/rules/count_http_codes.rb +2 -0
- data/lib/sqreen/rules/crawler_user_agent_matches_cb.rb +2 -0
- data/lib/sqreen/rules/crawler_user_agent_matches_metrics_cb.rb +2 -0
- data/lib/sqreen/rules/custom_error_cb.rb +2 -0
- data/lib/sqreen/rules/devise_auth_track_cb.rb +2 -0
- data/lib/sqreen/rules/devise_signup_track_cb.rb +2 -0
- data/lib/sqreen/rules/execjs_cb.rb +2 -0
- data/lib/sqreen/rules/headers_insert_cb.rb +7 -0
- data/lib/sqreen/rules/matcher_rule.rb +2 -0
- data/lib/sqreen/rules/not_found_cb.rb +7 -0
- data/lib/sqreen/rules/rails_parameters_cb.rb +2 -0
- data/lib/sqreen/rules/record_request_context.rb +2 -0
- data/lib/sqreen/rules/regexp_rule_cb.rb +2 -0
- data/lib/sqreen/rules/rule_cb.rb +2 -0
- data/lib/sqreen/rules/run_req_start_actions.rb +3 -1
- data/lib/sqreen/rules/run_user_actions.rb +3 -1
- data/lib/sqreen/rules/shell_env_cb.rb +2 -0
- data/lib/sqreen/rules/signup_track_cb.rb +2 -0
- data/lib/sqreen/rules/update_request_context.rb +2 -0
- data/lib/sqreen/rules/url_matches_cb.rb +2 -0
- data/lib/sqreen/rules/user_agent_matches_cb.rb +2 -0
- data/lib/sqreen/rules/waf_cb.rb +28 -5
- data/lib/sqreen/rules/xss_cb.rb +2 -0
- data/lib/sqreen/run_when_called_cb.rb +2 -0
- data/lib/sqreen/runner.rb +25 -7
- data/lib/sqreen/runtime_infos.rb +2 -0
- data/lib/sqreen/safe_json.rb +2 -0
- data/lib/sqreen/sdk.rb +4 -0
- data/lib/sqreen/sensitive_data_redactor.rb +2 -0
- data/lib/sqreen/serializer.rb +2 -0
- data/lib/sqreen/session.rb +2 -0
- data/lib/sqreen/shared_storage.rb +2 -0
- data/lib/sqreen/shared_storage23.rb +2 -0
- data/lib/sqreen/shrink_wrap.rb +16 -0
- data/lib/sqreen/signature_verifier.rb +2 -0
- data/lib/sqreen/sinatra_middleware.rb +2 -0
- data/lib/sqreen/sqreen_signed_verifier.rb +2 -0
- data/lib/sqreen/token_invalid_exception.rb +2 -0
- data/lib/sqreen/token_not_found_exception.rb +2 -0
- data/lib/sqreen/trie.rb +2 -0
- data/lib/sqreen/unauthorized.rb +2 -0
- data/lib/sqreen/util.rb +5 -0
- data/lib/sqreen/util/capped_array.rb +2 -0
- data/lib/sqreen/util/capped_hash.rb +2 -0
- data/lib/sqreen/util/capped_string.rb +2 -0
- data/lib/sqreen/util/capper.rb +2 -0
- data/lib/sqreen/version.rb +3 -1
- data/lib/sqreen/waf_error.rb +2 -0
- data/lib/sqreen/weave.rb +12 -0
- data/lib/sqreen/weave/hardcoded.rb +19 -0
- data/lib/sqreen/weave/instrumentor.rb +48 -0
- data/lib/sqreen/weave/legacy.rb +12 -0
- data/lib/sqreen/weave/legacy/instrumentation.rb +406 -0
- data/lib/sqreen/web_server.rb +2 -0
- data/lib/sqreen/web_server/generic.rb +2 -0
- data/lib/sqreen/web_server/passenger.rb +2 -0
- data/lib/sqreen/web_server/puma.rb +2 -0
- data/lib/sqreen/web_server/rainbows.rb +2 -0
- data/lib/sqreen/web_server/thin.rb +2 -0
- data/lib/sqreen/web_server/unicorn.rb +2 -0
- data/lib/sqreen/web_server/webrick.rb +2 -0
- data/lib/sqreen/worker.rb +2 -0
- metadata +28 -9
- data/lib/sqreen/dependency/hook.rb +0 -102
data/lib/sqreen/worker.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.
|
4
|
+
version: 1.19.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sq_mini_racer
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.1.0.0
|
41
41
|
description: Sqreen is a SaaS based Application protection and monitoring platform
|
42
42
|
that integrates directly into your Ruby applications. Learn more at https://sqreen.com.
|
43
43
|
email: contact@sqreen.com
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- lib/sqreen.rb
|
54
54
|
- lib/sqreen/actions.rb
|
55
|
+
- lib/sqreen/actions/actions_index.rb
|
55
56
|
- lib/sqreen/actions/base.rb
|
56
57
|
- lib/sqreen/actions/block_ip.rb
|
57
58
|
- lib/sqreen/actions/block_user.rb
|
@@ -62,10 +63,12 @@ files:
|
|
62
63
|
- lib/sqreen/actions/repository.rb
|
63
64
|
- lib/sqreen/actions/unknown_action_type.rb
|
64
65
|
- lib/sqreen/actions/user_action_class.rb
|
66
|
+
- lib/sqreen/actions/users_index.rb
|
65
67
|
- lib/sqreen/agent.rb
|
66
68
|
- lib/sqreen/attack_blocked.rb
|
67
69
|
- lib/sqreen/attack_detected.html
|
68
70
|
- lib/sqreen/backport.rb
|
71
|
+
- lib/sqreen/backport/clock_gettime.rb
|
69
72
|
- lib/sqreen/backport/original_name.rb
|
70
73
|
- lib/sqreen/binding_accessor.rb
|
71
74
|
- lib/sqreen/binding_accessor/path_elem.rb
|
@@ -85,10 +88,7 @@ files:
|
|
85
88
|
- lib/sqreen/deliveries/batch.rb
|
86
89
|
- lib/sqreen/deliveries/simple.rb
|
87
90
|
- lib/sqreen/dependency.rb
|
88
|
-
- lib/sqreen/dependency/callback.rb
|
89
91
|
- lib/sqreen/dependency/detector.rb
|
90
|
-
- lib/sqreen/dependency/hook.rb
|
91
|
-
- lib/sqreen/dependency/hook_point.rb
|
92
92
|
- lib/sqreen/dependency/libsqreen.rb
|
93
93
|
- lib/sqreen/dependency/new_relic.rb
|
94
94
|
- lib/sqreen/dependency/rack.rb
|
@@ -111,7 +111,12 @@ files:
|
|
111
111
|
- lib/sqreen/frameworks/request_recorder.rb
|
112
112
|
- lib/sqreen/frameworks/sinatra.rb
|
113
113
|
- lib/sqreen/frameworks/sqreen_test.rb
|
114
|
-
- lib/sqreen/
|
114
|
+
- lib/sqreen/graft.rb
|
115
|
+
- lib/sqreen/graft/call.rb
|
116
|
+
- lib/sqreen/graft/callback.rb
|
117
|
+
- lib/sqreen/graft/hook.rb
|
118
|
+
- lib/sqreen/graft/hook_point.rb
|
119
|
+
- lib/sqreen/graft/hook_point_error.rb
|
115
120
|
- lib/sqreen/invalid_signature_exception.rb
|
116
121
|
- lib/sqreen/js.rb
|
117
122
|
- lib/sqreen/js/call_context.rb
|
@@ -124,7 +129,10 @@ files:
|
|
124
129
|
- lib/sqreen/js/mini_racer_adapter.rb
|
125
130
|
- lib/sqreen/js/mini_racer_executable_js.rb
|
126
131
|
- lib/sqreen/js/thread_local_exec_js_runnable.rb
|
132
|
+
- lib/sqreen/legacy.rb
|
133
|
+
- lib/sqreen/legacy/instrumentation.rb
|
127
134
|
- lib/sqreen/log.rb
|
135
|
+
- lib/sqreen/log/loggable.rb
|
128
136
|
- lib/sqreen/logger.rb
|
129
137
|
- lib/sqreen/metrics.rb
|
130
138
|
- lib/sqreen/metrics/average.rb
|
@@ -192,6 +200,7 @@ files:
|
|
192
200
|
- lib/sqreen/session.rb
|
193
201
|
- lib/sqreen/shared_storage.rb
|
194
202
|
- lib/sqreen/shared_storage23.rb
|
203
|
+
- lib/sqreen/shrink_wrap.rb
|
195
204
|
- lib/sqreen/signature_verifier.rb
|
196
205
|
- lib/sqreen/sinatra_middleware.rb
|
197
206
|
- lib/sqreen/sqreen_signed_verifier.rb
|
@@ -206,6 +215,11 @@ files:
|
|
206
215
|
- lib/sqreen/util/capper.rb
|
207
216
|
- lib/sqreen/version.rb
|
208
217
|
- lib/sqreen/waf_error.rb
|
218
|
+
- lib/sqreen/weave.rb
|
219
|
+
- lib/sqreen/weave/hardcoded.rb
|
220
|
+
- lib/sqreen/weave/instrumentor.rb
|
221
|
+
- lib/sqreen/weave/legacy.rb
|
222
|
+
- lib/sqreen/weave/legacy/instrumentation.rb
|
209
223
|
- lib/sqreen/web_server.rb
|
210
224
|
- lib/sqreen/web_server/generic.rb
|
211
225
|
- lib/sqreen/web_server/passenger.rb
|
@@ -218,7 +232,12 @@ files:
|
|
218
232
|
homepage: https://www.sqreen.com/
|
219
233
|
licenses:
|
220
234
|
- Sqreen
|
221
|
-
metadata:
|
235
|
+
metadata:
|
236
|
+
homepage_uri: https://sqreen.com
|
237
|
+
documentation_uri: https://docs.sqreen.com/
|
238
|
+
changelog_uri: https://docs.sqreen.com/ruby/release-notes/
|
239
|
+
source_code_uri: https://github.com/sqreen/ruby-agent
|
240
|
+
bug_tracker_uri: https://github.com/sqreen/ruby-agent/issues
|
222
241
|
post_install_message:
|
223
242
|
rdoc_options: []
|
224
243
|
require_paths:
|
@@ -1,102 +0,0 @@
|
|
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
|
-
require 'sqreen/dependency/callback'
|
5
|
-
require 'sqreen/dependency/hook_point'
|
6
|
-
|
7
|
-
module Sqreen
|
8
|
-
module Dependency
|
9
|
-
class Hook
|
10
|
-
@hooks = {}
|
11
|
-
|
12
|
-
def self.[](hook_point)
|
13
|
-
@hooks[hook_point] ||= new(hook_point)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.add(hook_point, &block)
|
17
|
-
self[hook_point].add(&block)
|
18
|
-
end
|
19
|
-
|
20
|
-
attr_reader :point
|
21
|
-
|
22
|
-
def initialize(hook_point, dependency_test = nil)
|
23
|
-
@disabled = false
|
24
|
-
@point = hook_point.is_a?(HookPoint) ? hook_point : HookPoint.new(hook_point)
|
25
|
-
@before = []
|
26
|
-
@after = []
|
27
|
-
@raised = []
|
28
|
-
@dependency_test = dependency_test || Proc.new { point.exist? }
|
29
|
-
end
|
30
|
-
|
31
|
-
def dependency?
|
32
|
-
@dependency_test.call if @dependency_test
|
33
|
-
end
|
34
|
-
|
35
|
-
def add(&block)
|
36
|
-
tap { instance_eval(&block) }
|
37
|
-
end
|
38
|
-
|
39
|
-
def callback_name(whence, tag = nil)
|
40
|
-
"#{point}@#{whence}" << (tag ? ":#{tag}" : "")
|
41
|
-
end
|
42
|
-
|
43
|
-
def before(tag = nil, &block)
|
44
|
-
return @before if block.nil?
|
45
|
-
|
46
|
-
@before << Callback.new(callback_name(:before, tag), &block)
|
47
|
-
end
|
48
|
-
|
49
|
-
def after(tag = nil, &block)
|
50
|
-
return @after if block.nil?
|
51
|
-
|
52
|
-
@after << Callback.new(callback_name(:after, tag), &block)
|
53
|
-
end
|
54
|
-
|
55
|
-
def raised(tag = nil, &block)
|
56
|
-
return @raised if block.nil?
|
57
|
-
|
58
|
-
@raised << Callback.new(callback_name(:raised, tag), &block)
|
59
|
-
end
|
60
|
-
|
61
|
-
def depends_on(&block)
|
62
|
-
@dependency_test = block
|
63
|
-
end
|
64
|
-
|
65
|
-
def enable
|
66
|
-
@disabled = false
|
67
|
-
end
|
68
|
-
|
69
|
-
def disable
|
70
|
-
@disabled = true
|
71
|
-
end
|
72
|
-
|
73
|
-
def disabled?
|
74
|
-
@disabled
|
75
|
-
end
|
76
|
-
|
77
|
-
def install
|
78
|
-
unless point.exist?
|
79
|
-
Sqreen.log.debug "[#{Process.pid}] #{point} not found"
|
80
|
-
return
|
81
|
-
end
|
82
|
-
Sqreen.log.debug "[#{Process.pid}] Hook #{point}: installing"
|
83
|
-
|
84
|
-
point.install('sqreen_hook', &Sqreen::Dependency::Hook.wrapper(self))
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.wrapper(hook)
|
88
|
-
# pass self to cbs
|
89
|
-
Proc.new do |*args, &block|
|
90
|
-
Sqreen.log.debug "[#{Process.pid}] Hook #{hook.point} disabled:#{hook.disabled?} caller:#{Kernel.caller[1].inspect}"
|
91
|
-
hook.before.each { |c| c.call(c, self, args) } unless hook.disabled?
|
92
|
-
begin
|
93
|
-
hook.point.apply(self, 'sqreen_hook', *args, &block)
|
94
|
-
rescue ::Exception => e # rubocop:disable Lint/RescueException
|
95
|
-
hook.raised.each { |c| c.call(c, self, e, args) } unless hook.disabled?
|
96
|
-
raise
|
97
|
-
end.tap { |v| hook.after.each { |c| c.call(c, self, v, args) } unless hook.disabled? }
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|