sqreen 1.20.1-java → 1.21.0.beta3-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +16 -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/attack_detected.html +1 -2
  7. data/lib/sqreen/condition_evaluator.rb +9 -2
  8. data/lib/sqreen/conditionable.rb +24 -6
  9. data/lib/sqreen/configuration.rb +1 -1
  10. data/lib/sqreen/deferred_logger.rb +50 -14
  11. data/lib/sqreen/deliveries/batch.rb +8 -1
  12. data/lib/sqreen/deprecation.rb +38 -0
  13. data/lib/sqreen/ecosystem.rb +96 -0
  14. data/lib/sqreen/ecosystem/dispatch_table.rb +43 -0
  15. data/lib/sqreen/ecosystem/exception_reporting.rb +26 -0
  16. data/lib/sqreen/ecosystem/http/net_http.rb +50 -0
  17. data/lib/sqreen/ecosystem/http/rack_request.rb +39 -0
  18. data/lib/sqreen/ecosystem/loggable.rb +13 -0
  19. data/lib/sqreen/ecosystem/module_api.rb +30 -0
  20. data/lib/sqreen/ecosystem/module_api/event_listener.rb +18 -0
  21. data/lib/sqreen/ecosystem/module_api/instrumentation.rb +23 -0
  22. data/lib/sqreen/ecosystem/module_api/message_producer.rb +51 -0
  23. data/lib/sqreen/ecosystem/module_api/signal_producer.rb +24 -0
  24. data/lib/sqreen/ecosystem/module_api/tracing.rb +45 -0
  25. data/lib/sqreen/ecosystem/module_api/tracing/client_data.rb +31 -0
  26. data/lib/sqreen/ecosystem/module_api/tracing/server_data.rb +27 -0
  27. data/lib/sqreen/ecosystem/module_api/tracing_id_generation.rb +16 -0
  28. data/lib/sqreen/ecosystem/module_api/transaction_storage.rb +71 -0
  29. data/lib/sqreen/ecosystem/module_registry.rb +44 -0
  30. data/lib/sqreen/ecosystem/redis/redis_connection.rb +43 -0
  31. data/lib/sqreen/ecosystem/tracing/modules/client.rb +31 -0
  32. data/lib/sqreen/ecosystem/tracing/modules/server.rb +30 -0
  33. data/lib/sqreen/ecosystem/tracing/sampler.rb +160 -0
  34. data/lib/sqreen/ecosystem/tracing/sampling_configuration.rb +150 -0
  35. data/lib/sqreen/ecosystem/tracing/signals/tracing_client.rb +53 -0
  36. data/lib/sqreen/ecosystem/tracing/signals/tracing_server.rb +53 -0
  37. data/lib/sqreen/ecosystem/tracing_broker.rb +101 -0
  38. data/lib/sqreen/ecosystem/tracing_id_setup.rb +34 -0
  39. data/lib/sqreen/ecosystem/transaction_storage.rb +64 -0
  40. data/lib/sqreen/ecosystem/util/call_writers_from_init.rb +13 -0
  41. data/lib/sqreen/ecosystem_integration.rb +87 -0
  42. data/lib/sqreen/ecosystem_integration/around_callbacks.rb +99 -0
  43. data/lib/sqreen/ecosystem_integration/instrumentation_service.rb +42 -0
  44. data/lib/sqreen/ecosystem_integration/request_lifecycle_tracking.rb +58 -0
  45. data/lib/sqreen/ecosystem_integration/signal_consumption.rb +35 -0
  46. data/lib/sqreen/events/request_record.rb +0 -1
  47. data/lib/sqreen/frameworks/generic.rb +24 -1
  48. data/lib/sqreen/frameworks/rails.rb +0 -7
  49. data/lib/sqreen/frameworks/request_recorder.rb +2 -0
  50. data/lib/sqreen/graft/call.rb +106 -19
  51. data/lib/sqreen/graft/callback.rb +1 -1
  52. data/lib/sqreen/graft/hook.rb +212 -100
  53. data/lib/sqreen/graft/hook_point.rb +18 -11
  54. data/lib/sqreen/legacy/instrumentation.rb +22 -10
  55. data/lib/sqreen/legacy/old_event_submission_strategy.rb +9 -2
  56. data/lib/sqreen/log.rb +3 -2
  57. data/lib/sqreen/log/loggable.rb +1 -0
  58. data/lib/sqreen/logger.rb +24 -0
  59. data/lib/sqreen/metrics.rb +1 -0
  60. data/lib/sqreen/metrics/req_detailed.rb +41 -0
  61. data/lib/sqreen/metrics_store.rb +11 -0
  62. data/lib/sqreen/null_logger.rb +22 -0
  63. data/lib/sqreen/remote_command.rb +4 -0
  64. data/lib/sqreen/rules.rb +8 -4
  65. data/lib/sqreen/rules/blacklist_ips_cb.rb +2 -2
  66. data/lib/sqreen/rules/custom_error_cb.rb +3 -3
  67. data/lib/sqreen/rules/rule_cb.rb +4 -2
  68. data/lib/sqreen/rules/waf_cb.rb +3 -3
  69. data/lib/sqreen/runner.rb +63 -8
  70. data/lib/sqreen/session.rb +2 -0
  71. data/lib/sqreen/signals/conversions.rb +6 -1
  72. data/lib/sqreen/version.rb +1 -1
  73. data/lib/sqreen/weave/budget.rb +35 -0
  74. data/lib/sqreen/weave/legacy/instrumentation.rb +274 -132
  75. data/lib/sqreen/worker.rb +6 -2
  76. metadata +46 -9
  77. 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.1
