sqreen 1.20.0-java → 1.21.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +37 -0
  3. data/lib/sqreen/actions/block_user.rb +1 -1
  4. data/lib/sqreen/actions/redirect_ip.rb +1 -1
  5. data/lib/sqreen/actions/redirect_user.rb +1 -1
  6. data/lib/sqreen/agent_message.rb +20 -0
  7. data/lib/sqreen/attack_detected.html +1 -2
  8. data/lib/sqreen/ca.crt +24 -0
  9. data/lib/sqreen/condition_evaluator.rb +8 -2
  10. data/lib/sqreen/configuration.rb +5 -3
  11. data/lib/sqreen/deferred_logger.rb +50 -14
  12. data/lib/sqreen/deliveries/batch.rb +8 -1
  13. data/lib/sqreen/dependency/detector.rb +11 -3
  14. data/lib/sqreen/dependency/new_relic.rb +10 -1
  15. data/lib/sqreen/deprecation.rb +38 -0
  16. data/lib/sqreen/ecosystem.rb +123 -0
  17. data/lib/sqreen/ecosystem/databases/database_connection_data.rb +23 -0
  18. data/lib/sqreen/ecosystem/databases/mongo.rb +39 -0
  19. data/lib/sqreen/ecosystem/databases/mysql.rb +54 -0
  20. data/lib/sqreen/ecosystem/databases/postgres.rb +51 -0
  21. data/lib/sqreen/ecosystem/databases/redis.rb +36 -0
  22. data/lib/sqreen/ecosystem/dispatch_table.rb +43 -0
  23. data/lib/sqreen/ecosystem/exception_reporting.rb +28 -0
  24. data/lib/sqreen/ecosystem/http/net_http.rb +50 -0
  25. data/lib/sqreen/ecosystem/http/rack_request.rb +39 -0
  26. data/lib/sqreen/ecosystem/loggable.rb +13 -0
  27. data/lib/sqreen/ecosystem/messaging/bunny.rb +61 -0
  28. data/lib/sqreen/ecosystem/messaging/kafka.rb +70 -0
  29. data/lib/sqreen/ecosystem/messaging/kinesis.rb +66 -0
  30. data/lib/sqreen/ecosystem/messaging/sqs.rb +68 -0
  31. data/lib/sqreen/ecosystem/module_api.rb +30 -0
  32. data/lib/sqreen/ecosystem/module_api/event_listener.rb +18 -0
  33. data/lib/sqreen/ecosystem/module_api/instrumentation.rb +23 -0
  34. data/lib/sqreen/ecosystem/module_api/message_producer.rb +57 -0
  35. data/lib/sqreen/ecosystem/module_api/signal_producer.rb +24 -0
  36. data/lib/sqreen/ecosystem/module_api/tracing.rb +45 -0
  37. data/lib/sqreen/ecosystem/module_api/tracing/client_data.rb +31 -0
  38. data/lib/sqreen/ecosystem/module_api/tracing/consumer_data.rb +13 -0
  39. data/lib/sqreen/ecosystem/module_api/tracing/messaging_data.rb +35 -0
  40. data/lib/sqreen/ecosystem/module_api/tracing/producer_data.rb +13 -0
  41. data/lib/sqreen/ecosystem/module_api/tracing/server_data.rb +27 -0
  42. data/lib/sqreen/ecosystem/module_api/tracing_id_generation.rb +16 -0
  43. data/lib/sqreen/ecosystem/module_api/transaction_storage.rb +71 -0
  44. data/lib/sqreen/ecosystem/module_registry.rb +48 -0
  45. data/lib/sqreen/ecosystem/tracing/modules/client.rb +35 -0
  46. data/lib/sqreen/ecosystem/tracing/modules/consumer.rb +35 -0
  47. data/lib/sqreen/ecosystem/tracing/modules/determine_ip.rb +28 -0
  48. data/lib/sqreen/ecosystem/tracing/modules/producer.rb +35 -0
  49. data/lib/sqreen/ecosystem/tracing/modules/server.rb +30 -0
  50. data/lib/sqreen/ecosystem/tracing/sampler.rb +160 -0
  51. data/lib/sqreen/ecosystem/tracing/sampling_configuration.rb +150 -0
  52. data/lib/sqreen/ecosystem/tracing/signals/tracing_client.rb +53 -0
  53. data/lib/sqreen/ecosystem/tracing/signals/tracing_consumer.rb +56 -0
  54. data/lib/sqreen/ecosystem/tracing/signals/tracing_producer.rb +56 -0
  55. data/lib/sqreen/ecosystem/tracing/signals/tracing_server.rb +53 -0
  56. data/lib/sqreen/ecosystem/tracing_broker.rb +101 -0
  57. data/lib/sqreen/ecosystem/tracing_id_setup.rb +34 -0
  58. data/lib/sqreen/ecosystem/transaction_storage.rb +64 -0
  59. data/lib/sqreen/ecosystem/util/call_writers_from_init.rb +13 -0
  60. data/lib/sqreen/ecosystem_integration.rb +81 -0
  61. data/lib/sqreen/ecosystem_integration/around_callbacks.rb +89 -0
  62. data/lib/sqreen/ecosystem_integration/instrumentation_service.rb +38 -0
  63. data/lib/sqreen/ecosystem_integration/request_lifecycle_tracking.rb +58 -0
  64. data/lib/sqreen/ecosystem_integration/signal_consumption.rb +35 -0
  65. data/lib/sqreen/endpoint_testing.rb +184 -0
  66. data/lib/sqreen/events/request_record.rb +0 -1
  67. data/lib/sqreen/frameworks/generic.rb +24 -1
  68. data/lib/sqreen/frameworks/rails.rb +0 -7
  69. data/lib/sqreen/frameworks/request_recorder.rb +2 -0
  70. data/lib/sqreen/graft/call.rb +85 -18
  71. data/lib/sqreen/graft/callback.rb +1 -1
  72. data/lib/sqreen/graft/hook.rb +192 -88
  73. data/lib/sqreen/graft/hook_point.rb +18 -11
  74. data/lib/sqreen/kit/signals/specialized/sqreen_exception.rb +2 -0
  75. data/lib/sqreen/legacy/instrumentation.rb +22 -10
  76. data/lib/sqreen/legacy/old_event_submission_strategy.rb +9 -2
  77. data/lib/sqreen/log.rb +3 -2
  78. data/lib/sqreen/log/loggable.rb +2 -1
  79. data/lib/sqreen/logger.rb +24 -0
  80. data/lib/sqreen/metrics_store.rb +11 -0
  81. data/lib/sqreen/null_logger.rb +22 -0
  82. data/lib/sqreen/remote_command.rb +4 -0
  83. data/lib/sqreen/rules.rb +8 -4
  84. data/lib/sqreen/rules/blacklist_ips_cb.rb +2 -2
  85. data/lib/sqreen/rules/custom_error_cb.rb +3 -3
  86. data/lib/sqreen/rules/rule_cb.rb +2 -0
  87. data/lib/sqreen/rules/waf_cb.rb +3 -3
  88. data/lib/sqreen/runner.rb +83 -14
  89. data/lib/sqreen/session.rb +19 -11
  90. data/lib/sqreen/signals/conversions.rb +6 -1
  91. data/lib/sqreen/version.rb +1 -1
  92. data/lib/sqreen/weave/budget.rb +46 -0
  93. data/lib/sqreen/weave/legacy/instrumentation.rb +194 -103
  94. data/lib/sqreen/worker.rb +6 -2
  95. metadata +58 -6
  96. data/lib/sqreen/encoding_sanitizer.rb +0 -27
