tcell_agent 0.2.29 → 0.4.0

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.txt +7 -0
  3. data/bin/tcell_agent +9 -0
  4. data/lib/tcell_agent/agent/policy_manager.rb +3 -0
  5. data/lib/tcell_agent/agent/policy_types.rb +4 -1
  6. data/lib/tcell_agent/appsensor/injections_matcher.rb +20 -0
  7. data/lib/tcell_agent/appsensor/injections_reporter.rb +15 -56
  8. data/lib/tcell_agent/appsensor/meta_data.rb +56 -2
  9. data/lib/tcell_agent/appsensor/rules/baserules.json +371 -138
  10. data/lib/tcell_agent/cmdi.rb +113 -0
  11. data/lib/tcell_agent/config/unknown_options.rb +2 -0
  12. data/lib/tcell_agent/configuration.rb +30 -16
  13. data/lib/tcell_agent/hooks/login_fraud.rb +79 -0
  14. data/lib/tcell_agent/instrumentation.rb +6 -11
  15. data/lib/tcell_agent/patches/meta_data.rb +14 -11
  16. data/lib/tcell_agent/policies/appsensor/injection_sensor.rb +5 -9
  17. data/lib/tcell_agent/policies/appsensor_policy.rb +22 -206
  18. data/lib/tcell_agent/policies/clickjacking_policy.rb +4 -2
  19. data/lib/tcell_agent/policies/command_injection_policy.rb +196 -0
  20. data/lib/tcell_agent/policies/content_security_policy.rb +3 -2
  21. data/lib/tcell_agent/policies/dataloss_policy.rb +3 -1
  22. data/lib/tcell_agent/policies/honeytokens_policy.rb +3 -1
  23. data/lib/tcell_agent/policies/http_redirect_policy.rb +51 -37
  24. data/lib/tcell_agent/policies/http_tx_policy.rb +5 -1
  25. data/lib/tcell_agent/policies/login_fraud_policy.rb +6 -1
  26. data/lib/tcell_agent/policies/patches_policy.rb +3 -1
  27. data/lib/tcell_agent/policies/policy.rb +10 -0
  28. data/lib/tcell_agent/policies/secure_headers_policy.rb +5 -2
  29. data/lib/tcell_agent/rails/auth/devise.rb +12 -23
  30. data/lib/tcell_agent/rails/csrf_exception.rb +1 -1
  31. data/lib/tcell_agent/rails/dlp.rb +50 -54
  32. data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +0 -1
  33. data/lib/tcell_agent/rails/middleware/context_middleware.rb +0 -1
  34. data/lib/tcell_agent/rails/middleware/global_middleware.rb +0 -1
  35. data/lib/tcell_agent/rails/middleware/headers_middleware.rb +7 -10
  36. data/lib/tcell_agent/rails/on_start.rb +0 -1
  37. data/lib/tcell_agent/rails/tcell_body_proxy.rb +4 -4
  38. data/lib/tcell_agent/rails.rb +0 -2
  39. data/lib/tcell_agent/rust/libtcellagent-0.6.1.dylib +0 -0
  40. data/lib/tcell_agent/rust/libtcellagent-0.6.1.so +0 -0
  41. data/lib/tcell_agent/rust/models.rb +61 -0
  42. data/lib/tcell_agent/rust/tcellagent-0.6.1.dll +0 -0
  43. data/lib/tcell_agent/rust/whisperer.rb +112 -0
  44. data/lib/tcell_agent/sensor_events/appsensor_event.rb +25 -21
  45. data/lib/tcell_agent/sensor_events/appsensor_meta_event.rb +31 -24
  46. data/lib/tcell_agent/sensor_events/command_injection.rb +58 -0
  47. data/lib/tcell_agent/sensor_events/discovery.rb +1 -1
  48. data/lib/tcell_agent/sensor_events/login_fraud.rb +3 -13
  49. data/lib/tcell_agent/sensor_events/sensor.rb +81 -77
  50. data/lib/tcell_agent/sensor_events/util/sanitizer_utilities.rb +8 -0
  51. data/lib/tcell_agent/start_background_thread.rb +12 -3
  52. data/lib/tcell_agent/utils/io.rb +4 -1
  53. data/lib/tcell_agent/utils/params.rb +1 -0
  54. data/lib/tcell_agent/version.rb +1 -1
  55. data/lib/tcell_agent.rb +0 -1
  56. data/spec/lib/tcell_agent/appsensor/injections_matcher_spec.rb +27 -9
  57. data/spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb +143 -193
  58. data/spec/lib/tcell_agent/appsensor/meta_data_spec.rb +67 -0
  59. data/spec/lib/tcell_agent/appsensor/rules/appsensor_rule_manager_spec.rb +0 -10
  60. data/spec/lib/tcell_agent/cmdi_spec.rb +748 -0
  61. data/spec/lib/tcell_agent/config/unknown_options_spec.rb +8 -0
  62. data/spec/lib/tcell_agent/configuration_spec.rb +138 -6
  63. data/spec/lib/tcell_agent/hooks/login_fraud_spec.rb +357 -0
  64. data/spec/lib/tcell_agent/patches/block_rule_spec.rb +70 -87
  65. data/spec/lib/tcell_agent/patches_spec.rb +9 -4
  66. data/spec/lib/tcell_agent/policies/appsensor/xss_sensor_spec.rb +186 -9
  67. data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +309 -484
  68. data/spec/lib/tcell_agent/policies/command_injection_policy_spec.rb +736 -0
  69. data/spec/lib/tcell_agent/policies/http_redirect_policy_spec.rb +222 -41
  70. data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +56 -32
  71. data/spec/lib/tcell_agent/rails/middleware/appsensor_middleware_spec.rb +161 -85
  72. data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +40 -72
  73. data/spec/lib/tcell_agent/rust/whisperer_spec.rb +267 -0
  74. data/spec/lib/tcell_agent/sensor_events/appsensor_meta_event_spec.rb +20 -15
  75. data/spec/spec_helper.rb +0 -9
  76. data/tcell_agent.gemspec +8 -3
  77. metadata +40 -39
  78. data/lib/tcell_agent/appsensor/sensor.rb +0 -52
  79. data/lib/tcell_agent/policies/appsensor/database_sensor.rb +0 -56
  80. data/lib/tcell_agent/policies/appsensor/misc_sensor.rb +0 -59
  81. data/lib/tcell_agent/policies/appsensor/payloads_policy.rb +0 -150
  82. data/lib/tcell_agent/policies/appsensor/request_size_sensor.rb +0 -25
  83. data/lib/tcell_agent/policies/appsensor/response_codes_sensor.rb +0 -73
  84. data/lib/tcell_agent/policies/appsensor/response_size_sensor.rb +0 -25
  85. data/lib/tcell_agent/policies/appsensor/size_sensor.rb +0 -71
  86. data/lib/tcell_agent/policies/appsensor/user_agent_sensor.rb +0 -47
  87. data/lib/tcell_agent/rails/auth/hooks.rb +0 -79
  88. data/lib/tcell_agent/sensor_events/util/redirect_utils.rb +0 -22
  89. data/spec/lib/tcell_agent/policies/appsensor/database_sensor_spec.rb +0 -165
  90. data/spec/lib/tcell_agent/policies/appsensor/misc_sensor_spec.rb +0 -429
  91. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_apply_spec.rb +0 -466
  92. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_from_json_spec.rb +0 -890
  93. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_log_spec.rb +0 -417
  94. data/spec/lib/tcell_agent/policies/appsensor/request_size_sensor_spec.rb +0 -236
  95. data/spec/lib/tcell_agent/policies/appsensor/response_codes_sensor_spec.rb +0 -297
  96. data/spec/lib/tcell_agent/policies/appsensor/response_size_sensor_spec.rb +0 -241
  97. data/spec/lib/tcell_agent/policies/appsensor/user_agent_sensor_spec.rb +0 -172
  98. data/spec/lib/tcell_agent/rails/auth/hooks_spec.rb +0 -246
  99. data/spec/lib/tcell_agent/sensor_events/util/redirect_utils_spec.rb +0 -25
  100. data/spec/support/resources/baserules.json +0 -155