4
+ version: 1.21.0.beta3
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-24 00:00:00.000000000 Z
11
+ date: 2020-09-14 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.1
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.1
40
+ version: 0.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
@@ -122,7 +122,40 @@ files:
122
122
  - lib/sqreen/dependency/rails.rb
123
123
  - lib/sqreen/dependency/sentry.rb
124
124
  - lib/sqreen/dependency/sinatra.rb
125
- - lib/sqreen/encoding_sanitizer.rb
125
+ - lib/sqreen/deprecation.rb
126
+ - lib/sqreen/ecosystem.rb
127
+ - lib/sqreen/ecosystem/dispatch_table.rb
128
+ - lib/sqreen/ecosystem/exception_reporting.rb
129
+ - lib/sqreen/ecosystem/http/net_http.rb
130
+ - lib/sqreen/ecosystem/http/rack_request.rb
131
+ - lib/sqreen/ecosystem/loggable.rb
132
+ - lib/sqreen/ecosystem/module_api.rb
133
+ - lib/sqreen/ecosystem/module_api/event_listener.rb
134
+ - lib/sqreen/ecosystem/module_api/instrumentation.rb
135
+ - lib/sqreen/ecosystem/module_api/message_producer.rb
136
+ - lib/sqreen/ecosystem/module_api/signal_producer.rb
137
+ - lib/sqreen/ecosystem/module_api/tracing.rb
138
+ - lib/sqreen/ecosystem/module_api/tracing/client_data.rb
139
+ - lib/sqreen/ecosystem/module_api/tracing/server_data.rb
140
+ - lib/sqreen/ecosystem/module_api/tracing_id_generation.rb
141
+ - lib/sqreen/ecosystem/module_api/transaction_storage.rb
142
+ - lib/sqreen/ecosystem/module_registry.rb
143
+ - lib/sqreen/ecosystem/redis/redis_connection.rb
144
+ - lib/sqreen/ecosystem/tracing/modules/client.rb
145
+ - lib/sqreen/ecosystem/tracing/modules/server.rb
146
+ - lib/sqreen/ecosystem/tracing/sampler.rb
147
+ - lib/sqreen/ecosystem/tracing/sampling_configuration.rb
148
+ - lib/sqreen/ecosystem/tracing/signals/tracing_client.rb
149
+ - lib/sqreen/ecosystem/tracing/signals/tracing_server.rb
150
+ - lib/sqreen/ecosystem/tracing_broker.rb
151
+ - lib/sqreen/ecosystem/tracing_id_setup.rb
152
+ - lib/sqreen/ecosystem/transaction_storage.rb
153
+ - lib/sqreen/ecosystem/util/call_writers_from_init.rb
154
+ - lib/sqreen/ecosystem_integration.rb
155
+ - lib/sqreen/ecosystem_integration/around_callbacks.rb
156
+ - lib/sqreen/ecosystem_integration/instrumentation_service.rb
157
+ - lib/sqreen/ecosystem_integration/request_lifecycle_tracking.rb
158
+ - lib/sqreen/ecosystem_integration/signal_consumption.rb
126
159
  - lib/sqreen/endpoint_testing.rb
127
160
  - lib/sqreen/error_handling_middleware.rb
128
161
  - lib/sqreen/event.rb
@@ -175,6 +208,7 @@ files:
175
208
  - lib/sqreen/metrics/base.rb
176
209
  - lib/sqreen/metrics/binning.rb
177
210
  - lib/sqreen/metrics/collect.rb
211
+ - lib/sqreen/metrics/req_detailed.rb
178
212
  - lib/sqreen/metrics/sum.rb
179
213
  - lib/sqreen/metrics_store.rb
180
214
  - lib/sqreen/metrics_store/already_registered_metric.rb
@@ -255,6 +289,7 @@ files:
255
289
  - lib/sqreen/version.rb
256
290
  - lib/sqreen/waf_error.rb
257
291
  - lib/sqreen/weave.rb
292
+ - lib/sqreen/weave/budget.rb
258
293
  - lib/sqreen/weave/hardcoded.rb
259
294
  - lib/sqreen/weave/instrumentor.rb
260
295
  - lib/sqreen/weave/legacy.rb
@@ -277,7 +312,9 @@ metadata:
277
312
  changelog_uri: https://docs.sqreen.com/ruby/release-notes/
278
313
  source_code_uri: https://github.com/sqreen/ruby-agent
279
314
  bug_tracker_uri: https://github.com/sqreen/ruby-agent/issues
280
- post_install_message:
315
+ post_install_message: |2
316
+ This is a Sqreen beta release and may not work in all situations.
317
+ Make sure to review CHANGELOG.md for important details.
281
318
  rdoc_options: []
282
319
  require_paths:
283
320
  - lib
@@ -288,12 +325,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
325
  version: 1.9.3
289
326
  required_rubygems_version: !ruby/object:Gem::Requirement
290
327
  requirements:
291
- - - ">="
328
+ - - ">"
292
329
  - !ruby/object:Gem::Version
293
- version: '0'
330
+ version: 1.3.1
294
331
  requirements: []
295
332
  rubyforge_project:
296
- rubygems_version: 2.7.7
333
+ rubygems_version: 2.6.14.1
297
334
  signing_key:
298
335
  specification_version: 4
299
336
  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