tcell_agent 0.2.29.rc2 → 0.2.29

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/bin/tcell_agent +16 -4
  3. data/lib/tcell_agent/agent/event_processor.rb +2 -8
  4. data/lib/tcell_agent/agent/fork_pipe_manager.rb +0 -2
  5. data/lib/tcell_agent/agent/policy_manager.rb +12 -18
  6. data/lib/tcell_agent/api.rb +50 -27
  7. data/lib/tcell_agent/appsensor/injections_reporter.rb +7 -5
  8. data/lib/tcell_agent/appsensor/sensor.rb +8 -4
  9. data/lib/tcell_agent/config/unknown_options.rb +116 -0
  10. data/lib/tcell_agent/configuration.rb +17 -20
  11. data/lib/tcell_agent/instrumentation.rb +0 -1
  12. data/lib/tcell_agent/logger.rb +17 -21
  13. data/lib/tcell_agent/patches/block_rule.rb +43 -8
  14. data/lib/tcell_agent/patches/meta_data.rb +2 -1
  15. data/lib/tcell_agent/patches/sensors_matcher.rb +2 -1
  16. data/lib/tcell_agent/policies/appsensor/database_sensor.rb +5 -2
  17. data/lib/tcell_agent/policies/appsensor/misc_sensor.rb +10 -3
  18. data/lib/tcell_agent/policies/appsensor/payloads_policy.rb +8 -3
  19. data/lib/tcell_agent/policies/appsensor/request_size_sensor.rb +1 -1
  20. data/lib/tcell_agent/policies/appsensor/response_codes_sensor.rb +7 -2
  21. data/lib/tcell_agent/policies/appsensor/size_sensor.rb +7 -3
  22. data/lib/tcell_agent/policies/appsensor/sqli_sensor.rb +3 -5
  23. data/lib/tcell_agent/policies/appsensor/user_agent_sensor.rb +6 -2
  24. data/lib/tcell_agent/policies/appsensor/xss_sensor.rb +3 -5
  25. data/lib/tcell_agent/policies/appsensor_policy.rb +11 -6
  26. data/lib/tcell_agent/policies/content_security_policy.rb +19 -14
  27. data/lib/tcell_agent/rails/dlp.rb +1 -1
  28. data/lib/tcell_agent/rails/middleware/headers_middleware.rb +10 -7
  29. data/lib/tcell_agent/rails/on_start.rb +0 -1
  30. data/lib/tcell_agent/sensor_events/appsensor_event.rb +7 -5
  31. data/lib/tcell_agent/sinatra.rb +3 -6
  32. data/lib/tcell_agent/start_background_thread.rb +0 -7
  33. data/lib/tcell_agent/utils/strings.rb +18 -0
  34. data/lib/tcell_agent/version.rb +1 -1
  35. data/spec/lib/tcell_agent/api/api_spec.rb +1 -1
  36. data/spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb +1 -1
  37. data/spec/lib/tcell_agent/config/unknown_options_spec.rb +188 -0
  38. data/spec/lib/tcell_agent/configuration_spec.rb +56 -0
  39. data/spec/lib/tcell_agent/patches/block_rule_spec.rb +110 -16
  40. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_log_spec.rb +226 -293
  41. data/spec/lib/tcell_agent/policies/appsensor/response_codes_sensor_spec.rb +32 -4
  42. data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +11 -0
  43. data/spec/lib/tcell_agent/utils/strings_spec.rb +50 -0
  44. data/spec/support/static_agent_overrides.rb +1 -1
  45. data/tcell_agent.gemspec +1 -3
  46. metadata +9 -37
  47. data/lib/tcell_agent/rails/tracing.rb +0 -22
  48. data/spec/integration/puma.rb +0 -195
@@ -5,6 +5,8 @@ require 'yaml'
5
5
  require 'socket'
6
6
  require 'securerandom'
7
7
 
8
+ require 'tcell_agent/config/unknown_options'
9
+
8
10
  module TCellAgent
9
11
  class ConfigurationException < StandardError
10
12
  end
@@ -23,13 +25,11 @@ module TCellAgent
23
25
  :tcell_api_url, :tcell_input_url,
24
26
  :logging_options,
25
27
  :logger,
26
- :appfirewall_payloads_logger,
28
+ :appfirewall_payloads_logger, # appfirewall_payloads_logger can be specified from initializers
27
29
  :fetch_policies_from_tcell, :instrument_for_events,