@@ -2,61 +2,242 @@ require 'spec_helper'
2
2
 
3
3
  module TCellAgent
4
4
  module Policies
5
+
5
6
  describe HttpRedirectPolicy do
6
- http_redirect_plain = HttpRedirectPolicy.new
7
- context "defaults" do
7
+
8
+ context "with defaults" do
8
9
  it "returns true" do
10
+ http_redirect_plain = HttpRedirectPolicy.new
9
11
  expect(http_redirect_plain.policy_id).to eq(nil)
10
12
  expect(http_redirect_plain.enabled).to eq(false)
13
+ expect(http_redirect_plain.block).to eq(false)
14
+ expect(http_redirect_plain.whitelist).to eq([])
15
+ expect(http_redirect_plain.data_scheme_allowed).to eq(false)
11
16
  end
12
17
  end
13
- http_redirect_policy_json = {
14
- "policy_id"=>"x1a1",
15
- "data"=>{
16
- "enabled"=>true
17
- }
18
- }
19
- http_redirect_from_json = HttpRedirectPolicy.from_json(http_redirect_policy_json)
20
- context "initialized with 3 items" do
21
- it "returns true" do
22
- expect(http_redirect_from_json.policy_id).to eq("x1a1")
23
- expect(http_redirect_from_json.enabled).to eq(true)
24
- end
25
- end
26
- context "check url" do
18
+
19
+ describe "#suspicious_redirect?" do
27
20
  it "see's other domain" do
