sqreen-alt 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +22 -0
- data/README.md +77 -0
- data/Rakefile +20 -0
- data/lib/sqreen-alt.rb +1 -0
- data/lib/sqreen.rb +68 -0
- data/lib/sqreen/attack_detected.html +2 -0
- data/lib/sqreen/binding_accessor.rb +288 -0
- data/lib/sqreen/ca.crt +72 -0
- data/lib/sqreen/call_countable.rb +67 -0
- data/lib/sqreen/callback_tree.rb +78 -0
- data/lib/sqreen/callbacks.rb +100 -0
- data/lib/sqreen/capped_queue.rb +23 -0
- data/lib/sqreen/condition_evaluator.rb +235 -0
- data/lib/sqreen/conditionable.rb +50 -0
- data/lib/sqreen/configuration.rb +168 -0
- data/lib/sqreen/context.rb +26 -0
- data/lib/sqreen/deliveries/batch.rb +84 -0
- data/lib/sqreen/deliveries/simple.rb +39 -0
- data/lib/sqreen/event.rb +16 -0
- data/lib/sqreen/events/attack.rb +61 -0
- data/lib/sqreen/events/remote_exception.rb +54 -0
- data/lib/sqreen/events/request_record.rb +62 -0
- data/lib/sqreen/exception.rb +34 -0
- data/lib/sqreen/frameworks.rb +40 -0
- data/lib/sqreen/frameworks/generic.rb +446 -0
- data/lib/sqreen/frameworks/rails.rb +148 -0
- data/lib/sqreen/frameworks/rails3.rb +36 -0
- data/lib/sqreen/frameworks/request_recorder.rb +69 -0
- data/lib/sqreen/frameworks/sinatra.rb +57 -0
- data/lib/sqreen/frameworks/sqreen_test.rb +26 -0
- data/lib/sqreen/instrumentation.rb +542 -0
- data/lib/sqreen/log.rb +119 -0
- data/lib/sqreen/metrics.rb +6 -0
- data/lib/sqreen/metrics/average.rb +39 -0
- data/lib/sqreen/metrics/base.rb +45 -0
- data/lib/sqreen/metrics/collect.rb +22 -0
- data/lib/sqreen/metrics/sum.rb +20 -0
- data/lib/sqreen/metrics_store.rb +96 -0
- data/lib/sqreen/middleware.rb +34 -0
- data/lib/sqreen/payload_creator.rb +137 -0
- data/lib/sqreen/performance_notifications.rb +86 -0
- data/lib/sqreen/performance_notifications/log.rb +36 -0
- data/lib/sqreen/performance_notifications/metrics.rb +36 -0
- data/lib/sqreen/performance_notifications/newrelic.rb +36 -0
- data/lib/sqreen/remote_command.rb +93 -0
- data/lib/sqreen/rule_attributes.rb +26 -0
- data/lib/sqreen/rule_callback.rb +108 -0
- data/lib/sqreen/rules.rb +126 -0
- data/lib/sqreen/rules_callbacks.rb +29 -0
- data/lib/sqreen/rules_callbacks/binding_accessor_matcher.rb +77 -0
- data/lib/sqreen/rules_callbacks/binding_accessor_metrics.rb +79 -0
- data/lib/sqreen/rules_callbacks/blacklist_ips.rb +44 -0
- data/lib/sqreen/rules_callbacks/count_http_codes.rb +40 -0
- data/lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb +24 -0
- data/lib/sqreen/rules_callbacks/crawler_user_agent_matches_metrics.rb +24 -0
- data/lib/sqreen/rules_callbacks/custom_error.rb +64 -0
- data/lib/sqreen/rules_callbacks/execjs.rb +241 -0
- data/lib/sqreen/rules_callbacks/headers_insert.rb +22 -0
- data/lib/sqreen/rules_callbacks/inspect_rule.rb +25 -0
- data/lib/sqreen/rules_callbacks/matcher_rule.rb +138 -0
- data/lib/sqreen/rules_callbacks/rails_parameters.rb +14 -0
- data/lib/sqreen/rules_callbacks/record_request_context.rb +39 -0
- data/lib/sqreen/rules_callbacks/reflected_xss.rb +254 -0
- data/lib/sqreen/rules_callbacks/regexp_rule.rb +36 -0
- data/lib/sqreen/rules_callbacks/shell_env.rb +32 -0
- data/lib/sqreen/rules_callbacks/url_matches.rb +25 -0
- data/lib/sqreen/rules_callbacks/user_agent_matches.rb +22 -0
- data/lib/sqreen/rules_signature.rb +151 -0
- data/lib/sqreen/runner.rb +365 -0
- data/lib/sqreen/runtime_infos.rb +138 -0
- data/lib/sqreen/safe_json.rb +60 -0
- data/lib/sqreen/sdk.rb +22 -0
- data/lib/sqreen/serializer.rb +46 -0
- data/lib/sqreen/session.rb +317 -0
- data/lib/sqreen/shared_storage.rb +31 -0
- data/lib/sqreen/stats.rb +18 -0
- data/lib/sqreen/version.rb +5 -0
- metadata +148 -0
@@ -0,0 +1,31 @@
|
|
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 SharedStorage
|
6
|
+
|
7
|
+
def self::get(key, default = nil)
|
8
|
+
h = Thread.current["SQREEN_SHARED_STORAGE_#{self.object_id}"]
|
9
|
+
return h.fetch(key, default) if h
|
10
|
+
default
|
11
|
+
end
|
12
|
+
|
13
|
+
def self::set(key, obj)
|
14
|
+
Thread.current["SQREEN_SHARED_STORAGE_#{self.object_id}"] ||= {}
|
15
|
+
Thread.current["SQREEN_SHARED_STORAGE_#{self.object_id}"][key] = obj
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.clear
|
19
|
+
return unless Thread.current["SQREEN_SHARED_STORAGE_#{self.object_id}"].is_a?(Hash)
|
20
|
+
Thread.current["SQREEN_SHARED_STORAGE_#{self.object_id}"].clear
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.inc(value)
|
24
|
+
set(value, get(value, 0) + 1)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.dec(value)
|
28
|
+
set(value, get(value, 0) - 1)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/sqreen/stats.rb
ADDED
@@ -0,0 +1,18 @@
|
|
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
|
+
@@stats = nil
|
6
|
+
|
7
|
+
def self::stats
|
8
|
+
@@stats ||= Stats.new
|
9
|
+
end
|
10
|
+
|
11
|
+
class Stats
|
12
|
+
attr_accessor :callbacks_calls
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@callbacks_calls = 0
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sqreen-alt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.10.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sqreen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: execjs
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mini_racer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
41
|
+
description: Sqreen is a SaaS based Application protection and monitoring platform
|
42
|
+
that integrates directly into your Ruby applications. Learn more at https://sqreen.io.
|
43
|
+
email: contact@sqreen.io
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- CODE_OF_CONDUCT.md
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- lib/sqreen-alt.rb
|
52
|
+
- lib/sqreen.rb
|
53
|
+
- lib/sqreen/attack_detected.html
|
54
|
+
- lib/sqreen/binding_accessor.rb
|
55
|
+
- lib/sqreen/ca.crt
|
56
|
+
- lib/sqreen/call_countable.rb
|
57
|
+
- lib/sqreen/callback_tree.rb
|
58
|
+
- lib/sqreen/callbacks.rb
|
59
|
+
- lib/sqreen/capped_queue.rb
|
60
|
+
- lib/sqreen/condition_evaluator.rb
|
61
|
+
- lib/sqreen/conditionable.rb
|
62
|
+
- lib/sqreen/configuration.rb
|
63
|
+
- lib/sqreen/context.rb
|
64
|
+
- lib/sqreen/deliveries/batch.rb
|
65
|
+
- lib/sqreen/deliveries/simple.rb
|
66
|
+
- lib/sqreen/event.rb
|
67
|
+
- lib/sqreen/events/attack.rb
|
68
|
+
- lib/sqreen/events/remote_exception.rb
|
69
|
+
- lib/sqreen/events/request_record.rb
|
70
|
+
- lib/sqreen/exception.rb
|
71
|
+
- lib/sqreen/frameworks.rb
|
72
|
+
- lib/sqreen/frameworks/generic.rb
|
73
|
+
- lib/sqreen/frameworks/rails.rb
|
74
|
+
- lib/sqreen/frameworks/rails3.rb
|
75
|
+
- lib/sqreen/frameworks/request_recorder.rb
|
76
|
+
- lib/sqreen/frameworks/sinatra.rb
|
77
|
+
- lib/sqreen/frameworks/sqreen_test.rb
|
78
|
+
- lib/sqreen/instrumentation.rb
|
79
|
+
- lib/sqreen/log.rb
|
80
|
+
- lib/sqreen/metrics.rb
|
81
|
+
- lib/sqreen/metrics/average.rb
|
82
|
+
- lib/sqreen/metrics/base.rb
|
83
|
+
- lib/sqreen/metrics/collect.rb
|
84
|
+
- lib/sqreen/metrics/sum.rb
|
85
|
+
- lib/sqreen/metrics_store.rb
|
86
|
+
- lib/sqreen/middleware.rb
|
87
|
+
- lib/sqreen/payload_creator.rb
|
88
|
+
- lib/sqreen/performance_notifications.rb
|
89
|
+
- lib/sqreen/performance_notifications/log.rb
|
90
|
+
- lib/sqreen/performance_notifications/metrics.rb
|
91
|
+
- lib/sqreen/performance_notifications/newrelic.rb
|
92
|
+
- lib/sqreen/remote_command.rb
|
93
|
+
- lib/sqreen/rule_attributes.rb
|
94
|
+
- lib/sqreen/rule_callback.rb
|
95
|
+
- lib/sqreen/rules.rb
|
96
|
+
- lib/sqreen/rules_callbacks.rb
|
97
|
+
- lib/sqreen/rules_callbacks/binding_accessor_matcher.rb
|
98
|
+
- lib/sqreen/rules_callbacks/binding_accessor_metrics.rb
|
99
|
+
- lib/sqreen/rules_callbacks/blacklist_ips.rb
|
100
|
+
- lib/sqreen/rules_callbacks/count_http_codes.rb
|
101
|
+
- lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
|
102
|
+
- lib/sqreen/rules_callbacks/crawler_user_agent_matches_metrics.rb
|
103
|
+
- lib/sqreen/rules_callbacks/custom_error.rb
|
104
|
+
- lib/sqreen/rules_callbacks/execjs.rb
|
105
|
+
- lib/sqreen/rules_callbacks/headers_insert.rb
|
106
|
+
- lib/sqreen/rules_callbacks/inspect_rule.rb
|
107
|
+
- lib/sqreen/rules_callbacks/matcher_rule.rb
|
108
|
+
- lib/sqreen/rules_callbacks/rails_parameters.rb
|
109
|
+
- lib/sqreen/rules_callbacks/record_request_context.rb
|
110
|
+
- lib/sqreen/rules_callbacks/reflected_xss.rb
|
111
|
+
- lib/sqreen/rules_callbacks/regexp_rule.rb
|
112
|
+
- lib/sqreen/rules_callbacks/shell_env.rb
|
113
|
+
- lib/sqreen/rules_callbacks/url_matches.rb
|
114
|
+
- lib/sqreen/rules_callbacks/user_agent_matches.rb
|
115
|
+
- lib/sqreen/rules_signature.rb
|
116
|
+
- lib/sqreen/runner.rb
|
117
|
+
- lib/sqreen/runtime_infos.rb
|
118
|
+
- lib/sqreen/safe_json.rb
|
119
|
+
- lib/sqreen/sdk.rb
|
120
|
+
- lib/sqreen/serializer.rb
|
121
|
+
- lib/sqreen/session.rb
|
122
|
+
- lib/sqreen/shared_storage.rb
|
123
|
+
- lib/sqreen/stats.rb
|
124
|
+
- lib/sqreen/version.rb
|
125
|
+
homepage: https://www.sqreen.io/
|
126
|
+
licenses: []
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.7.5
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Sqreen Ruby agent
|
148
|
+
test_files: []
|