28
30
  :preload_policy_filename,
29
- :proxy_host, :proxy_port, :proxy_username, :proxy_password,
30
- :use_websockets, :host_identifier, :session_cookie_names,
31
+ :host_identifier,
31
32
  :uuid,
32
- :company,
33
33
  :event_batch_size_limit, :event_time_limit_seconds,
34
34
  :base_dir,
35
35
  :cache_filename,
@@ -41,13 +41,14 @@ module TCellAgent
41
41
  :config_filename,
42
42
  :agent_log_dir,
43
43
  :max_data_ex_db_records_per_request,
44
- :allow_unencrypted_appfirewall_payloads_logging,
45
44
  :agent_home_dir,
46
45
  :agent_home_owner,
47
46
  :reverse_proxy,
48
47
  :reverse_proxy_ip_address_header,
49
48
  :log_file_name,
50
- :log_tag
49
+ :log_tag,
50
+ :max_csp_header_bytes,
51
+ :demomode
51
52
 
52
53
  attr_accessor :disable_all,
53
54
  :enabled,
@@ -149,6 +150,9 @@ module TCellAgent
149
150
  @max_data_ex_db_records_per_request = 1000
150
151
  @reverse_proxy = true
151
152
  @reverse_proxy_ip_address_header = nil
153
+ @allow_unencrypted_appfirewall_payloads = false
154
+
155
+ @max_csp_header_bytes = nil
152
156
 
153
157
  read_config_using_env
154
158
  read_config_from_file(@config_filename)
@@ -157,8 +161,6 @@ module TCellAgent
157
161
  puts "tCell.io Agent: [DEPRECATED] TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS is deprecated, please switch to TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS."
158
162
  end
159
163
 
160
- @allow_unencrypted_appfirewall_payloads = false
161
-
162
164
  if (ENV["TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS"] != nil)
163
165
  @allow_unencrypted_appfirewall_payloads = [true, "true", "yes", "1"].include?(ENV["TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS"])
164
166
  end
@@ -166,8 +168,6 @@ module TCellAgent
166
168
  @allow_unencrypted_appfirewall_payloads = [true, "true", "yes", "1"].include?(ENV["TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS"])
167
169
  end
168
170
 
169
- @allow_unencrypted_appfirewall_payloads_logging = [true, "true", "yes", "1"].include?(ENV["TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS_LOGGING"])
170
-
171
171
  @tcell_api_url ||= "https://api.tcell.io/api/v1"
172
172
  @tcell_input_url ||= "https://input.tcell.io/api/v1"
173
173
  @js_agent_api_base_url ||= nil
@@ -223,6 +223,12 @@ module TCellAgent
223
223
  begin
224
224
  config_text = File.open(filename).read
225
225
  config = JSON.parse(config_text)
226
+
227
+ messages = TCellAgent::Config::Validate.get_unknown_options(config)
228
+ messages.each do |message|
229
+ puts message
230
+ end
231
+
226
232
  if (config["version"] == 1)
227
233
  # Required
228
234
  app_data = config["applications"][0] #Default
@@ -257,12 +263,7 @@ module TCellAgent
257
263
  @tcell_api_url = app_data.fetch("tcell_api_url", @tcell_api_url)
258
264
  @tcell_input_url = app_data.fetch("tcell_input_url", @tcell_input_url)
259
265
 
260
- @proxy_host = app_data["proxy_host"]
261
- @proxy_port = app_data["proxy_port"]
262
- @proxy_username = app_data["proxy_username"]
263
- @proxy_password = app_data["proxy_password"]
264
-
265
- @use_websockets = app_data["use_websockets"]
266
+ @max_csp_header_bytes = app_data.fetch("max_csp_header_bytes", @max_csp_header_bytes)
266
267
 
267
268
  @allow_unencrypted_appfirewall_payloads =
268
269
  app_data.fetch('allow_unencrypted_appsensor_payloads', @allow_unencrypted_appfirewall_payloads)
@@ -279,7 +280,6 @@ module TCellAgent
279
280
 
280
281
  @host_identifier = @host_identifier || app_data.fetch("host_identifier", @host_identifier)
281
282
  @hmac_key ||= app_data["hmac_key"] # if not already set