@@ -23,11 +23,15 @@ module Sqreen
23
23
  Sqreen.log.debug("Starting Sqreen #{Sqreen::VERSION}")
24
24
  prevent_startup = Sqreen.framework.prevent_startup
25
25
  if !prevent_startup
26
- warn "[#{Process.pid}] Sqreen logging at level #{Sqreen.log.instance_eval { @logger }.level} to #{Sqreen.log.instance_eval { @logger }.instance_eval { @logdev.filename }}"
26
+ logger = Sqreen.log.instance_eval { @logger }
27
+ log_level = logger.send(:format_severity, logger.level)
28
+ log_filename = logger.instance_eval { @logdev.filename }
29
+ warn "process.pid:#{Process.pid} sqreen.log.level:#{log_level} sqreen.log.location:#{log_filename.inspect}"
27
30
  runner = Sqreen::Runner.new(configuration, framework)
28
31
  runner.run_watcher
32
+ Sqreen.log.info("process.pid:#{Process.pid} sqreen.start:true")
29
33
  else
30
- Sqreen.log.debug("#{prevent_startup} prevented Sqreen startup")
34
+ Sqreen.log.info("process.pid:#{Process.pid} sqreen.start:false cause:#{prevent_startup}")
31
35
  end
32
36
  rescue Sqreen::TokenNotFoundException