28
- result = http_redirect_from_json.check("test.google.com", "www.test.com")
29
- expect(result).to eq(true)
21
+ http_redirect_policy = HttpRedirectPolicy.from_json({
22
+ "policy_id"=>"x1a1",
23
+ "data"=>{
24
+ "enabled"=>true
25
+ }
26
+ })
27
+ expect(http_redirect_policy.policy_id).to eq("x1a1")
28
+ expect(http_redirect_policy.enabled).to eq(true)
29
+
30
+ expect(http_redirect_policy.suspicious_redirect?("test.google.com", "www.test.com")).to eq(true)
31
+ end
32
+
33
+ context "with wildcard domain" do
34
+ it "should be false" do
35
+ http_redirect_policy = HttpRedirectPolicy.from_json({
36
+ "policy_id"=>"x1a1",
37
+ "data"=>{
38
+ "enabled"=>true,
39
+ "whitelist"=>["*.google.com"]
40
+ }
41
+ })
42
+
43
+ expect(http_redirect_policy.suspicious_redirect?("test.google.com", "www.test.com")).to eq(false)
44
+
45
+ expect(http_redirect_policy.suspicious_redirect?("test.google.net", "www.test.com")).to eq(true)
46
+ end
30
47
  end
31
48
  end
32
- context "check url" do
33
- it "wildcard domain false" do
34
- http_redirect_from_json.whitelist = ["*.google.com"]
35
- result = http_redirect_from_json.check("test.google.com", "www.test.com")
36
- expect(result).to eq(false)
49
+
50
+ describe "#enforce" do
51
+ context "with a disabled policy" do
52
+ it "should not enfore the policy" do
53
+ http_redirect_policy = HttpRedirectPolicy.from_json({
54
+ "policy_id"=>"x1a1",
55
+ "data"=>{
56
+ "enabled"=>false,
57
+ "block"=>true,
58
+ "whitelist"=>["*.google.com"]
59
+ }
60
+ })
61
+
62
+ expect(http_redirect_policy.enforce(
63
+ "https://test.google.com", "www.test.com", "/path/a", "GET", "routex", "1.1.1.1", 400)
64
+ ).to eq(nil)
65
+ end
37
66
  end