282
- @session_cookie_names = app_data["session_cookie_names"]
283
283
  @uuid = SecureRandom.uuid
284
284
  if (@uuid == nil)
285
285
  @uuid = "secure-random-failed"
@@ -292,9 +292,6 @@ module TCellAgent
292
292
  @js_agent_url = app_data["js_agent_url"]
293
293
  end
294
294
 
295
- # Causes old event url to be used
296
- @company = app_data["company"]
297
-
298
295
  if @demomode != true
299
296
  @demomode = app_data.fetch('demomode', false)
300
297
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # See the file "LICENSE" for the full license governing this code.
3
- require 'rest-client'
4
3
  require 'tcell_agent/logger'
5
4
  require 'tcell_agent/configuration'
6
5
  require 'tcell_agent/version'
@@ -89,27 +89,23 @@ module TCellAgent
89
89
  return @payloads_logger
90
90
  end
91
91
 
92
- if TCellAgent.configuration.allow_unencrypted_appfirewall_payloads_logging
93
- TCellAgent::Utils::IO.create_directory(
94
- File.dirname(TCellAgent.configuration.appfirewall_payloads_log_filename),
95
- TCellAgent.configuration.agent_home_owner.to_s
96
- )
97
-
98
- log_device = TCellLogDevice.new(
99
- TCellAgent.configuration.appfirewall_payloads_log_filename,
100
- shift_age: 9, shift_size: 5242880
101
- )
102
- @payloads_logger = Logger.new(log_device)
103
- @payloads_logger.level = Logger::INFO
104
- @payloads_logger.formatter = proc do |severity, datetime, progname, msg|
105
- date_format = datetime.strftime("%Y-%m-%dT%H:%M:%S.%L%:z")
106
- "#{date_format} - #{msg}\n"
107
- end
108
-
109
- return @payloads_logger
110
- else
111
- @null_logger
112
- end
92
+ TCellAgent::Utils::IO.create_directory(
93
+ File.dirname(TCellAgent.configuration.appfirewall_payloads_log_filename),
94
+ TCellAgent.configuration.agent_home_owner.to_s
95
+ )
96
+
97
+ log_device = TCellLogDevice.new(
98
+ TCellAgent.configuration.appfirewall_payloads_log_filename,
99
+ shift_age: 9, shift_size: 5242880
100
+ )
101
+ @payloads_logger = Logger.new(log_device)
102
+ @payloads_logger.level = Logger::INFO
103
+ @payloads_logger.formatter = proc do |severity, datetime, progname, msg|
104
+ date_format = datetime.strftime("%Y-%m-%dT%H:%M:%S.%L%:z")
105
+ "#{date_format} - #{msg}\n"
106
+ end
107
+
108
+ return @payloads_logger
113
109
  end
114
110
 
115
111
  def self.logger
@@ -8,13 +8,15 @@ module TCellAgent
8
8
  "block_403s" => 403
9
9
  }
10
10
 
11
- attr_accessor :ips, :rids, :sensors_matcher, :action
11
+ attr_accessor :ips, :rids, :sensors_matcher, :action, :exact_blocked_paths, :starts_with_blocked_paths
12
12
 
13
- def initialize(ips, rids, sensors_matcher, action)
13
+ def initialize(ips, rids, sensors_matcher, action, exact_blocked_paths, starts_with_blocked_paths)
14
14
  @ips = ips
15
15
  @rids = rids
16
16
  @sensors_matcher = sensors_matcher
17
17
  @action = action
18
+ @exact_blocked_paths = exact_blocked_paths
19
+ @starts_with_blocked_paths = starts_with_blocked_paths
18
20
  end
19
21
 
20
22
  def resp
@@ -22,11 +24,23 @@ module TCellAgent
22
24
  end
23
25
 
24
26
  def block?(meta_data)
25
- return false unless @ips.empty? || @ips.include?(meta_data.remote_address)
27
+ if @exact_blocked_paths.size > 0 || @starts_with_blocked_paths.size > 0
28
+ if meta_data.path
29
+ return true if @exact_blocked_paths.include?(meta_data.path)
26
30
 
27
- return false unless @rids.empty? || @rids.include?(meta_data.route_id)
31
+ return true if @starts_with_blocked_paths.any? do |blocked_path|
32
+ meta_data.path.start_with?(blocked_path)
33
+ end
34
+ end
35
+
36
+ return false
37
+ else
38
+ return false unless @ips.empty? || @ips.include?(meta_data.remote_address)
39
+
40
+ return false unless @rids.empty? || @rids.include?(meta_data.route_id)
28
41
 
