tcell_agent 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/bin/tcell_agent +10 -2
  3. data/lib/tcell_agent.rb +3 -3
  4. data/lib/tcell_agent/agent.rb +42 -52
  5. data/lib/tcell_agent/agent/event_processor.rb +129 -162
  6. data/lib/tcell_agent/agent/fork_pipe_manager.rb +57 -62
  7. data/lib/tcell_agent/agent/policy_manager.rb +83 -104
  8. data/lib/tcell_agent/agent/policy_types.rb +24 -29
  9. data/lib/tcell_agent/agent/route_manager.rb +36 -46
  10. data/lib/tcell_agent/agent/static_agent.rb +19 -21
  11. data/lib/tcell_agent/api.rb +23 -28
  12. data/lib/tcell_agent/appsensor/injections_reporter.rb +7 -11
  13. data/lib/tcell_agent/authlogic.rb +7 -7
  14. data/lib/tcell_agent/cmdi.rb +22 -23
  15. data/lib/tcell_agent/config/unknown_options.rb +71 -69
  16. data/lib/tcell_agent/configuration.rb +187 -191
  17. data/lib/tcell_agent/devise.rb +13 -15
  18. data/lib/tcell_agent/hooks/login_fraud.rb +1 -1
  19. data/lib/tcell_agent/instrumentation.rb +120 -124
  20. data/lib/tcell_agent/logger.rb +29 -45
  21. data/lib/tcell_agent/patches.rb +5 -5
  22. data/lib/tcell_agent/policies/dataloss_policy.rb +263 -288
  23. data/lib/tcell_agent/policies/http_redirect_policy.rb +25 -37
  24. data/lib/tcell_agent/policies/http_tx_policy.rb +48 -52
  25. data/lib/tcell_agent/policies/login_fraud_policy.rb +15 -20
  26. data/lib/tcell_agent/policies/policy.rb +0 -2
  27. data/lib/tcell_agent/policies/rust_policies.rb +24 -29
  28. data/lib/tcell_agent/rails.rb +2 -3
  29. data/lib/tcell_agent/rails/auth/authlogic.rb +2 -2
  30. data/lib/tcell_agent/rails/auth/devise.rb +2 -2
  31. data/lib/tcell_agent/rails/auth/doorkeeper.rb +2 -2
  32. data/lib/tcell_agent/rails/better_ip.rb +12 -16
  33. data/lib/tcell_agent/rails/csrf_exception.rb +4 -7
  34. data/lib/tcell_agent/rails/dlp.rb +208 -107
  35. data/lib/tcell_agent/rails/dlp/process_request.rb +37 -47
  36. data/lib/tcell_agent/rails/dlp_handler.rb +9 -11
  37. data/lib/tcell_agent/rails/js_agent_insert.rb +11 -14
  38. data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +8 -7
  39. data/lib/tcell_agent/rails/middleware/context_middleware.rb +4 -5
  40. data/lib/tcell_agent/rails/middleware/global_middleware.rb +5 -8
  41. data/lib/tcell_agent/rails/middleware/headers_middleware.rb +24 -27
  42. data/lib/tcell_agent/rails/on_start.rb +5 -5
  43. data/lib/tcell_agent/rails/responses.rb +7 -9
  44. data/lib/tcell_agent/rails/routes.rb +62 -81
  45. data/lib/tcell_agent/rails/routes/grape.rb +25 -30
  46. data/lib/tcell_agent/rails/routes/route_id.rb +9 -14
  47. data/lib/tcell_agent/rails/settings_reporter.rb +44 -33
  48. data/lib/tcell_agent/rails/tcell_body_proxy.rb +15 -18
  49. data/lib/tcell_agent/routes/table.rb +31 -33
  50. data/lib/tcell_agent/rust/{libtcellagent-1.3.0.dylib → libtcellagent-1.3.1.dylib} +0 -0
  51. data/lib/tcell_agent/rust/{libtcellagent-1.3.0.so → libtcellagent-1.3.1.so} +0 -0
  52. data/lib/tcell_agent/rust/{libtcellagent-alpine-1.3.0.so → libtcellagent-alpine-1.3.1.so} +0 -0
  53. data/lib/tcell_agent/rust/models.rb +32 -37
  54. data/lib/tcell_agent/rust/tcellagent-1.3.1.dll +0 -0
  55. data/lib/tcell_agent/rust/whisperer.rb +101 -104
  56. data/lib/tcell_agent/sensor_events/app_config.rb +7 -7
  57. data/lib/tcell_agent/sensor_events/appsensor_event.rb +26 -27
  58. data/lib/tcell_agent/sensor_events/appsensor_meta_event.rb +20 -88
  59. data/lib/tcell_agent/sensor_events/command_injection.rb +52 -80
  60. data/lib/tcell_agent/sensor_events/discovery.rb +27 -27
  61. data/lib/tcell_agent/sensor_events/dlp.rb +50 -56
  62. data/lib/tcell_agent/sensor_events/honeytokens.rb +9 -9
  63. data/lib/tcell_agent/sensor_events/metrics.rb +20 -21
  64. data/lib/tcell_agent/sensor_events/patches.rb +10 -12
  65. data/lib/tcell_agent/sensor_events/sensor.rb +32 -36
  66. data/lib/tcell_agent/sensor_events/server_agent.rb +130 -127
  67. data/lib/tcell_agent/sensor_events/util/sanitizer_utilities.rb +60 -80
  68. data/lib/tcell_agent/sensor_events/util/utils.rb +3 -5
  69. data/lib/tcell_agent/servers/passenger.rb +5 -9
  70. data/lib/tcell_agent/servers/puma.rb +18 -27
  71. data/lib/tcell_agent/servers/rails_server.rb +5 -9
  72. data/lib/tcell_agent/servers/thin.rb +2 -4
  73. data/lib/tcell_agent/servers/unicorn.rb +18 -27
  74. data/lib/tcell_agent/servers/webrick.rb +2 -4
  75. data/lib/tcell_agent/settings_reporter.rb +126 -0
  76. data/lib/tcell_agent/sinatra.rb +24 -26
  77. data/lib/tcell_agent/start_background_thread.rb +21 -142
  78. data/lib/tcell_agent/system_info.rb +4 -3
  79. data/lib/tcell_agent/tcell_context.rb +150 -0
  80. data/lib/tcell_agent/userinfo.rb +3 -3
  81. data/lib/tcell_agent/utils/io.rb +19 -24
  82. data/lib/tcell_agent/utils/params.rb +9 -15
  83. data/lib/tcell_agent/utils/queue_with_timeout.rb +26 -32
  84. data/lib/tcell_agent/utils/strings.rb +4 -6
  85. data/lib/tcell_agent/version.rb +1 -1
  86. data/spec/lib/tcell_agent/agent/policy_manager_spec.rb +5 -5
  87. data/spec/lib/tcell_agent/agent/static_agent_spec.rb +7 -7
  88. data/spec/lib/tcell_agent/cmdi_spec.rb +21 -21
  89. data/spec/lib/tcell_agent/hooks/login_fraud_spec.rb +29 -24
  90. data/spec/lib/tcell_agent/instrumentation_spec.rb +4 -4
  91. data/spec/lib/tcell_agent/patches_spec.rb +8 -8
  92. data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +23 -23
  93. data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +2 -2
  94. data/spec/lib/tcell_agent/rails/csrf_exception_spec.rb +69 -0
  95. data/spec/lib/tcell_agent/rails/dlp_spec.rb +1039 -0
  96. data/spec/lib/tcell_agent/rails/js_agent_insert_spec.rb +271 -0
  97. data/spec/lib/tcell_agent/rails/logger_spec.rb +5 -5
  98. data/spec/lib/tcell_agent/rails/middleware/appsensor_middleware_spec.rb +3 -3
  99. data/spec/lib/tcell_agent/rails/middleware/dlp_middleware_spec.rb +4 -4
  100. data/spec/lib/tcell_agent/rails/middleware/global_middleware_spec.rb +5 -5
  101. data/spec/lib/tcell_agent/rails/middleware/redirect_middleware_spec.rb +1 -1
  102. data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +11 -8
  103. data/spec/lib/tcell_agent/rails/responses_spec.rb +2 -2
  104. data/spec/lib/tcell_agent/rails/routes/grape_spec.rb +2 -2
  105. data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +1 -1
  106. data/spec/lib/tcell_agent/rails/routes/routes_spec.rb +4 -4
  107. data/spec/lib/tcell_agent/rust/models_spec.rb +83 -75
  108. data/spec/lib/tcell_agent/rust/whisperer_spec.rb +14 -14
  109. data/spec/lib/tcell_agent/sensor_events/appsensor_meta_event_spec.rb +19 -70
  110. data/spec/lib/tcell_agent/sensor_events/sessions_metric_spec.rb +1 -1
  111. data/spec/lib/tcell_agent/settings_reporter_spec.rb +162 -0
  112. data/spec/lib/tcell_agent/tcell_context_spec.rb +154 -0
  113. data/spec/spec_helper.rb +5 -0
  114. metadata +18 -10
  115. data/lib/tcell_agent/appsensor/meta_data.rb +0 -132
  116. data/lib/tcell_agent/patches/meta_data.rb +0 -59
  117. data/lib/tcell_agent/rust/tcellagent-1.3.0.dll +0 -0
  118. data/spec/lib/tcell_agent/appsensor/meta_data_spec.rb +0 -71