33
37
  Sqreen.log.error "Sorry but we couldn't find your Sqreen token.\nYour application is NOT currently protected by Sqreen.\n\nHave you filled your config/sqreen.yml?\n\n"
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.20.0
4
+ version: 1.21.1
5
5
  platform: java
6
6
  authors:
7
7
  - Sqreen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 0.2.0
32
+ version: 0.2.2
33
33
  name: sqreen-kit
34
34
  prerelease: false
35
35
  type: :runtime
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.0
40
+ version: 0.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
@@ -93,6 +93,7 @@ files:
93
93
  - lib/sqreen/actions/user_action_class.rb
94
94
  - lib/sqreen/actions/users_index.rb
95
95
  - lib/sqreen/agent.rb
96
+ - lib/sqreen/agent_message.rb
96
97
  - lib/sqreen/aggregated_metric.rb
97
98
  - lib/sqreen/attack_blocked.rb
98
99
  - lib/sqreen/attack_detected.html
@@ -121,7 +122,57 @@ files:
121
122
  - lib/sqreen/dependency/rails.rb
122
123
  - lib/sqreen/dependency/sentry.rb
123
124
  - lib/sqreen/dependency/sinatra.rb
124
- - lib/sqreen/encoding_sanitizer.rb
125
+ - lib/sqreen/deprecation.rb
126
+ - lib/sqreen/ecosystem.rb
127
+ - lib/sqreen/ecosystem/databases/database_connection_data.rb
128
+ - lib/sqreen/ecosystem/databases/mongo.rb
129
+ - lib/sqreen/ecosystem/databases/mysql.rb
130
+ - lib/sqreen/ecosystem/databases/postgres.rb
131
+ - lib/sqreen/ecosystem/databases/redis.rb
132
+ - lib/sqreen/ecosystem/dispatch_table.rb
133
+ - lib/sqreen/ecosystem/exception_reporting.rb
134
+ - lib/sqreen/ecosystem/http/net_http.rb
135
+ - lib/sqreen/ecosystem/http/rack_request.rb
136
+ - lib/sqreen/ecosystem/loggable.rb
137
+ - lib/sqreen/ecosystem/messaging/bunny.rb
138
+ - lib/sqreen/ecosystem/messaging/kafka.rb
139
+ - lib/sqreen/ecosystem/messaging/kinesis.rb
140
+ - lib/sqreen/ecosystem/messaging/sqs.rb
141
+ - lib/sqreen/ecosystem/module_api.rb
142
+ - lib/sqreen/ecosystem/module_api/event_listener.rb
143
+ - lib/sqreen/ecosystem/module_api/instrumentation.rb
144
+ - lib/sqreen/ecosystem/module_api/message_producer.rb
145
+ - lib/sqreen/ecosystem/module_api/signal_producer.rb
146
+ - lib/sqreen/ecosystem/module_api/tracing.rb
147
+ - lib/sqreen/ecosystem/module_api/tracing/client_data.rb
148
+ - lib/sqreen/ecosystem/module_api/tracing/consumer_data.rb
149
+ - lib/sqreen/ecosystem/module_api/tracing/messaging_data.rb
150
+ - lib/sqreen/ecosystem/module_api/tracing/producer_data.rb
151
+ - lib/sqreen/ecosystem/module_api/tracing/server_data.rb
152
+ - lib/sqreen/ecosystem/module_api/tracing_id_generation.rb
153
+ - lib/sqreen/ecosystem/module_api/transaction_storage.rb
154
+ - lib/sqreen/ecosystem/module_registry.rb
155
+ - lib/sqreen/ecosystem/tracing/modules/client.rb
156
+ - lib/sqreen/ecosystem/tracing/modules/consumer.rb
157
+ - lib/sqreen/ecosystem/tracing/modules/determine_ip.rb
158
+ - lib/sqreen/ecosystem/tracing/modules/producer.rb
159
+ - lib/sqreen/ecosystem/tracing/modules/server.rb
160
+ - lib/sqreen/ecosystem/tracing/sampler.rb
161
+ - lib/sqreen/ecosystem/tracing/sampling_configuration.rb
162
+ - lib/sqreen/ecosystem/tracing/signals/tracing_client.rb
163
+ - lib/sqreen/ecosystem/tracing/signals/tracing_consumer.rb
164
+ - lib/sqreen/ecosystem/tracing/signals/tracing_producer.rb
165
+ - lib/sqreen/ecosystem/tracing/signals/tracing_server.rb
166
+ - lib/sqreen/ecosystem/tracing_broker.rb
167
+ - lib/sqreen/ecosystem/tracing_id_setup.rb
168
+ - lib/sqreen/ecosystem/transaction_storage.rb
169
+ - lib/sqreen/ecosystem/util/call_writers_from_init.rb
170
+ - lib/sqreen/ecosystem_integration.rb
171
+ - lib/sqreen/ecosystem_integration/around_callbacks.rb
172
+ - lib/sqreen/ecosystem_integration/instrumentation_service.rb
173
+ - lib/sqreen/ecosystem_integration/request_lifecycle_tracking.rb
174
+ - lib/sqreen/ecosystem_integration/signal_consumption.rb
175
+ - lib/sqreen/endpoint_testing.rb
125
176
  - lib/sqreen/error_handling_middleware.rb