29
- return @sensors_matcher.any_matches?(meta_data)
42
+ return @sensors_matcher.any_matches?(meta_data)
43
+ end
30
44
  end
31
45
 
32
46
  def self.from_json(rule_json)
@@ -36,15 +50,36 @@ module TCellAgent
36
50
  ips = Set.new(rule_json.fetch("ips", []))
37
51
  rids = Set.new(rule_json.fetch("rids", []))
38
52
 
39
- if ips.empty? && rids.empty?
40
- TCellAgent.logger.error("Patches Policy block rule cannot be global. Specify either ips and/or route ids")
53
+ exact_blocked_paths = Set.new
54
+ starts_with_blocked_paths = []
55
+ rule_json.fetch("paths", []).each do |path_predicate|
56
+ if path_predicate.fetch("exact", nil)
57
+ exact_path = TCellAgent::Utils::Strings.remove_trailing_slash(path_predicate["exact"])
58
+ exact_blocked_paths.add(exact_path)
59
+ if exact_path.size > 1
60
+ exact_blocked_paths.add(exact_path + "/")
61
+ end
62
+
63
+ elsif path_predicate.fetch("starts_with", nil)
64
+ starts_with_blocked_paths.push(path_predicate["starts_with"])
65
+ end
66
+ end
67
+
68
+ if ips.empty? && rids.empty? && exact_blocked_paths.size == 0 && starts_with_blocked_paths.size == 0
69
+ TCellAgent.logger.error("Patches Policy block rule cannot be global. Specify either ips and/or route ids or blocked paths")
41
70
 
42
71
  return nil
43
72
  end
44
73
 
45
74
  sensors_matcher = SensorsMatcher.from_json(rule_json.fetch("sensor_matches", {}))
46
75
 
47
- return BlockRule.new(ips, rids, sensors_matcher, action)
76
+ return BlockRule.new(
77
+ ips,
78
+ rids,
79
+ sensors_matcher,
80
+ action,
81
+ exact_blocked_paths,
82
+ starts_with_blocked_paths)
48
83
 
49
84
  else
50
85
  TCellAgent.logger.error("Patches Policy action not supported: #{action}")
@@ -16,6 +16,7 @@ module TCellAgent
16
16
 
17
17
  meta_event.remote_address = TCellAgent::Utils::Rails.better_ip(request)
18
18
  meta_event.method = request.request_method
19
+ meta_event.path = request.path
19
20
  meta_event.user_agent = request.env['HTTP_USER_AGENT']
20
21
  meta_event.get_dict = request.GET
21
22
  meta_event.cookie_dict = request.cookies
@@ -45,7 +46,7 @@ module TCellAgent
45
46
  end
46
47
  end
47
48
 
48
- attr_accessor :remote_address, :method, :location, :route_id, :session_id, :user_id, :transaction_id,
49
+ attr_accessor :remote_address, :method, :path, :route_id, :session_id, :user_id, :transaction_id,
49
50
  :request_content_bytes_len, :user_agent
50
51
 
51
52
  def initialize
@@ -21,7 +21,8 @@ module TCellAgent
21
21
  end
22
22
 
23
23
  def self.from_json(sensor_matcher_json)
24
- injections_matcher = TCellAgent::AppSensor::InjectionsMatcher.from_json(2, sensor_matcher_json)
24
+ injections_matcher =
25
+ TCellAgent::AppSensor::InjectionsMatcher.from_json(2, sensor_matcher_json)
25
26
  SensorsMatcher.new(injections_matcher)
26
27
  end
27
28
  end
@@ -7,17 +7,19 @@ module TCellAgent
7
7
 
8
8
  DP_CODE="dbmaxrows"
9
9
 
10
- attr_accessor :enabled, :max_rows, :excluded_route_ids
10
+ attr_accessor :enabled, :max_rows, :excluded_route_ids, :collect_full_uri
11
11
 
12
12
  def initialize(policy_json=nil)
13
13
  @enabled = false
14
14
  @max_rows = 1001
15
15
  @excluded_route_ids = {}
16
+ @collect_full_uri = false
16
17
 
