sqreen 1.1.51482852304 → 1.2.01484936161

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a26aaa8da8d26dd436954f305fa4edd3012e1b4
4
- data.tar.gz: 4149459209326187539244978f475f62d4596eb9
3
+ metadata.gz: f8b8e4c339703d78d76d87c9c00306ee5d658331
4
+ data.tar.gz: fbe298fb99b526c9b1a8366347ce90b830529412
5
5
  SHA512:
6
- metadata.gz: ceb98979ac432d65cb3d01ba744a272e009978c8568fd112dc5cbf49e1717d80d35f5e6cf7e50eea5c36b427ca017a7aacf864b181aea8e0303d9f9d48586784
7
- data.tar.gz: 0ccc23a42825667d824a2ec4e4e83d47c4242094c033c23a8f6b35715ad11b6c93f296b45950343390807b02c6ccafe83605df2333809561d5c75bfff04669f7
6
+ metadata.gz: 6567012ee61a57b061758f1f680443c1a1808ab9a63f253ddbb4f58e33172462e1bb3c02d6741ee30c4d357508c24994916b97ab78191a06fde8ecb789623ecf
7
+ data.tar.gz: 70f865c6df795c027b1c4225982904ae48b5b71cd94099cb066e80d7cd3d56277b5356b59dddbcb7d7649c2f6b66daacd6018929204809a37271635ec0184675
@@ -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
@@ -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
@@ -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)
@@ -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
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: ruby
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