38
- it "wildcard domain true" do
39
- http_redirect_from_json.whitelist = ["*.google.com"]
40
- result = http_redirect_from_json.check("test.google.net", "www.test.com")
41
- expect(result).to eq(true)
67
+
68
+ context "with an enabled policy" do
69
+ context "redirecting to non whitelisted domain" do
70
+ it "should block the redirect" do
71
+ http_redirect_policy = HttpRedirectPolicy.from_json({
72
+ "policy_id"=>"x1a1",
73
+ "data"=>{
74
+ "enabled"=>true,
75
+ "block"=>true,
76
+ "whitelist"=>["good.com"]
77
+ }
78
+ })
79
+
80
+ expect(http_redirect_policy.enforce(
81
+ "https://www.google.com/abc/def", "localhost", "/path/a", "GET", "routey", "1.1.1.1", 400
82
+ )).to eq("/")
83
+ end
84
+ end
85
+
86
+ context "with a wildcard whitelist" do
87
+ it "should not enfore allowed domains properly" do
88
+ http_redirect_policy = HttpRedirectPolicy.from_json({
89
+ "policy_id"=>"x1a1",
90
+ "data"=>{
91
+ "enabled"=>true,
92
+ "block"=>true,
93
+ "whitelist"=>["*.allowed*.com"]
94
+ }
95
+ })
96
+
97
+ expect(http_redirect_policy.enforce(
98
+ "https://allowed.com", "localhost", "/path/a", "GET", "routey", "1.1.1.1", 400
99
+ )).to eq(nil)
100
+
101
+ expect(http_redirect_policy.enforce(
102
+ "https://www.alloweddomain.com", "localhost", "/path/a", "GET", "routey", "1.1.1.1", 400
103
+ )).to eq(nil)
104
+ end
105
+ end
42
106
  end
43
- end
44
- context "enforce url" do
45
- it "domain enforce enabled false, block true" do
46
- http_redirect_from_json.enabled = false
47
- http_redirect_from_json.block = true
48
- http_redirect_from_json.whitelist = ["*.google.com"]
49
- result = http_redirect_from_json.enforce("https://test.google.com", "www.test.com", "/path/a", "GET", "routex", "1.1.1.1", 400)
50
- expect(result).to eq(nil)
107
+
108
+ context "with ports" do
109
+ it "should remove ports in redirect event" do
110
+ http_redirect_policy = HttpRedirectPolicy.from_json({
111
+ "policy_id" => "x1a1",
112
+ "data" => {
113
+ "enabled" => true,
114
+ "block" => false
115
+ }
116
+ })
117
+
118
+ expect(TCellAgent).to receive(:send_event).with({
119
+ "event_type" => "redirect",
120
+ "method" => "GET",
121
+ "from_domain" => "www.test.com",
122
+ "status_code" => 400 ,
123
+ "remote_addr" => "1.1.1.1",
124
+ "to" => "www.google.com",
125
+ "from" => "/path/a",
126
+ "rid" => "routex"
127
+ })
128
+
129
+ result = http_redirect_policy.enforce(
130
+ "https://www.google.com:80", "http://www.test.com", "/path/a", "GET", "routex", 400, "1.1.1.1"
131
+ )
132
+ expect(result).to eq(nil)
133
+ end
51
134
  end