17
18
  if policy_json
18
19
  @enabled = policy_json.fetch("enabled", false)
19
20
  large_result = policy_json.fetch("large_result", {})
20
21
  @max_rows = large_result.fetch("limit", @max_rows)
22
+ @collect_full_uri = policy_json.fetch("collect_full_uri", @collect_full_uri)
21
23
 
22
24
  policy_json.fetch("exclude_routes", []).each do |excluded_route|
23
25
  @excluded_route_ids[excluded_route] = true
@@ -38,7 +40,8 @@ module TCellAgent
38
40
  tcell_data,
39
41
  DP_CODE,
40
42
  param,
41
- meta)
43
+ meta,
44
+ @collect_full_uri)
42
45
  end
43
46
  end
44
47
 
@@ -5,18 +5,21 @@ module TCellAgent
5
5
 
6
6
  class MiscSensor
7
7
 
8
- attr_accessor :enabled, :csrf_exception_enabled, :sql_exception_enabled, :excluded_route_ids
8
+ attr_accessor :enabled, :csrf_exception_enabled, :sql_exception_enabled,
9
+ :excluded_route_ids, :collect_full_uri
9
10
 
10
11
  def initialize(policy_json=nil)
11
12
  @enabled = false
12
13
  @csrf_exception_enabled = false
13
14
  @sql_exception_enabled = false
14
15
  @excluded_route_ids = {}
16
+ @collect_full_uri = false
15
17
 
16
18
  if policy_json
17
19
  @enabled = policy_json.fetch("enabled", false)
18
20
  @csrf_exception_enabled = policy_json.fetch("csrf_exception_enabled", false)
19
21
  @sql_exception_enabled = policy_json.fetch("sql_exception_enabled", false)
22
+ @collect_full_uri = policy_json.fetch("collect_full_uri", @collect_full_uri)
20
23
 
21
24
  policy_json.fetch("exclude_routes", []).each do |excluded_route|
22
25
  @excluded_route_ids[excluded_route] = true
@@ -30,7 +33,9 @@ module TCellAgent
30
33
  return if tcell_data && @excluded_route_ids.fetch(tcell_data.route_id, false)
31
34
 
32
35
  meta = nil
33
- TCellAgent::AppSensor::Sensor.send_event_from_tcell_data(tcell_data, "excsrf", exception_class.name, meta)
36
+ TCellAgent::AppSensor::Sensor.send_event_from_tcell_data(
37
+ tcell_data, "excsrf", exception_class.name, meta, @collect_full_uri
38
+ )
34
39
  end
35
40
 
36
41
  def sql_exception_detected(tcell_data, exception)
@@ -39,7 +44,9 @@ module TCellAgent
39
44
  return if tcell_data && @excluded_route_ids.fetch(tcell_data.route_id, false)
40
45
 
41
46
  meta = nil
42
- TCellAgent::AppSensor::Sensor.send_event_from_tcell_data(tcell_data, "exsql", exception.class.name, meta)
47
+ TCellAgent::AppSensor::Sensor.send_event_from_tcell_data(
48
+ tcell_data, "exsql", exception.class.name, meta, @collect_full_uri
49
+ )
43
50
  end
44
51
 
45
52
  def to_s
@@ -14,11 +14,13 @@ module TCellAgent
14
14
  }
15
15
 
16
16
  attr_accessor :send_payloads, :send_blacklist, :send_whitelist, :use_send_whitelist,
17
- :log_payloads, :log_blacklist, :log_whitelist, :use_log_whitelist
17
+ :log_payloads, :log_blacklist, :log_whitelist, :use_log_whitelist,
18
+ :collect_full_uri
18
19
 
19
20
  def initialize
20
21
  @send_payloads = false
21
22
  @log_payloads = false
23
+ @collect_full_uri = false
22
24
 
23
25
  @send_blacklist = {}
24
26
  @log_blacklist = {}
@@ -66,7 +68,7 @@ module TCellAgent
66
68
  end
67
69
 
68
70
  def log(dp, appsensor_meta, type_of_param, vuln_param, vuln_value, meta, pattern)
69
- if @log_payloads && TCellAgent.configuration.allow_unencrypted_appfirewall_payloads_logging
71
+ if @log_payloads
70
72
  blacklisted_locations = @log_blacklist[vuln_param.downcase]