@@ -0,0 +1,271 @@
1
+ require 'spec_helper'
2
+
3
+ module TCellAgent
4
+ module Instrumentation
5
+ module Rails
6
+ describe '.insert_now' do
7
+ context 'nil js_agent_handler' do
8
+ it 'should do nothing' do
9
+ script_insert = '<script>script_insert</script>'
10
+
11
+ rack_body, content_legnth = JSAgent.insert_now(nil,
12
+ script_insert,
13
+ ['body'],
14
+ 4)
15
+
16
+ expect(rack_body).to eq(['body'])
17
+ expect(content_legnth).to eq(4)
18
+ end
19
+ end
20
+
21
+ context 'no content' do
22
+ it 'should do nothing' do
23
+ js_agent_handler = proc {
24
+ raise Exception, 'should not be called'
25
+ }
26
+ script_insert = '<script>script_insert</script>'
27
+
28
+ rack_body, content_legnth = JSAgent.insert_now(js_agent_handler,
29
+ script_insert,
30
+ [],
31
+ 0)
32
+
33
+ expect(rack_body).to eq([])
34
+ expect(content_legnth).to eq(0)
35
+ end
36
+ end
37
+
38
+ context 'body with 1 part' do
39
+ context 'that does not match insert' do
40
+ it 'should return orignal body and content length' do
41
+ js_agent_handler = proc { |si, resp|
42
+ resp.sub('REPLACE_ME', si)
43
+ }
44
+ script_insert = '<script>script_insert</script>'
45
+
46
+ rack_body, content_legnth = JSAgent.insert_now(js_agent_handler,
47
+ script_insert,
48
+ ['i am the body'],
49
+ 'i am the body'.bytesize)
50
+
51
+ expect(rack_body).to eq(['i am the body'])
52
+ expect(content_legnth).to eq(13)
53
+ end
54
+ end
55
+
56
+ context 'that matches insert' do
57
+ it 'should return modified body and new content length' do
58
+ js_agent_handler = proc { |si, resp|
59
+ resp.sub('REPLACE_ME', si)
60
+ }
61
+ script_insert = '<script>script_insert</script>'
62
+
63
+ rack_body, content_legnth = JSAgent.insert_now(js_agent_handler,
64
+ script_insert,
65
+ ['i am REPLACE_ME the body'],
66
+ 'i am REPLACE_ME the body'.bytesize)
67
+ expect(rack_body).to eq(['i am <script>script_insert</script> the body'])
68
+ expect(content_legnth).to eq(44)
69
+ end
70
+ end
71
+ end
72
+
73
+ context 'body with multiple parts' do
74
+ context 'that does not match insert' do
75
+ it 'should return orignal body and content length' do
76
+ js_agent_handler = proc { |si, resp|
77
+ resp.sub('REPLACE_ME', si)
78
+ }
79
+ script_insert = '<script>script_insert</script>'
80
+
81
+ rack_body, content_legnth = JSAgent.insert_now(js_agent_handler,
82
+ script_insert,
83
+ ['first body part',
84
+ 'second body part'],
85
+ 'first body partsecond body part'.bytesize)
86
+ expect(rack_body).to eq(['first body part', 'second body part'])
87
+ expect(content_legnth).to eq(31)
88
+ end
89
+ end
90
+
91
+ context 'that matches insert' do
92
+ it 'should return modified body and new content length' do
93
+ js_agent_handler = proc { |si, resp|
94
+ resp.sub('REPLACE_ME', si)
95
+ }
96
+ script_insert = '<script>script_insert</script>'
97
+
98
+ rack_body, content_legnth = JSAgent.insert_now(js_agent_handler,
99
+ script_insert,
100
+ ['first body part REPLACE_ME',
101
+ 'second body part'],
102
+ 'first body part REPLACE_MEsecond body part'.bytesize)
103
+
104
+ expect(rack_body).to eq(['first body part <script>script_insert</script>',
105
+ 'second body part'])
106
+ expect(content_legnth).to eq(62)
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+ describe '.handle_js_agent_insert' do
113
+ context 'no <head> tag' do
114
+ it 'should not modify response' do
115
+ response = JSAgent.handle_js_agent_insert('SCRIPT', 'i am the response')
116
+
117
+ expect(response).to eq('i am the response')
118
+ end
119
+ end
120
+
121
+ context 'with a <head> tag' do
122
+ it 'should append script after head tag' do
123
+ response = JSAgent.handle_js_agent_insert('SCRIPT', 'i am the <head> response')
124
+
125
+ expect(response).to eq('i am the <head>SCRIPT response')
126
+ end
127
+ end
128
+
129
+ context 'with a <HEAD> tag' do
130
+ it 'should not append script after <HEAD> tag' do
131
+ response = JSAgent.handle_js_agent_insert('SCRIPT', 'i am the <HEAD> response')
132
+
133
+ expect(response).to eq('i am the <HEAD> response')
134
+ end
135
+ end
136
+
137
+ context 'with a <header> tag' do
138
+ it 'should not append script after <header> tag' do
139
+ response = JSAgent.handle_js_agent_insert('SCRIPT', 'i am the <header> response')
140
+
141
+ expect(response).to eq('i am the <header> response')
142
+ end
143
+ end
144
+
145
+ context 'with invalid parameters' do
146
+ context 'with nil response' do
147
+ it 'should return the unmodified response' do
148
+ logger = double('logger')
149
+ expect(TCellAgent).to receive(:logger).and_return(logger)
150
+ expect(TCellAgent).to receive(:logger).and_return(logger)
151
+ expect(logger).to receive(:debug).with(
152
+ /Exception in safe_block Handling JSAgent insert: NoMethodError happened, message is undefined method `sub'/
153
+ )
154
+ expect(logger).to receive(:debug).with(kind_of(Array))
155
+
156
+ response = JSAgent.handle_js_agent_insert('SCRIPT', nil)
157
+
158
+ expect(response).to eq(nil)
159
+ end
160
+ end
161
+
162
+ context 'with nil script' do
163
+ it 'should return the unmodified response' do
164
+ expect(TCellAgent).to_not receive(:logger)
165
+
166
+ response = JSAgent.handle_js_agent_insert(nil, 'i am the <head> response')
167
+
168
+ expect(response).to eq('i am the <head> response')
169
+ end
170
+ end
171
+ end
172
+ end
173
+
174
+ describe '.get_handler_and_script_insert' do
175
+ context 'with empty content type' do
176
+ it 'should not set js_agent_handler or script_insert' do
177
+ request = double('request')
178
+
179
+ expect(TCellAgent).to_not receive(:policy)
180
+ result = JSAgent.get_handler_and_script_insert(request, {})
181
+
182
+ expect(result).to eq([nil, nil])
183
+ end
184
+ end
185
+
186
+ context 'with non html response' do
187
+ it 'should not set js_agent_handler or script_insert' do
188
+ request = double('request')
189
+
190
+ expect(TCellAgent).to_not receive(:policy)
191
+ result = JSAgent.get_handler_and_script_insert(
192
+ request,
193
+ { 'Content-Type' => 'text/plain' }
194
+ )
195
+
196
+ expect(result).to eq([nil, nil])
197
+ end
198
+ end
199
+
200
+ context 'with html response but no rust_policies' do
201
+ it 'should not set js_agent_handler or script_insert' do
202
+ request = double('request')
203
+
204
+ expect(TCellAgent).to receive(:policy).with(
205
+ TCellAgent::PolicyTypes::RUST
206
+ ).and_return(nil)
207
+ result = JSAgent.get_handler_and_script_insert(
208
+ request,
209
+ { 'Content-Type' => 'text/html' }
210
+ )
211
+
212
+ expect(result).to eq([nil, nil])
213
+ end
214
+ end
215
+
216
+ context 'with html response and rust_policies' do
217
+ context 'with nil script_insert' do
218
+ it 'should not set js_agent_handler or script_insert' do
219
+ tcell_data = TCellAgent::Instrumentation::TCellData.new
220
+ request = double('request',
221
+ :env => {
222
+ TCellAgent::Instrumentation::TCELL_ID => tcell_data
223
+ })
224
+ rust_policies = double('rust_policies')
225
+
226
+ expect(TCellAgent).to receive(:policy).with(
227
+ TCellAgent::PolicyTypes::RUST
228
+ ).and_return(rust_policies)
229
+ expect(rust_policies).to receive(:get_js_agent_script_tag).with(
230
+ tcell_data
231
+ ).and_return(nil)
232
+
233
+ result = JSAgent.get_handler_and_script_insert(
234
+ request,
235
+ { 'Content-Type' => 'text/html' }
236
+ )
237
+
238
+ expect(result).to eq([nil, nil])
239
+ end
240
+ end
241
+
242
+ context 'with a script_insert' do
243
+ it 'should set js_agent_handler and script_insert' do
244
+ tcell_data = TCellAgent::Instrumentation::TCellData.new
245
+ request = double('request',
246
+ :env => {
247
+ TCellAgent::Instrumentation::TCELL_ID => tcell_data
248
+ })
249
+ rust_policies = double('rust_policies')
250
+
251
+ expect(TCellAgent).to receive(:policy).with(
252
+ TCellAgent::PolicyTypes::RUST
253
+ ).and_return(rust_policies)
254
+ expect(rust_policies).to receive(:get_js_agent_script_tag).with(
255
+ tcell_data
256
+ ).and_return('SCRIPT')
257
+
258
+ js_agent_handler, script_insert = JSAgent.get_handler_and_script_insert(
259
+ request,
260
+ { 'Content-Type' => 'text/html' }
261
+ )
262
+
263
+ expect(js_agent_handler.class).to eq(Proc)
264
+ expect(script_insert).to eq('SCRIPT')
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end
271
+ end
@@ -44,7 +44,7 @@ describe Logger do
44
44
  expect(TCellAgent::Instrumentation).to receive(:safe_block_no_log).with(
45
45
  'Handling DLP log message filtering'
46
46
  ).and_call_original
47
- expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DataLoss).and_return(
47
+ expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DATALOSS).and_return(
48
48
  double('dlp_policy')
49
49
  )
50
50
  expect(TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS).to receive(
@@ -63,7 +63,7 @@ describe Logger do
63
63
  expect(TCellAgent::Instrumentation).to receive(:safe_block_no_log).with(
64
64
  'Handling DLP log message filtering'
65
65
  ).and_call_original
66
- expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DataLoss).and_return(
66
+ expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DATALOSS).and_return(
67
67
  nil
68
68
  )
69
69
  expect(TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS).to receive(
@@ -82,7 +82,7 @@ describe Logger do
82
82
  expect(TCellAgent::Instrumentation).to receive(:safe_block_no_log).with(
83
83
  'Handling DLP log message filtering'
84
84
  ).and_call_original
85
- expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DataLoss).and_return(
85
+ expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DATALOSS).and_return(
86
86
  double('dlp_policy')
87
87
  )
88
88
  expect(TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS).to receive(
@@ -104,7 +104,7 @@ describe Logger do
104
104
  expect(TCellAgent::Instrumentation).to receive(:safe_block_no_log).with(
105
105
  'Handling DLP log message filtering'
106
106
  ).and_call_original
107
- expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DataLoss).and_return(
107
+ expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DATALOSS).and_return(
108
108
  double('dlp_policy')
109
109
  )
110
110
  expect(TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS).to receive(
@@ -127,7 +127,7 @@ describe Logger do
127
127
  expect(TCellAgent::Instrumentation).to receive(:safe_block_no_log).with(
128
128
  'Handling DLP log message filtering'
129
129
  ).and_call_original
130
- expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DataLoss).and_return(
130
+ expect(TCellAgent).to receive(:policy).with(TCellAgent::PolicyTypes::DATALOSS).and_return(
131
131
  double('dlp_policy')
132
132
  )
133
133
  expect(TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS).to receive(
@@ -96,7 +96,7 @@ module TCellAgent
96
96
  before(:each) do
97
97
  old_uap = TCellAgent.configuration.allow_payloads
98
98
  TCellAgent.configuration.allow_payloads = true
99
- TCellAgent.thread_agent.processPolicyJson(
99
+ TCellAgent.thread_agent.process_policy_json(
100
100
  {
101
101
  'regex' => regex_policy,
102
102
  'appsensor' => {
@@ -192,7 +192,7 @@ module TCellAgent
192
192
 
193
193
  context 'SQL Injection' do
194
194
  before(:each) do
195
- TCellAgent.thread_agent.processPolicyJson(
195
+ TCellAgent.thread_agent.process_policy_json(
196
196
  {
197
197
  'regex' => regex_policy,
198
198
  'appsensor' => {
@@ -240,7 +240,7 @@ module TCellAgent
240
240
 
241
241
  context 'File Path Traversal' do
242
242
  it 'alerts on most obvious payload' do
243
- TCellAgent.thread_agent.processPolicyJson(
243
+ TCellAgent.thread_agent.process_policy_json(
244
244
  {
245
245
  'regex' => regex_policy,
246
246
  'appsensor' => {
@@ -45,7 +45,7 @@ module TCellAgent
45
45
  env['tcell.request_data'].session_id = @session_id
46
46
  env['tcell.request_data'].route_id = @route_id
47
47
  tcell_context = env['tcell.request_data']
48
- dlp_policy = TCellAgent.policy(TCellAgent::PolicyTypes::DataLoss)
48
+ dlp_policy = TCellAgent.policy(TCellAgent::PolicyTypes::DATALOSS)
49
49
  if dlp_policy
50
50
  action_objs = dlp_policy.get_actions_for_table('*', '*', 'tablex', 'columnb', tcell_context.route_id)
51
51
  if action_objs
@@ -54,7 +54,7 @@ module TCellAgent
54
54
  end
55
55
  end
56
56
  TCellAgent::DLP.handle_request_dlp_parameters(rack_request)
57
- # if tcell_context && dlp_policy && dlp_policy.has_actions_for_form_parameter?
57
+ # if tcell_context && dlp_policy && dlp_policy.actions_for_form_parameter?
58
58
  # for_params(rack_request) { |method, param_name, param_value|
59
59
  # actions = dlp_policy.get_actions_for_form_parameter(param_name, tcell_context.route_id)
60
60
  # if actions
@@ -91,7 +91,7 @@ module TCellAgent
91
91
  let(:agent) { ::TCellAgent::Agent.new }
92
92
  context 'Event' do
93
93
  before(:each) do
94
- TCellAgent.thread_agent.processPolicyJson(
94
+ TCellAgent.thread_agent.process_policy_json(
95
95
  {
96
96
  'dlp' => {
97
97
  'policy_id' => 'x1a1',
@@ -144,7 +144,7 @@ module TCellAgent
144
144
 
145
145
  context 'Event for request dlp' do
146
146
  before(:each) do
147
- TCellAgent.thread_agent.processPolicyJson(
147
+ TCellAgent.thread_agent.process_policy_json(
148
148
  {
149
149
  'dlp' => {
150
150
  'policy_id' => 'x1a1',
@@ -49,7 +49,7 @@ module TCellAgent
49
49
 
50
50
  context 'not enabled' do
51
51
  it 'passes through unchanged' do
52
- agent.processPolicyJson(
52
+ agent.process_policy_json(
53
53
  {
54
54
  'http-redirect' => {
55
55
  'policy_id' => '153ed270-7481-11e5-9194-95dad9b9dec3',
@@ -69,7 +69,7 @@ module TCellAgent
69
69
 
70
70
  context "doesn't block simple whitelist" do
71
71
  it 'passes through unchanged' do
72
- agent.processPolicyJson(
72
+ agent.process_policy_json(
73
73
  {
74
74
  'http-redirect' => {
75
75
  'policy_id' => '153ed270-7481-11e5-9194-95dad9b9dec3',
@@ -90,7 +90,7 @@ module TCellAgent
90
90
 
91
91
  context "doesn't block wildcard whitelist" do
92
92
  it 'passes through unchanged' do
93
- agent.processPolicyJson(
93
+ agent.process_policy_json(
94
94
  {
95
95
  'http-redirect' => {
96
96
  'policy_id' => '153ed270-7481-11e5-9194-95dad9b9dec3',
@@ -110,7 +110,7 @@ module TCellAgent
110
110
 
111
111
  context 'DOES block wildcard whitelist' do
112
112
  it 'replaces the value with /' do
113
- agent.processPolicyJson(
113
+ agent.process_policy_json(
114
114
  {
115
115
  'http-redirect' => {
116
116
  'policy_id' => '153ed270-7481-11e5-9194-95dad9b9dec3',
@@ -147,7 +147,7 @@ module TCellAgent
147
147
 
148
148
  context 'Standard CSP Header' do
149
149
  it 'CSP Header is Added' do
150
- agent.processPolicyJson(
150
+ agent.process_policy_json(
151
151
  {
152
152
  'csp-headers' => {
153
153
  'policy_id' => '153ed270-7481-11e5-9194-95dad9b9dec3',
@@ -51,7 +51,7 @@ module TCellAgent
51
51
 
52
52
  context 'Event' do
53
53
  before(:each) do
54
- TCellAgent.thread_agent.processPolicyJson(
54
+ TCellAgent.thread_agent.process_policy_json(
55
55
  {
56
56
  'http-redirect' =>
57
57
  {
@@ -6,7 +6,7 @@ module TCellAgent
6
6
  describe TCellBodyProxy do
7
7
  context '#close' do
8
8
  before(:each) do
9
- @appsensor_meta = TCellAgent::SensorEvents::AppSensorMetaEvent.new(
9
+ @meta_data = TCellAgent::MetaData.new(
10
10
  'get',
11
11
  'remote_address',
12
12
  'route_id',
@@ -15,16 +15,19 @@ module TCellAgent
15
15
  'transaction_id',
16
16
  'http://test.com/'
17
17
  )
18
+ @appsensor_meta_event = TCellAgent::SensorEvents::AppSensorMetaEvent.new(
19
+ @meta_data
20
+ )
18
21
  end
19
22
 
20
23
  context 'zero content length' do
21
- it 'appsensor_meta event should be enqueued for processing' do
24
+ it 'appsensor_meta_event should be enqueued for processing' do
22
25
  tcell_body_proxy = TCellBodyProxy.new(
23
26
  Rack::BodyProxy.new(['body']) {},
24
27
  true,
25
28
  nil, nil, nil, nil
26
29
  )
27
- tcell_body_proxy.appsensor_meta = @appsensor_meta
30
+ tcell_body_proxy.appsensor_meta_event = @appsensor_meta_event
28
31
 
29
32
  tcell_body_proxy.content_length = 0
30
33
 
@@ -32,7 +35,7 @@ module TCellAgent
32
35
  'Running AppSensor deferred due to streaming'
33
36
  ).and_call_original
34
37
  expect(TCellAgent).to receive(:send_event).with(
35
- @appsensor_meta
38
+ @appsensor_meta_event
36
39
  )
37
40
 
38
41
  tcell_body_proxy.close
@@ -40,13 +43,13 @@ module TCellAgent
40
43
  end
41
44
 
42
45
  context 'non zero content length' do
43
- it 'appsensor_meta event should be enqueued for processing' do
46
+ it 'appsensor_meta_event should be enqueued for processing' do
44
47
  tcell_body_proxy = TCellBodyProxy.new(
45
48
  Rack::BodyProxy.new(['body']) {},
46
49
  true,
47
50
  nil, nil, nil, nil
48
51
  )
49
- tcell_body_proxy.appsensor_meta = @appsensor_meta
52
+ tcell_body_proxy.appsensor_meta_event = @appsensor_meta_event
50
53
 
51
54
  tcell_body_proxy.content_length = 512
52
55
 
@@ -54,12 +57,12 @@ module TCellAgent
54
57
  'Running AppSensor deferred due to streaming'
55
58
  ).and_call_original
56
59
  expect(TCellAgent).to receive(:send_event).with(
57
- @appsensor_meta
60
+ @appsensor_meta_event
58
61
  )
59
62
 
60
63
  tcell_body_proxy.close
61
64
 
62
- expect(@appsensor_meta.response_content_bytes_len).to eq(512)
65
+ expect(@appsensor_meta_event.meta_data.response_content_bytes_len).to eq(512)
63
66
  end
64
67
  end
65
68
  end