52
- it "domain enforce enabled true, block true" do
53
- http_redirect_from_json.enabled = true
54
- http_redirect_from_json.block = true
55
- http_redirect_from_json.whitelist = ["good.com"]
56
- result = http_redirect_from_json.enforce("https://www.google.com/abc/def", "localhost", "/path/a", "GET", "routey", "1.1.1.1", 400)
57
- expect(result).to eq("/")
135
+
136
+ context "dataSchemeAllowed" do
137
+ context "is not allowed" do
138
+ it "should send an event" do
139
+ @http_redirect_policy = HttpRedirectPolicy.from_json({
140
+ "policy_id" => "x1a1",
141
+ "data" => {
142
+ "enabled" => true,
143
+ "whitelist" => [],
144
+ "block" => false,
145
+ "dataSchemeAllowed" => false
146
+ }
147
+ })
148
+
149
+ expect(TCellAgent).to receive(:send_event).with({
150
+ "event_type" => "redirect",
151
+ "method" => "GET",
152
+ "from_domain" => "www.test.com",
153
+ "status_code" => 400 ,
154
+ "remote_addr" => "1.1.1.1",
155
+ "to" => "data:text/html base64",
156
+ "from" => "/path/a",
157
+ "rid" => "routex"
158
+ })
159
+
160
+ result = @http_redirect_policy.enforce(
161
+ "data:text/html base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K",
162
+ "http://www.test.com",
163
+ "/path/a",
164
+ "GET",
165
+ "routex",
166
+ 400,
167
+ "1.1.1.1"
168
+ )
169
+ expect(result).to eq(nil)
170
+ end
171
+
172
+ context "and blocking is enabled" do
173
+ it "should send an event and redirect to root" do
174
+ @http_redirect_policy = HttpRedirectPolicy.from_json({
175
+ "policy_id" => "x1a1",
176
+ "data" => {
177
+ "enabled" => true,
178
+ "whitelist" => [],
179
+ "block" => true,
180
+ "dataSchemeAllowed" => false
181
+ }
182
+ })
183
+
184
+ expect(TCellAgent).to receive(:send_event).with({
185
+ "event_type" => "redirect",
186
+ "method" => "GET",
187
+ "from_domain" => "www.test.com",
188
+ "status_code" => 400 ,
189
+ "remote_addr" => "1.1.1.1",
190
+ "to" => "data:text/html base64",
191
+ "from" => "/path/a",
192
+ "rid" => "routex"
193
+ })
194
+
195
+ result = @http_redirect_policy.enforce(
196
+ "data:text/html base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K",
197
+ "http://www.test.com",
198
+ "/path/a",
199
+ "GET",
200
+ "routex",
201
+ 400,
202
+ "1.1.1.1"
203
+ )
204
+ expect(result).to eq("/")
205
+
206
+ end
207
+ end
208
+ end
209
+
210
+ context "is allowed" do
211
+ it "should not send an event" do
212
+ @http_redirect_policy = HttpRedirectPolicy.from_json({
213
+ "policy_id" => "x1a1",
214
+ "data" => {
215
+ "enabled" => true,
216
+ "whitelist" => [],
217
+ "block" => false,
218
+ "dataSchemeAllowed" => true
219
+ }
220
+ })
221
+
222
+ expect(TCellAgent).to_not receive(:send_event)
223
+
224
+ result = @http_redirect_policy.enforce(
225
+ "data:text/html base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K",
226
+ "http://www.test.com",
227
+ "/path/a",
228
+ "GET",
229
+ "routex",
230
+ 400,
231
+ "1.1.1.1"
232
+ )
233
+
234
+ expect(result).to eq(nil)
235
+ end
236
+ end
58
237
  end
59
238
  end
239
+
60
240
  end
241
+
61
242
  end
62
243
  end
@@ -251,8 +251,13 @@ module TCellAgent
251
251
  expect(injections_matcher.enabled).to eq(false)
252
252
  expect(injections_matcher.sensors.size).to eq(0)
253
253
 
254
- meta_data = TCellAgent::Patches::MetaData.new
255
- meta_data.remote_address = "1.3.3.4"
254
+ meta_data = TCellAgent::Patches::MetaData.new(
255
+ "get",
256
+ "1.3.3.4",
257
+ "route_id",
258
+ "session_id",
259
+ "user_id",
260
+ "transaction_id")
256
261
  expect(patches.apply(meta_data)).to eq(403)
257
262
  end
258
263
  end
@@ -280,16 +285,20 @@ module TCellAgent
280
285
  expect(injections_matcher.enabled).to eq(false)
281
286
  expect(injections_matcher.sensors.size).to eq(0)
282
287
 
283
- meta_data = TCellAgent::Patches::MetaData.new
288
+ meta_data = TCellAgent::Patches::MetaData.new(
289
+ "get",
290
+ "1.3.3.4",
291
+ "route_id",
292
+ "session_id",
293
+ "user_id",
294
+ "transaction_id")
284
295
  meta_data.remote_address = "1.3.3.4"
285
296
  expect(patches.apply(meta_data)).to eq(false)
286
297
 
287
- meta_data = TCellAgent::Patches::MetaData.new
288
298
  meta_data.remote_address = "1.3.3.4"
289
299
  meta_data.route_id = "123213"
290
300
  expect(patches.apply(meta_data)).to eq(403)
291
301
 
292
- meta_data = TCellAgent::Patches::MetaData.new
293
302
  meta_data.remote_address = "1.3.3.4"
294
303
  meta_data.route_id = "-3328888"
295
304
  expect(patches.apply(meta_data)).to eq(403)
@@ -329,16 +338,19 @@ module TCellAgent
329
338
  expect(injections_matcher.sensors.size).to eq(1)
330
339
  expect(injections_matcher.sensors[0].enabled).to eq(true)
331
340
 
332
- meta_data = TCellAgent::Patches::MetaData.new
333
- meta_data.remote_address = "1.3.3.4"
341
+ meta_data = TCellAgent::Patches::MetaData.new(
342
+ "get",
343
+ "1.3.3.4",
344
+ "route_id",
345
+ "session_id",
346
+ "user_id",
347
+ "transaction_id")
334
348
  expect(patches.apply(meta_data)).to eq(false)
335
349
 
336
- meta_data = TCellAgent::Patches::MetaData.new
337
350
  meta_data.remote_address = "1.3.3.4"
338
351
  meta_data.get_dict = {"xss_param" => "<script>"}
339
352
  expect(patches.apply(meta_data)).to eq(403)
340
353
 
341
- meta_data = TCellAgent::Patches::MetaData.new
342
354
  meta_data.remote_address = "1.3.3.4"
343
355
  meta_data.get_dict = {"sqli_param" => "Erwin' OR '1'='1"}
344
356
  expect(patches.apply(meta_data)).to eq(false)
@@ -369,22 +381,23 @@ module TCellAgent
369
381
  expect(injections_matcher.enabled).to eq(false)
370
382
  expect(injections_matcher.sensors.size).to eq(0)
371
383
 
372
- meta_data = TCellAgent::Patches::MetaData.new
373
- meta_data.remote_address = "1.3.3.4"
374
- meta_data.route_id = "111111"
384
+ meta_data = TCellAgent::Patches::MetaData.new(
385
+ "get",
386
+ "1.3.3.4",
387
+ "111111",
388
+ "session_id",
389
+ "user_id",
390
+ "transaction_id")
375
391
  expect(patches.apply(meta_data)).to eq(false)
376
392
 
377
- meta_data = TCellAgent::Patches::MetaData.new
378
393
  meta_data.remote_address = "1.1.1.1"
379
394
  meta_data.route_id = "123213"
380
395
  expect(patches.apply(meta_data)).to eq(false)
381
396
 
382
- meta_data = TCellAgent::Patches::MetaData.new
383
397
  meta_data.remote_address = "1.3.3.4"
384
398
  meta_data.route_id = "123213"
385
399
  expect(patches.apply(meta_data)).to eq(403)
386
400
 
387
- meta_data = TCellAgent::Patches::MetaData.new
388
401
  meta_data.remote_address = "1.3.3.4"
389
402
  meta_data.route_id = "-3328888"
390
403
  expect(patches.apply(meta_data)).to eq(403)
@@ -420,16 +433,19 @@ module TCellAgent
420
433
  expect(injections_matcher.sensors[0].enabled).to eq(true)
421
434
  expect(injections_matcher.sensors[1].enabled).to eq(true)
422
435
 
423
- meta_data = TCellAgent::Patches::MetaData.new
424
- meta_data.remote_address = "1.3.3.4"
436
+ meta_data = TCellAgent::Patches::MetaData.new(
437
+ "get",
438
+ "1.3.3.4",
439
+ "route_id",
440
+ "session_id",
441
+ "user_id",
442
+ "transaction_id")
425
443
  expect(patches.apply(meta_data)).to eq(false)
426
444
 
427
- meta_data = TCellAgent::Patches::MetaData.new
428
445
  meta_data.remote_address = "1.3.3.4"
429
446
  meta_data.get_dict = {"xss_param" => "<script>"}
430
447
  expect(patches.apply(meta_data)).to eq(false)
431
448
 
432
- meta_data = TCellAgent::Patches::MetaData.new
433
449
  meta_data.remote_address = "1.3.3.4"
434
450
  meta_data.get_dict = {"sqli_param" => "Erwin' OR '1'='1"}
435
451
  expect(patches.apply(meta_data)).to eq(false)
@@ -488,15 +504,18 @@ module TCellAgent
488
504
  expect(injections_matcher.enabled).to eq(false)
489
505
  expect(injections_matcher.sensors.size).to eq(0)
490
506
 
491
- meta_data = TCellAgent::Patches::MetaData.new
492
- meta_data.remote_address = "1.1.1.1"
507
+ meta_data = TCellAgent::Patches::MetaData.new(
508
+ "get",
509
+ "1.1.1.1",
510
+ "route_id",
511
+ "session_id",
512
+ "user_id",
513
+ "transaction_id")
493
514
  expect(patches.apply(meta_data)).to eq(403)
494
515
 
495
- meta_data = TCellAgent::Patches::MetaData.new
496
516
  meta_data.remote_address = "2.2.2.2"
497
517
  expect(patches.apply(meta_data)).to eq(403)
498
518
 
499
- meta_data = TCellAgent::Patches::MetaData.new
500
519
  meta_data.remote_address = "3.3.3.3"
501
520
  expect(patches.apply(meta_data)).to eq(403)
502
521
  end
@@ -534,22 +553,23 @@ module TCellAgent
534
553
  expect(injections_matcher.enabled).to eq(false)
535
554
  expect(injections_matcher.sensors.size).to eq(0)
536
555
 
537
- meta_data = TCellAgent::Patches::MetaData.new
538
- meta_data.remote_address = "1.3.3.4"
539
- meta_data.route_id = "11111"
556
+ meta_data = TCellAgent::Patches::MetaData.new(
557
+ "get",
558
+ "1.3.3.4",
559
+ "11111",
560
+ "session_id",
561
+ "user_id",
562
+ "transaction_id")
540
563
  expect(patches.apply(meta_data)).to eq(403)
541
564
 
542
- meta_data = TCellAgent::Patches::MetaData.new
543
565
  meta_data.remote_address = "1.1.1.1"
544
566
  meta_data.route_id = "123213"
545
567
  expect(patches.apply(meta_data)).to eq(403)
546
568
 
547
- meta_data = TCellAgent::Patches::MetaData.new
548
569
  meta_data.remote_address = "1.1.1.1"
549
570
  meta_data.route_id = "-3328888"
550
571
  expect(patches.apply(meta_data)).to eq(403)
551
572
 
552
- meta_data = TCellAgent::Patches::MetaData.new
553
573
  meta_data.remote_address = "1.3.3.4"
554
574
  meta_data.route_id = "-3328888"
555
575
  expect(patches.apply(meta_data)).to eq(403)
@@ -586,11 +606,15 @@ module TCellAgent
586
606
  expect(injections_matcher.enabled).to eq(false)
587
607
  expect(injections_matcher.sensors.size).to eq(0)
588
608
 
589
- meta_data = TCellAgent::Patches::MetaData.new
590
- meta_data.remote_address = "1.1.1.1"
609
+ meta_data = TCellAgent::Patches::MetaData.new(
610
+ "get",
611
+ "1.1.1.1",
612
+ "route_id",
613
+ "session_id",
614
+ "user_id",
615
+ "transaction_id")
591
616
  expect(patches.apply(meta_data)).to eq(403)
592
617
 
593
- meta_data = TCellAgent::Patches::MetaData.new
594
618
  meta_data.remote_address = "2.2.2.2"
595
619
  expect(patches.apply(meta_data)).to eq(403)
596
620
  end