71
73
  param_location = PARAM_TYPE_MAP[type_of_param]
72
74
 
@@ -90,7 +92,8 @@ module TCellAgent
90
92
  appsensor_meta.session_id,
91
93
  appsensor_meta.user_id,
92
94
  vuln_value,
93
- pattern
95
+ pattern,
96
+ @collect_full_uri
94
97
  )
95
98
  event.post_process
96
99
  TCellAgent.appfirewall_payloads_logger.info(JSON.dump(event))
@@ -103,6 +106,8 @@ module TCellAgent
103
106
  policy = PayloadsPolicy.new
104
107
 
105
108
  if policy_json
109
+ policy.collect_full_uri = policy_json.fetch("uri_options", {}).fetch("collect_full_uri", false)
110
+
106
111
  payloads_json = policy_json.fetch("payloads", {})
107
112
  policy.send_payloads = payloads_json.fetch("send_payloads", false)
108
113
  policy.log_payloads = payloads_json.fetch("log_payloads", false)
@@ -13,7 +13,7 @@ module TCellAgent
13
13
  MAX_NORMAL_REQUEST_BYTES,
14
14
  DP_UNUSUAL_REQUEST_SIZE,
15
15
  policy_json
16
- )
16
+ )
17
17
  end
18
18
 
19
19
  def get_content_length(appsensor_meta)
@@ -15,18 +15,21 @@ module TCellAgent
15
15
  5 => "s5xx"
16
16
  }
17
17
 
18
- attr_accessor :enabled, :series_400_enabled, :series_500_enabled, :excluded_route_ids
18
+ attr_accessor :enabled, :series_400_enabled, :series_500_enabled, :excluded_route_ids,
19
+ :collect_full_uri
19
20
 
20
21
  def initialize(policy_json=nil)
21
22
  @enabled = false
22
23
  @series_400_enabled = false
23
24
  @series_500_enabled = false
24
25
  @excluded_route_ids = {}
26
+ @collect_full_uri = false
25
27
 
26
28
  if policy_json
27
29
  @enabled = policy_json.fetch("enabled", false)
28
30
  @series_400_enabled = policy_json.fetch("series_400_enabled", false)
29
31
  @series_500_enabled = policy_json.fetch("series_500_enabled", false)
32
+ @collect_full_uri = policy_json.fetch("collect_full_uri", @collect_full_uri)
30
33
 
31
34
  policy_json.fetch("exclude_routes", []).each do |excluded_route|
32
35
  @excluded_route_ids[excluded_route] = true
@@ -53,7 +56,9 @@ module TCellAgent
53
56
  if dp
54
57
  param = payload = pattern = nil
55
58
  meta = { code: response_code }
56
- TCellAgent::AppSensor::Sensor.send_event(appsensor_meta, dp, param, meta, payload, pattern)
59
+ TCellAgent::AppSensor::Sensor.send_event(
60
+ appsensor_meta, dp, param, meta, payload, pattern, @collect_full_uri
61
+ )
57
62
  end
58
63
 
59
64
  def to_s
@@ -5,17 +5,19 @@ module TCellAgent
5
5
 
6
6
  class SizeSensor
7
7
 
8
- attr_accessor :enabled, :limit, :excluded_route_ids, :dp_code
8
+ attr_accessor :enabled, :limit, :excluded_route_ids, :dp_code, :collect_full_uri
9
9
 
10
10
  def initialize(default_limit, dp_code, policy_json)
11
11
  @enabled = false
12
12
  @limit = default_limit
13
13
  @excluded_route_ids = {}
14
14
  @dp_code = dp_code
15
+ @collect_full_uri = false
15
16
 
16
- if policy_json != nil
17
+ if policy_json
17
18
  @enabled = policy_json.fetch("enabled", false)
18
19
  @limit = policy_json.fetch("limit", @limit)
20
+ @collect_full_uri = policy_json.fetch("collect_full_uri", @collect_full_uri)
19
21
 
20
22
  policy_json.fetch("exclude_routes", []).each do |route_id|
21
23
  @excluded_route_ids[route_id] = true
@@ -44,7 +46,9 @@ module TCellAgent
44
46
  param,
45
47
  meta,
46
48
  payload,
47
- pattern)
49
+ pattern,
50
+ @collect_full_uri
51
+ )
48
52
  end
49
53
  end
50
54