126
177
  - lib/sqreen/event.rb
127
178
  - lib/sqreen/events/attack.rb
@@ -253,6 +304,7 @@ files:
253
304
  - lib/sqreen/version.rb
254
305
  - lib/sqreen/waf_error.rb
255
306
  - lib/sqreen/weave.rb
307
+ - lib/sqreen/weave/budget.rb
256
308
  - lib/sqreen/weave/hardcoded.rb
257
309
  - lib/sqreen/weave/instrumentor.rb
258
310
  - lib/sqreen/weave/legacy.rb
@@ -291,7 +343,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
343
  version: '0'
292
344
  requirements: []
293
345
  rubyforge_project:
294
- rubygems_version: 2.7.7
346
+ rubygems_version: 2.6.14.1
295
347
  signing_key:
296
348
  specification_version: 4
297
349
  summary: Sqreen Ruby agent
@@ -1,27 +0,0 @@
1
- # typed: true
2
-
3
- # Copyright (c) 2015 Sqreen. All Rights Reserved.
4
- # Please refer to our terms for more information: https://www.sqreen.com/terms.html
5
-
6
- module Sqreen
7
- class EncodingSanitizer
8
- def self.sanitize(obj)
9
- case obj
10
- when String
11
- sanitize_string(obj)
12
- when Array
13
- obj.map { |e| sanitize(e) }
14
- when Hash
15
- obj.each_with_object({}) { |(k, v), h| h[k] = sanitize(v) }
16
- else
17
- obj
18
- end
19
- end
20
-
21
- def self.sanitize_string(s)
22
- return s if s.encoding.name == 'UTF-8' && s.valid_encoding?
23
-
24
- s.encode('UTF-16', :invalid => :replace, :undef => :replace).encode('UTF-8')
25
- end
26
- end
27
- end