sqreen 1.1.51482852304-java → 1.2.01484936161-java

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
  SHA1:
3
- metadata.gz: 01a62c9c201059de682aab08cfff94a4e7be2067
4
- data.tar.gz: 5a616438a88b302cf12674b70e0e57d1e7d9440f
3
+ metadata.gz: 8559930eac7fb625c2b63984d509da6c3446b0f9
4
+ data.tar.gz: 12a76e3a8d5b276d735fe3eb0aee2dcf7cd73302
5
5
  SHA512:
6
- metadata.gz: 6941e671c429c60abde2e62b1725fd325c06447520f1a09830d9838a52744f062f9f361183d7b10c55bc80970b5823e7411ac282a05bb3b5dcfb968ffa45a89e
7
- data.tar.gz: 4f762b2fcd10a6294c01ed1d82d2d76cea8f90522f841256e7cf4be6923f59302c6dcd407326497d0224db94ec4ea809c73c95911a51a7bacf44f1cabc789212
6
+ metadata.gz: e2f1839f881a0245846c553266e5fe7507252c6fdeb3392bcb23ba89a9fe6b40858b8baa81b5e7bc24b184579669f92365f1b1f9ac8c0244786b4a35c5e94786
7
+ data.tar.gz: 4989ab7ada1beeceba50adbb8ce9e91dc258263e6b39cc1edba3d752da32f75136184af9c0be11ccc25b41d8465db3df40dedaaad7b5592781477ed4f39e9f0a
@@ -1,5 +1,6 @@
1
1
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
+ require 'ipaddr'
3
4
 
4
5
  require 'sqreen/events/remote_exception'
5
6
  require 'sqreen/callbacks'
@@ -20,7 +21,6 @@ module Sqreen
20
21
  end
21
22
  end
22
23
 
23
-
24
24
  # What kind of database is this
25
25
  def db_settings(_options = {})
26
26
  raise Sqreen::NotImplementedYet
@@ -67,7 +67,7 @@ module Sqreen
67
67
  return nil unless req
68
68
  forwarded = req.env['HTTP_X_FORWARDED_FOR']
69
69
  ips = split_ip_addresses(forwarded)
70
- last = ips.reject { |ip| ip =~ TRUSTED_PROXIES }.first
70
+ last = ips.find { |ip| (ip !~ TRUSTED_PROXIES) && valid_ip?(ip) }
71
71
  return last unless last.nil?
72
72
  req.env['REMOTE_ADDR']
73
73
  end
@@ -321,6 +321,13 @@ module Sqreen
321
321
  def split_ip_addresses(ip_addresses)
322
322
  ip_addresses ? ip_addresses.strip.split(/[,\s]+/) : []
323
323
  end
324
+
325
+ def valid_ip?(ip)
326
+ IPAddr.new(ip)
327
+ true
328
+ rescue
329
+ false
330
+ end
324
331
  end
325
332
  end
326
333
  end
@@ -11,6 +11,7 @@ module Sqreen
11
11
  :rules_reload => :reload_rules,
12
12
  :features_get => :features,
13
13
  :features_change => :change_features,
14
+ :force_logout => :shutdown,
14
15
  }.freeze
15
16
 
16
17
  attr_reader :uuid
data/lib/sqreen/runner.rb CHANGED
@@ -62,6 +62,7 @@ module Sqreen
62
62
  attr_reader :deliverer
63
63
  attr_reader :session
64
64
  attr_reader :instrumenter
65
+ attr_accessor :running
65
66
  attr_accessor :next_command_results
66
67
  attr_accessor :next_metrics
67
68
 
@@ -76,6 +77,7 @@ module Sqreen
76
77
  @last_heartbeat_request = Time.now
77
78
  @next_command_results = {}
78
79
  @next_metrics = []
80
+ @running = true
79
81
 
80
82
  @token = @configuration.get(:token)
81
83
  @url = @configuration.get(:url)
@@ -285,9 +287,7 @@ module Sqreen
285
287
  end
286
288
 
287
289
  def run_watcher
288
- loop do
289
- run_watcher_once
290
- end
290
+ run_watcher_once while running
291
291
  end
292
292
 
293
293
  # Sinatra is using at_exit to run the application, see:
@@ -298,6 +298,11 @@ module Sqreen
298
298
  !Sinatra::Application.run?
299
299
  end
300
300
 
301
+ def shutdown(_context_infos={})
302
+ remove_instrumentation
303
+ logout
304
+ end
305
+
301
306
  def logout(retrying = true)
302
307
  return unless session
303
308
  if @logged_out_tried
@@ -309,6 +314,7 @@ module Sqreen
309
314
  aggregate_observations
310
315
  session.post_metrics(metrics_engine.publish) if metrics_engine
311
316
  session.logout(retrying)
317
+ @running = false
312
318
  end
313
319
 
314
320
  def register_exit_cb(try_again = true)
data/lib/sqreen/sdk.rb CHANGED
@@ -7,5 +7,8 @@ module Sqreen
7
7
  # Authentication tracking method
8
8
  def auth_track(is_logged_in, authentication_keys)
9
9
  end
10
+
11
+ def signup_track(authentication_keys)
12
+ end
10
13
  end
11
14
  end
@@ -133,7 +133,7 @@ module Sqreen
133
133
  return yield
134
134
  rescue => e
135
135
 
136
- Sqreen.log.error(e.inspect)
136
+ Sqreen.log.warn(e.inspect)
137
137
 
138
138
  current_retry += 1
139
139
 
@@ -2,5 +2,5 @@
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
  # Warning This file is auto generated! DO NOT edit.
4
4
  module Sqreen
5
- VERSION = "1.1.51482852304".freeze
5
+ VERSION = "1.2.01484936161".freeze
6
6
  end
data/lib/sqreen.rb CHANGED
@@ -63,5 +63,6 @@ Sqreen.framework.on_start do |framework|
63
63
  sleep(delay)
64
64
  retry
65
65
  end
66
+ Sqreen.log.debug("shutting down Sqreen #{Sqreen::VERSION}")
66
67
  end
67
68
  end unless ENV['SQREEN_DISABLE'].to_i == 1
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.1.51482852304
4
+ version: 1.2.01484936161
5
5
  platform: java
6
6
  authors:
7
7
  - Sqreen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-27 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs