tcell_agent 0.2.7 → 0.2.8
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 +4 -4
- data/bin/tcell_agent +22 -0
- data/lib/tcell_agent/agent/event_processor.rb +7 -0
- data/lib/tcell_agent/agent/fork_pipe_manager.rb +29 -29
- data/lib/tcell_agent/agent/policy_manager.rb +2 -1
- data/lib/tcell_agent/agent/route_manager.rb +35 -15
- data/lib/tcell_agent/configuration.rb +42 -2
- data/lib/tcell_agent/instrumentation.rb +4 -1
- data/lib/tcell_agent/logger.rb +1 -1
- data/lib/tcell_agent/rails.rb +12 -18
- data/lib/tcell_agent/rails/auth/authlogic.rb +2 -2
- data/lib/tcell_agent/rails/auth/devise.rb +1 -1
- data/lib/tcell_agent/rails/dlp.rb +133 -123
- data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +2 -1
- data/lib/tcell_agent/rails/on_start.rb +67 -69
- data/lib/tcell_agent/rails/routes.rb +91 -86
- data/lib/tcell_agent/rails/settings_reporter.rb +10 -0
- data/lib/tcell_agent/routes/table.rb +2 -0
- data/lib/tcell_agent/sensor_events/server_agent.rb +10 -0
- data/lib/tcell_agent/servers/thin.rb +1 -0
- data/lib/tcell_agent/servers/webrick.rb +0 -1
- data/lib/tcell_agent/start_background_thread.rb +44 -45
- data/lib/tcell_agent/system_info.rb +10 -0
- data/lib/tcell_agent/version.rb +1 -1
- data/spec/lib/tcell_agent/agent/fork_pipe_manager_spec.rb +99 -0
- data/spec/lib/tcell_agent/api/api_spec.rb +2 -2
- data/spec/lib/tcell_agent/instrumentation_spec.rb +176 -176
- data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +32 -32
- data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +63 -63
- data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +93 -93
- data/spec/lib/tcell_agent/policies/dataloss_policy_spec.rb +222 -222
- data/spec/lib/tcell_agent/policies/honeytokens_policy_spec.rb +17 -17
- data/spec/lib/tcell_agent/policies/http_redirect_policy_spec.rb +57 -57
- data/spec/lib/tcell_agent/policies/http_tx_policy_spec.rb +17 -17
- data/spec/lib/tcell_agent/policies/login_policy_spec.rb +3 -3
- data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +59 -59
- data/spec/lib/tcell_agent/rails/logger_spec.rb +148 -0
- data/spec/lib/tcell_agent/rails/middleware/global_middleware_spec.rb +7 -7
- data/spec/lib/tcell_agent/rails_spec.rb +2 -2
- data/spec/lib/tcell_agent/sensor_events/dlp_spec.rb +9 -9
- data/spec/lib/tcell_agent/sensor_events/util/redirect_utils_spec.rb +20 -20
- data/spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb +52 -52
- data/spec/lib/tcell_agent_spec.rb +17 -17
- data/spec/spec_helper.rb +1 -0
- data/spec/support/resources/normal_config.json +5 -5
- data/tcell_agent.gemspec +4 -4
- metadata +31 -26
data/lib/tcell_agent/version.rb
CHANGED
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TCellAgent
|
4
|
+
|
5
|
+
describe Agent::ForkPipeManager do
|
6
|
+
describe ".send_to_metrics_pipe" do
|
7
|
+
context "incrementing a route" do
|
8
|
+
it "should call increment_route on the agent" do
|
9
|
+
expect(TCellAgent).to receive(:increment_route).with("/ma_route", 50)
|
10
|
+
expect(TCellAgent).to_not receive(:discover_database_fields)
|
11
|
+
expect(TCellAgent).to_not receive(:increment_session_info)
|
12
|
+
|
13
|
+
|
14
|
+
child_process = ForkBreak::Process.new do |breakpoints|
|
15
|
+
TCellAgent::Agent.send_to_metrics_pipe(
|
16
|
+
"_type"=>"increment_route",
|
17
|
+
"route_id"=>"/ma_route",
|
18
|
+
"response_time"=>50
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
child_process.finish.wait
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "discover database fields" do
|
27
|
+
it "should call discover_database_fields on the agent" do
|
28
|
+
expect(TCellAgent).to_not receive(:increment_route)
|
29
|
+
expect(TCellAgent).to receive(:discover_database_fields).with(
|
30
|
+
"route_id", "database", "schema", "table", "fields"
|
31
|
+
)
|
32
|
+
expect(TCellAgent).to_not receive(:increment_session_info)
|
33
|
+
|
34
|
+
|
35
|
+
child_process = ForkBreak::Process.new do |breakpoints|
|
36
|
+
TCellAgent::Agent.send_to_metrics_pipe({
|
37
|
+
"_type"=>"discover_database_fields",
|
38
|
+
"route_id"=>"route_id",
|
39
|
+
"database"=>"database",
|
40
|
+
"schema"=>"schema",
|
41
|
+
"table"=>"table",
|
42
|
+
"fields"=>"fields"
|
43
|
+
})
|
44
|
+
end
|
45
|
+
|
46
|
+
child_process.finish.wait
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "increment session info" do
|
51
|
+
it "should call increment_session_info on the agent" do
|
52
|
+
expect(TCellAgent).to_not receive(:increment_route)
|
53
|
+
expect(TCellAgent).to_not receive(:discover_database_fields)
|
54
|
+
expect(TCellAgent).to receive(:increment_session_info).with(
|
55
|
+
"hmac_session_id", "user_id", "ip_address", "user_agent"
|
56
|
+
)
|
57
|
+
|
58
|
+
child_process = ForkBreak::Process.new do |breakpoints|
|
59
|
+
TCellAgent::Agent.send_to_metrics_pipe({
|
60
|
+
"_type"=>"increment_session_info",
|
61
|
+
"hmac_session_id" => "hmac_session_id",
|
62
|
+
"user_id" => "user_id",
|
63
|
+
"ip_address" => "ip_address",
|
64
|
+
"user_agent" => "user_agent"
|
65
|
+
})
|
66
|
+
end
|
67
|
+
|
68
|
+
child_process.finish.wait
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "unkown metric" do
|
73
|
+
it "should raise an exception" do
|
74
|
+
expect(TCellAgent).to_not receive(:increment_route)
|
75
|
+
expect(TCellAgent).to_not receive(:discover_database_fields)
|
76
|
+
expect(TCellAgent).to_not receive(:increment_session_info)
|
77
|
+
|
78
|
+
logger = double("logger")
|
79
|
+
expect(TCellAgent).to receive(:logger).and_return(logger)
|
80
|
+
expect(TCellAgent).to receive(:logger).and_return(logger)
|
81
|
+
expect(logger).to receive(:debug).with(
|
82
|
+
"Exception in safe_block Handling metrics_pipe_block: Exception happened, message" +
|
83
|
+
" is Metrics Pipe Manager received unknown metric: dunno_what_this_is"
|
84
|
+
)
|
85
|
+
expect(logger).to receive(:debug).with(anything())
|
86
|
+
|
87
|
+
child_process = ForkBreak::Process.new do |breakpoints|
|
88
|
+
TCellAgent::Agent.send_to_metrics_pipe({
|
89
|
+
"_type"=>"dunno_what_this_is"
|
90
|
+
})
|
91
|
+
end
|
92
|
+
|
93
|
+
child_process.finish.wait
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
@@ -9,7 +9,7 @@ module TCellAgent
|
|
9
9
|
tapi = TCellApi.new
|
10
10
|
TCellAgent.configuration.app_id = "test-appid"
|
11
11
|
TCellAgent.configuration.api_key = "test-apikey"
|
12
|
-
|
12
|
+
|
13
13
|
def checkreq(req)
|
14
14
|
return '{"result":{"csp-headers":{"app_id":"testapp-Becwu","policy_id":' \
|
15
15
|
'"acf60560-4e76-11e5-874c-7d71d425b275","headers":[{"name":"Content-Security-Policy-Report-Only",' \
|
@@ -33,4 +33,4 @@ module TCellAgent
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
@@ -9,198 +9,198 @@ end
|
|
9
9
|
module TCellAgent
|
10
10
|
module Instrumentation
|
11
11
|
describe Instrumentation do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
12
|
+
context "Body - SessionId Filters" do
|
13
|
+
it "Tests Redaction and Events in Body" do
|
14
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
15
|
+
action.body_redact = true
|
16
|
+
action.action_id = 5
|
17
|
+
policy_json_two = {
|
18
|
+
"policy_id"=>"x1a1",
|
19
|
+
"data"=>{
|
20
|
+
"session_id_protection"=>{"body"=>["redact"], "log"=>["event"]}
|
22
21
|
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
}
|
23
|
+
session_id_policy = TCellAgent::Policies::DataLossPolicy.fromJson(policy_json_two)
|
24
|
+
mock_agent = MockAgent.new(-1)
|
25
|
+
mock_agent.policies[TCellAgent::PolicyTypes::DataLoss] = session_id_policy
|
26
|
+
TCellAgent.set_thread_agent(mock_agent)
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
context = TCellData.new
|
29
|
+
context.session_id = "tim123123my"
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
31
|
+
body = "this is about tim123123my 3123123."
|
32
|
+
TCellAgent.empty_event_queue
|
33
|
+
context.filter_body(body)
|
34
|
+
expect(body).to eq("this is about [redacted] 3123123.")
|
35
|
+
expect(TCellAgent.event_queue.length).to eq(1)
|
36
|
+
TCellAgent.set_thread_agent(nil)
|
37
|
+
end
|
38
|
+
it "Tests Events in Body" do
|
39
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
40
|
+
action.body_redact = true
|
41
|
+
action.action_id = 5
|
42
|
+
policy_json_two = {
|
43
|
+
"policy_id"=>"x1a1",
|
44
|
+
"data"=>{
|
45
|
+
"session_id_protection"=>{"body"=>["event"], "log"=>["redact"]}
|
47
46
|
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
}
|
48
|
+
session_id_policy = TCellAgent::Policies::DataLossPolicy.fromJson(policy_json_two)
|
49
|
+
mock_agent = MockAgent.new(-1)
|
50
|
+
mock_agent.policies[TCellAgent::PolicyTypes::DataLoss] = session_id_policy
|
51
|
+
TCellAgent.set_thread_agent(mock_agent)
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
context = TCellData.new
|
54
|
+
context.session_id = "tim123123my"
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
56
|
+
body = "this is about tim123123my 3123123."
|
57
|
+
TCellAgent.empty_event_queue
|
58
|
+
context.filter_body(body)
|
59
|
+
expect(body).to eq("this is about tim123123my 3123123.")
|
60
|
+
expect(TCellAgent.event_queue.length).to eq(1)
|
61
|
+
TCellAgent.set_thread_agent(nil)
|
63
62
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
end
|
64
|
+
context "Log - SessionId Filters" do
|
65
|
+
it "Tests Redaction and Events in Body" do
|
66
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
67
|
+
action.body_redact = true
|
68
|
+
action.action_id = 5
|
69
|
+
policy_json_two = {
|
70
|
+
"policy_id"=>"x1a1",
|
71
|
+
"data"=>{
|
72
|
+
"session_id_protection"=>{"body"=>["redact"], "log"=>["redact"]}
|
74
73
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
}
|
75
|
+
session_id_policy = TCellAgent::Policies::DataLossPolicy.fromJson(policy_json_two)
|
76
|
+
mock_agent = MockAgent.new(-1)
|
77
|
+
mock_agent.policies[TCellAgent::PolicyTypes::DataLoss] = session_id_policy
|
78
|
+
TCellAgent.set_thread_agent(mock_agent)
|
79
79
|
|
80
|
-
|
81
|
-
|
80
|
+
context = TCellData.new
|
81
|
+
context.session_id = "tim123123my"
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
83
|
+
body = "this is about tim123123my 3123123."
|
84
|
+
TCellAgent.empty_event_queue
|
85
|
+
context.filter_log(body)
|
86
|
+
expect(body).to eq("this is about [redacted] 3123123.")
|
87
|
+
expect(TCellAgent.event_queue.length).to eq(1)
|
88
|
+
TCellAgent.set_thread_agent(nil)
|
89
|
+
end
|
90
|
+
it "Tests Events Only" do
|
91
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
92
|
+
action.body_redact = true
|
93
|
+
action.action_id = 5
|
94
|
+
policy_json_two = {
|
95
|
+
"policy_id"=>"x1a1",
|
96
|
+
"data"=>{
|
97
|
+
"session_id_protection"=>{"body"=>["redact"], "log"=>["event"]}
|
99
98
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
}
|
100
|
+
session_id_policy = TCellAgent::Policies::DataLossPolicy.fromJson(policy_json_two)
|
101
|
+
mock_agent = MockAgent.new(-1)
|
102
|
+
mock_agent.policies[TCellAgent::PolicyTypes::DataLoss] = session_id_policy
|
103
|
+
TCellAgent.set_thread_agent(mock_agent)
|
104
104
|
|
105
|
-
|
106
|
-
|
105
|
+
context = TCellData.new
|
106
|
+
context.session_id = "tim123123my"
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
108
|
+
body = "this is about tim123123my 3123123."
|
109
|
+
TCellAgent.empty_event_queue
|
110
|
+
context.filter_log(body)
|
111
|
+
expect(body).to eq("this is about tim123123my 3123123.")
|
112
|
+
expect(TCellAgent.event_queue.length).to eq(1)
|
113
|
+
TCellAgent.set_thread_agent(nil)
|
115
114
|
end
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
115
|
+
end
|
116
|
+
context "Body - Database Filters" do
|
117
|
+
it "Tests Redaction and Events in Body" do
|
118
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
119
|
+
action.body_redact = true
|
120
|
+
action.action_id = 5
|
121
|
+
context = TCellData.new
|
122
|
+
context.add_response_db_filter("timmy", action, "don", "sam", "tim", "fred")
|
123
|
+
context.add_response_db_filter("timmy23", action, "don", "sam", "tim", "fred")
|
124
|
+
context.add_response_db_filter("3123123", action, "don", "sam", "tim", "fred")
|
125
|
+
context.add_response_db_filter("tim123my", action, "don", "sam", "tim", "fred")
|
126
|
+
context.add_response_db_filter("timmy1", action, "don", "sam", "tim", "fred")
|
127
|
+
context.add_response_db_filter("tim123123my", action, "don", "sam", "tim", "fred")
|
128
|
+
context.add_response_db_filter("ti21312mmy", action, "don", "sam", "tim", "fred")
|
129
|
+
context.add_response_db_filter("ti123123mmy", action, "don", "sam", "tim", "fred")
|
130
|
+
context.add_response_db_filter(10233234, action, "don", "sam", "tim", "fred")
|
131
|
+
context.add_response_db_filter(true, action, "don", "sam", "tim", "fred")
|
132
|
+
body = "this is about timmy1 3123123."
|
133
|
+
TCellAgent.empty_event_queue
|
134
|
+
context.filter_body(body)
|
135
|
+
expect(body).to eq("this is about [redacted] [redacted].")
|
136
|
+
expect(TCellAgent.event_queue.length).to eq(2)
|
137
|
+
end
|
138
|
+
it "Tests Event Only Match in Body" do
|
139
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
140
|
+
action.body_event = true
|
141
|
+
action.action_id = 5
|
142
|
+
context = TCellData.new
|
143
|
+
context.add_response_db_filter("timmy", action, "don", "sam", "tim", "fred")
|
144
|
+
context.add_response_db_filter("timmy23", action, "don", "sam", "tim", "fred")
|
145
|
+
context.add_response_db_filter("3123123", action, "don", "sam", "tim", "fred")
|
146
|
+
context.add_response_db_filter("tim123my", action, "don", "sam", "tim", "fred")
|
147
|
+
context.add_response_db_filter("timmy1", action, "don", "sam", "tim", "fred")
|
148
|
+
context.add_response_db_filter("tim123123my", action, "don", "sam", "tim", "fred")
|
149
|
+
context.add_response_db_filter("ti21312mmy", action, "don", "sam", "tim", "fred")
|
150
|
+
context.add_response_db_filter("ti123123mmy", action, "don", "sam", "tim", "fred")
|
151
|
+
context.add_response_db_filter(10233234, action, "don", "sam", "tim", "fred")
|
152
|
+
context.add_response_db_filter(true, action, "don", "sam", "tim", "fred")
|
153
|
+
body = "this is about timmy1 3123123."
|
154
|
+
TCellAgent.empty_event_queue
|
155
|
+
context.filter_body(body)
|
156
|
+
expect(body).to eq("this is about timmy1 3123123.")
|
157
|
+
expect(TCellAgent.event_queue.length).to eq(3) # timmy, timmy1, 3123123
|
158
|
+
end
|
159
|
+
end
|
160
|
+
context "Log - Database Filters" do
|
161
|
+
it "Tests Redaction and Events" do
|
162
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
163
|
+
action.log_redact = true
|
164
|
+
action.action_id = 5
|
165
|
+
context = TCellData.new
|
166
|
+
context.add_response_db_filter("timmy", action, "don", "sam", "tim", "fred")
|
167
|
+
context.add_response_db_filter("timmy23", action, "don", "sam", "tim", "fred")
|
168
|
+
context.add_response_db_filter("3123123", action, "don", "sam", "tim", "fred")
|
169
|
+
context.add_response_db_filter("tim123my", action, "don", "sam", "tim", "fred")
|
170
|
+
context.add_response_db_filter("timmy1", action, "don", "sam", "tim", "fred")
|
171
|
+
context.add_response_db_filter("tim123123my", action, "don", "sam", "tim", "fred")
|
172
|
+
context.add_response_db_filter("ti21312mmy", action, "don", "sam", "tim", "fred")
|
173
|
+
context.add_response_db_filter("ti123123mmy", action, "don", "sam", "tim", "fred")
|
174
|
+
context.add_response_db_filter(10233234, action, "don", "sam", "tim", "fred")
|
175
|
+
context.add_response_db_filter(true, action, "don", "sam", "tim", "fred")
|
176
|
+
body = "this is about timmy1 3123123."
|
177
|
+
TCellAgent.empty_event_queue
|
178
|
+
context.filter_log(body)
|
179
|
+
expect(body).to eq("this is about [redacted] [redacted].")
|
180
|
+
expect(TCellAgent.event_queue.length).to eq(2)
|
159
181
|
end
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
expect(TCellAgent.event_queue.length).to eq(2)
|
181
|
-
end
|
182
|
-
it "Tests Report-Only and Events" do
|
183
|
-
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
184
|
-
action.log_event = true
|
185
|
-
action.action_id = 5
|
186
|
-
context = TCellData.new
|
187
|
-
context.add_response_db_filter("timmy", action, "don", "sam", "tim", "fred")
|
188
|
-
context.add_response_db_filter("timmy23", action, "don", "sam", "tim", "fred")
|
189
|
-
context.add_response_db_filter("3123123", action, "don", "sam", "tim", "fred")
|
190
|
-
context.add_response_db_filter("tim123my", action, "don", "sam", "tim", "fred")
|
191
|
-
context.add_response_db_filter("timmy1", action, "don", "sam", "tim", "fred")
|
192
|
-
context.add_response_db_filter("tim123123my", action, "don", "sam", "tim", "fred")
|
193
|
-
context.add_response_db_filter("ti21312mmy", action, "don", "sam", "tim", "fred")
|
194
|
-
context.add_response_db_filter("ti123123mmy", action, "don", "sam", "tim", "fred")
|
195
|
-
context.add_response_db_filter(10233234, action, "don", "sam", "tim", "fred")
|
196
|
-
context.add_response_db_filter(true, action, "don", "sam", "tim", "fred")
|
197
|
-
body = "this is about timmy1 3123123."
|
198
|
-
TCellAgent.empty_event_queue
|
199
|
-
context.filter_log(body)
|
200
|
-
expect(body).to eq("this is about timmy1 3123123.")
|
201
|
-
expect(TCellAgent.event_queue.length).to eq(3) # timmy, timmy1, 3123123
|
202
|
-
end
|
182
|
+
it "Tests Report-Only and Events" do
|
183
|
+
action = TCellAgent::Policies::DataLossPolicy::FilterActions.new
|
184
|
+
action.log_event = true
|
185
|
+
action.action_id = 5
|
186
|
+
context = TCellData.new
|
187
|
+
context.add_response_db_filter("timmy", action, "don", "sam", "tim", "fred")
|
188
|
+
context.add_response_db_filter("timmy23", action, "don", "sam", "tim", "fred")
|
189
|
+
context.add_response_db_filter("3123123", action, "don", "sam", "tim", "fred")
|
190
|
+
context.add_response_db_filter("tim123my", action, "don", "sam", "tim", "fred")
|
191
|
+
context.add_response_db_filter("timmy1", action, "don", "sam", "tim", "fred")
|
192
|
+
context.add_response_db_filter("tim123123my", action, "don", "sam", "tim", "fred")
|
193
|
+
context.add_response_db_filter("ti21312mmy", action, "don", "sam", "tim", "fred")
|
194
|
+
context.add_response_db_filter("ti123123mmy", action, "don", "sam", "tim", "fred")
|
195
|
+
context.add_response_db_filter(10233234, action, "don", "sam", "tim", "fred")
|
196
|
+
context.add_response_db_filter(true, action, "don", "sam", "tim", "fred")
|
197
|
+
body = "this is about timmy1 3123123."
|
198
|
+
TCellAgent.empty_event_queue
|
199
|
+
context.filter_log(body)
|
200
|
+
expect(body).to eq("this is about timmy1 3123123.")
|
201
|
+
expect(TCellAgent.event_queue.length).to eq(3) # timmy, timmy1, 3123123
|
203
202
|
end
|
204
203
|
end
|
204
|
+
end
|
205
205
|
end
|
206
206
|
end
|