tcell_agent 1.1.3 → 1.1.4
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 +10 -2
- data/lib/tcell_agent.rb +3 -3
- data/lib/tcell_agent/agent.rb +42 -52
- data/lib/tcell_agent/agent/event_processor.rb +129 -162
- data/lib/tcell_agent/agent/fork_pipe_manager.rb +57 -62
- data/lib/tcell_agent/agent/policy_manager.rb +83 -104
- data/lib/tcell_agent/agent/policy_types.rb +24 -29
- data/lib/tcell_agent/agent/route_manager.rb +36 -46
- data/lib/tcell_agent/agent/static_agent.rb +19 -21
- data/lib/tcell_agent/api.rb +23 -28
- data/lib/tcell_agent/appsensor/injections_reporter.rb +7 -11
- data/lib/tcell_agent/authlogic.rb +7 -7
- data/lib/tcell_agent/cmdi.rb +22 -23
- data/lib/tcell_agent/config/unknown_options.rb +71 -69
- data/lib/tcell_agent/configuration.rb +187 -191
- data/lib/tcell_agent/devise.rb +13 -15
- data/lib/tcell_agent/hooks/login_fraud.rb +1 -1
- data/lib/tcell_agent/instrumentation.rb +120 -124
- data/lib/tcell_agent/logger.rb +29 -45
- data/lib/tcell_agent/patches.rb +5 -5
- data/lib/tcell_agent/policies/dataloss_policy.rb +263 -288
- data/lib/tcell_agent/policies/http_redirect_policy.rb +25 -37
- data/lib/tcell_agent/policies/http_tx_policy.rb +48 -52
- data/lib/tcell_agent/policies/login_fraud_policy.rb +15 -20
- data/lib/tcell_agent/policies/policy.rb +0 -2
- data/lib/tcell_agent/policies/rust_policies.rb +24 -29
- data/lib/tcell_agent/rails.rb +2 -3
- data/lib/tcell_agent/rails/auth/authlogic.rb +2 -2
- data/lib/tcell_agent/rails/auth/devise.rb +2 -2
- data/lib/tcell_agent/rails/auth/doorkeeper.rb +2 -2
- data/lib/tcell_agent/rails/better_ip.rb +12 -16
- data/lib/tcell_agent/rails/csrf_exception.rb +4 -7
- data/lib/tcell_agent/rails/dlp.rb +208 -107
- data/lib/tcell_agent/rails/dlp/process_request.rb +37 -47
- data/lib/tcell_agent/rails/dlp_handler.rb +9 -11
- data/lib/tcell_agent/rails/js_agent_insert.rb +11 -14
- data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +8 -7
- data/lib/tcell_agent/rails/middleware/context_middleware.rb +4 -5
- data/lib/tcell_agent/rails/middleware/global_middleware.rb +5 -8
- data/lib/tcell_agent/rails/middleware/headers_middleware.rb +24 -27
- data/lib/tcell_agent/rails/on_start.rb +5 -5
- data/lib/tcell_agent/rails/responses.rb +7 -9
- data/lib/tcell_agent/rails/routes.rb +62 -81
- data/lib/tcell_agent/rails/routes/grape.rb +25 -30
- data/lib/tcell_agent/rails/routes/route_id.rb +9 -14
- data/lib/tcell_agent/rails/settings_reporter.rb +44 -33
- data/lib/tcell_agent/rails/tcell_body_proxy.rb +15 -18
- data/lib/tcell_agent/routes/table.rb +31 -33
- data/lib/tcell_agent/rust/{libtcellagent-1.3.0.dylib → libtcellagent-1.3.1.dylib} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-1.3.0.so → libtcellagent-1.3.1.so} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-alpine-1.3.0.so → libtcellagent-alpine-1.3.1.so} +0 -0
- data/lib/tcell_agent/rust/models.rb +32 -37
- data/lib/tcell_agent/rust/tcellagent-1.3.1.dll +0 -0
- data/lib/tcell_agent/rust/whisperer.rb +101 -104
- data/lib/tcell_agent/sensor_events/app_config.rb +7 -7
- data/lib/tcell_agent/sensor_events/appsensor_event.rb +26 -27
- data/lib/tcell_agent/sensor_events/appsensor_meta_event.rb +20 -88
- data/lib/tcell_agent/sensor_events/command_injection.rb +52 -80
- data/lib/tcell_agent/sensor_events/discovery.rb +27 -27
- data/lib/tcell_agent/sensor_events/dlp.rb +50 -56
- data/lib/tcell_agent/sensor_events/honeytokens.rb +9 -9
- data/lib/tcell_agent/sensor_events/metrics.rb +20 -21
- data/lib/tcell_agent/sensor_events/patches.rb +10 -12
- data/lib/tcell_agent/sensor_events/sensor.rb +32 -36
- data/lib/tcell_agent/sensor_events/server_agent.rb +130 -127
- data/lib/tcell_agent/sensor_events/util/sanitizer_utilities.rb +60 -80
- data/lib/tcell_agent/sensor_events/util/utils.rb +3 -5
- data/lib/tcell_agent/servers/passenger.rb +5 -9
- data/lib/tcell_agent/servers/puma.rb +18 -27
- data/lib/tcell_agent/servers/rails_server.rb +5 -9
- data/lib/tcell_agent/servers/thin.rb +2 -4
- data/lib/tcell_agent/servers/unicorn.rb +18 -27
- data/lib/tcell_agent/servers/webrick.rb +2 -4
- data/lib/tcell_agent/settings_reporter.rb +126 -0
- data/lib/tcell_agent/sinatra.rb +24 -26
- data/lib/tcell_agent/start_background_thread.rb +21 -142
- data/lib/tcell_agent/system_info.rb +4 -3
- data/lib/tcell_agent/tcell_context.rb +150 -0
- data/lib/tcell_agent/userinfo.rb +3 -3
- data/lib/tcell_agent/utils/io.rb +19 -24
- data/lib/tcell_agent/utils/params.rb +9 -15
- data/lib/tcell_agent/utils/queue_with_timeout.rb +26 -32
- data/lib/tcell_agent/utils/strings.rb +4 -6
- data/lib/tcell_agent/version.rb +1 -1
- data/spec/lib/tcell_agent/agent/policy_manager_spec.rb +5 -5
- data/spec/lib/tcell_agent/agent/static_agent_spec.rb +7 -7
- data/spec/lib/tcell_agent/cmdi_spec.rb +21 -21
- data/spec/lib/tcell_agent/hooks/login_fraud_spec.rb +29 -24
- data/spec/lib/tcell_agent/instrumentation_spec.rb +4 -4
- data/spec/lib/tcell_agent/patches_spec.rb +8 -8
- data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +23 -23
- data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +2 -2
- data/spec/lib/tcell_agent/rails/csrf_exception_spec.rb +69 -0
- data/spec/lib/tcell_agent/rails/dlp_spec.rb +1039 -0
- data/spec/lib/tcell_agent/rails/js_agent_insert_spec.rb +271 -0
- data/spec/lib/tcell_agent/rails/logger_spec.rb +5 -5
- data/spec/lib/tcell_agent/rails/middleware/appsensor_middleware_spec.rb +3 -3
- data/spec/lib/tcell_agent/rails/middleware/dlp_middleware_spec.rb +4 -4
- data/spec/lib/tcell_agent/rails/middleware/global_middleware_spec.rb +5 -5
- data/spec/lib/tcell_agent/rails/middleware/redirect_middleware_spec.rb +1 -1
- data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +11 -8
- data/spec/lib/tcell_agent/rails/responses_spec.rb +2 -2
- data/spec/lib/tcell_agent/rails/routes/grape_spec.rb +2 -2
- data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +1 -1
- data/spec/lib/tcell_agent/rails/routes/routes_spec.rb +4 -4
- data/spec/lib/tcell_agent/rust/models_spec.rb +83 -75
- data/spec/lib/tcell_agent/rust/whisperer_spec.rb +14 -14
- data/spec/lib/tcell_agent/sensor_events/appsensor_meta_event_spec.rb +19 -70
- data/spec/lib/tcell_agent/sensor_events/sessions_metric_spec.rb +1 -1
- data/spec/lib/tcell_agent/settings_reporter_spec.rb +162 -0
- data/spec/lib/tcell_agent/tcell_context_spec.rb +154 -0
- data/spec/spec_helper.rb +5 -0
- metadata +18 -10
- data/lib/tcell_agent/appsensor/meta_data.rb +0 -132
- data/lib/tcell_agent/patches/meta_data.rb +0 -59
- data/lib/tcell_agent/rust/tcellagent-1.3.0.dll +0 -0
- data/spec/lib/tcell_agent/appsensor/meta_data_spec.rb +0 -71
@@ -4,20 +4,20 @@ module TCellAgent
|
|
4
4
|
module SensorEvents
|
5
5
|
class AppConfigSettingEvent < TCellSensorEvent
|
6
6
|
def initialize(package, section, prefix, name, value)
|
7
|
-
super(
|
8
|
-
self[
|
9
|
-
self[
|
7
|
+
super('app_config_setting')
|
8
|
+
self['package'] = package
|
9
|
+
self['section'] = section
|
10
10
|
|
11
|
-
self[
|
12
|
-
self[
|
11
|
+
self['name'] = name
|
12
|
+
self['value'] = value.to_s
|
13
13
|
|
14
|
-
self[
|
14
|
+
self['prefix'] = prefix if prefix
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
class TCellAgentSettingEvent < AppConfigSettingEvent
|
19
19
|
def initialize(name, value)
|
20
|
-
super(
|
20
|
+
super('tcell', 'config', nil, name, value)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'tcell_agent/sensor_events/sensor'
|
2
2
|
|
3
|
-
|
4
3
|
module TCellAgent
|
5
4
|
module SensorEvents
|
6
5
|
class TCellAppSensorEvent < TCellSensorEvent
|
@@ -16,36 +15,36 @@ module TCellAgent
|
|
16
15
|
payload,
|
17
16
|
pattern,
|
18
17
|
full_uri)
|
19
|
-
super(
|
20
|
-
self[
|
18
|
+
super('as')
|
19
|
+
self['dp'] = detection_point
|
21
20
|
|
22
|
-
self[
|
23
|
-
self[
|
24
|
-
self[
|
25
|
-
self[
|
26
|
-
self[
|
27
|
-
self[
|
28
|
-
self[
|
29
|
-
self[
|
30
|
-
self[
|
31
|
-
self[
|
32
|
-
self[
|
21
|
+
self['param'] = param.to_s if param
|
22
|
+
self['m'] = method.to_s if method
|
23
|
+
self['pattern'] = pattern if pattern
|
24
|
+
self['meta'] = meta if meta
|
25
|
+
self['rid'] = route_id.to_s if route_id
|
26
|
+
self['full_uri'] = full_uri if full_uri
|
27
|
+
self['uri'] = location if location
|
28
|
+
self['uid'] = user_id.to_s if user_id
|
29
|
+
self['sid'] = hmac_session_id if hmac_session_id
|
30
|
+
self['remote_addr'] = remote_address.to_s if remote_address
|
31
|
+
self['payload'] = payload if payload
|
33
32
|
end
|
34
33
|
|
35
34
|
def self.build_from_native_lib_event(event)
|
36
|
-
|
37
|
-
event[
|
38
|
-
event[
|
39
|
-
event[
|
40
|
-
event[
|
41
|
-
event[
|
42
|
-
event[
|
43
|
-
event[
|
44
|
-
event[
|
45
|
-
event[
|
46
|
-
event[
|
47
|
-
event[
|
48
|
-
event[
|
35
|
+
TCellAppSensorEvent.new(
|
36
|
+
event['uri'],
|
37
|
+
event['detection_point'],
|
38
|
+
event['method'],
|
39
|
+
event['remote_address'],
|
40
|
+
event['parameter'],
|
41
|
+
event['route_id'],
|
42
|
+
event['meta'],
|
43
|
+
event['session_id'],
|
44
|
+
event['user_id'],
|
45
|
+
event['payload'],
|
46
|
+
event['pattern'],
|
47
|
+
event['full_uri']
|
49
48
|
)
|
50
49
|
end
|
51
50
|
end
|
@@ -1,113 +1,45 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# See the file "LICENSE" for the full license governing this code.
|
3
|
-
|
4
|
-
require 'tcell_agent/sensor_events/sensor'
|
5
|
-
|
6
1
|
require 'tcell_agent/agent'
|
7
2
|
require 'tcell_agent/agent/policy_types'
|
8
|
-
require 'tcell_agent/
|
9
|
-
require 'tcell_agent/
|
10
|
-
|
11
|
-
|
12
|
-
# Some Rules Originate from ModSecurity
|
13
|
-
# ModSecurity for Apache 2.x, http://www.modsecurity.org/
|
14
|
-
# Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
3
|
+
require 'tcell_agent/tcell_context'
|
4
|
+
require 'tcell_agent/sensor_events/sensor'
|
15
5
|
|
16
6
|
module TCellAgent
|
17
7
|
module SensorEvents
|
18
|
-
|
19
|
-
class AppSensorMetaEvent < TCellAgent::AppSensor::MetaData
|
20
|
-
|
8
|
+
class AppSensorMetaEvent < TCellAgent::SensorEvents::TCellSensorEvent
|
21
9
|
class << self
|
22
10
|
def build(request, response_content_length, response_code, response_headers)
|
23
|
-
|
24
|
-
meta_event = AppSensorMetaEvent.new(
|
25
|
-
tcell_context.request_method,
|
26
|
-
tcell_context.ip_address,
|
27
|
-
tcell_context.route_id,
|
28
|
-
tcell_context.hmac_session_id,
|
29
|
-
tcell_context.user_id,
|
30
|
-
tcell_context.transaction_id,
|
31
|
-
tcell_context.uri
|
32
|
-
)
|
33
|
-
|
34
|
-
meta_event.csrf_exception_name = tcell_context.csrf_exception_name
|
35
|
-
meta_event.user_agent = tcell_context.user_agent
|
36
|
-
meta_event.request_content_bytes_len = (request.content_length || 0).to_i
|
37
|
-
meta_event.response_content_bytes_len = response_content_length
|
38
|
-
|
39
|
-
# use uri stored in tcell_context because
|
40
|
-
# rails modifies original request.url
|
41
|
-
# to always return /404 (or whatever error code
|
42
|
-
# it encountered)
|
43
|
-
meta_event.location = tcell_context.uri
|
44
|
-
meta_event.path = tcell_context.path
|
11
|
+
meta_data = TCellAgent::MetaData.from_request(request)
|
45
12
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
meta_event.path_parameters = tcell_context.path_parameters
|
54
|
-
meta_event.response_code = response_code
|
55
|
-
meta_event.response_headers = response_headers
|
56
|
-
|
57
|
-
meta_event.sql_exceptions = tcell_context.sql_exceptions
|
58
|
-
meta_event.database_result_sizes = tcell_context.database_result_sizes
|
59
|
-
|
60
|
-
# Positions strio to the beginning of input, resetting lineno to zero.
|
61
|
-
# rails 4.1 seems to read the stringIO directly and so body.gets is empty
|
62
|
-
# this is called
|
63
|
-
request.body.rewind
|
13
|
+
tcell_context = request.env[TCellAgent::Instrumentation::TCELL_ID]
|
14
|
+
meta_data.csrf_exception_name = tcell_context.csrf_exception_name
|
15
|
+
meta_data.user_agent = tcell_context.user_agent
|
16
|
+
meta_data.path_parameters = tcell_context.path_parameters
|
17
|
+
meta_data.sql_exceptions = tcell_context.sql_exceptions
|
18
|
+
meta_data.database_result_sizes = tcell_context.database_result_sizes
|
64
19
|
|
65
|
-
|
66
|
-
meta_event.request_content_bytes_len,
|
67
|
-
request.content_type,
|
68
|
-
request.body.gets
|
69
|
-
)
|
20
|
+
meta_data.response_content_bytes_len = response_content_length
|
70
21
|
|
71
|
-
|
72
|
-
|
22
|
+
meta_data.response_code = response_code
|
23
|
+
meta_data.response_headers = response_headers
|
73
24
|
|
74
|
-
|
75
|
-
AppSensorMetaEvent.new(
|
76
|
-
appsensor_meta.method,
|
77
|
-
appsensor_meta.remote_address,
|
78
|
-
appsensor_meta.route_id,
|
79
|
-
appsensor_meta.session_id,
|
80
|
-
appsensor_meta.user_id,
|
81
|
-
appsensor_meta.transaction_id,
|
82
|
-
appsensor_meta.location
|
83
|
-
)
|
25
|
+
AppSensorMetaEvent.new(meta_data)
|
84
26
|
end
|
85
27
|
end
|
86
28
|
|
29
|
+
attr_accessor :meta_data
|
87
30
|
|
88
|
-
|
89
|
-
|
90
|
-
:sql_exceptions, :database_result_sizes
|
91
|
-
|
92
|
-
def initialize(method, remote_address, route_id, session_id, user_id, transaction_id, location)
|
93
|
-
super(method, remote_address, route_id, session_id, user_id, transaction_id, location)
|
31
|
+
def initialize(meta_data)
|
32
|
+
@send = false
|
94
33
|
|
95
|
-
@
|
96
|
-
@response_content_bytes_len = 0
|
97
|
-
@user_agent = nil
|
34
|
+
@meta_data = meta_data
|
98
35
|
end
|
99
36
|
|
100
37
|
def post_process
|
101
|
-
rust_policies = TCellAgent.policy(TCellAgent::PolicyTypes::
|
38
|
+
rust_policies = TCellAgent.policy(TCellAgent::PolicyTypes::RUST)
|
102
39
|
return unless rust_policies
|
103
40
|
|
104
|
-
rust_policies.check_appfirewall_injections(
|
105
|
-
end
|
106
|
-
|
107
|
-
def flattened_post_dict
|
108
|
-
@post_dict
|
41
|
+
rust_policies.check_appfirewall_injections(@meta_data)
|
109
42
|
end
|
110
43
|
end
|
111
|
-
|
112
44
|
end
|
113
45
|
end
|
@@ -2,102 +2,74 @@ require 'tcell_agent/sensor_events/sensor'
|
|
2
2
|
|
3
3
|
module TCellAgent
|
4
4
|
module SensorEvents
|
5
|
-
|
6
5
|
class CommandInjectionMatchEvent < Hash
|
7
6
|
def initialize(rule_id, command)
|
8
|
-
self[
|
9
|
-
if command
|
10
|
-
self["command"] = command
|
11
|
-
end
|
7
|
+
self['rule_id'] = rule_id
|
8
|
+
self['command'] = command if command
|
12
9
|
end
|
13
10
|
end
|
14
11
|
|
15
12
|
class CommandInjectionEvent < TCellSensorEvent
|
16
|
-
|
17
13
|
def self.build_from_native_lib_response_and_tcell_context(apply_response,
|
18
14
|
tcell_context)
|
19
|
-
matches = apply_response.fetch(
|
20
|
-
|
21
|
-
if matches
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
matches_without_emtpy_values = matches.map do |match|
|
33
|
-
CommandInjectionMatchEvent.new(
|
34
|
-
match["rule_id"], match["command"]
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
CommandInjectionEvent.new(
|
39
|
-
apply_response["commands"],
|
40
|
-
blocked=apply_response.fetch("blocked", false),
|
41
|
-
matches=matches_without_emtpy_values,
|
42
|
-
method=method,
|
43
|
-
remote_address=remote_address,
|
44
|
-
route_id=route_id,
|
45
|
-
session_id=session_id,
|
46
|
-
user_id=user_id,
|
47
|
-
uri=uri,
|
48
|
-
full_commandline=apply_response["full_commandline"])
|
15
|
+
matches = apply_response.fetch('matches', [])
|
16
|
+
|
17
|
+
return nil if !matches || matches.empty?
|
18
|
+
|
19
|
+
method, remote_address, route_id, session_id, user_id, uri = nil
|
20
|
+
if tcell_context
|
21
|
+
method = tcell_context.request_method
|
22
|
+
remote_address = tcell_context.ip_address
|
23
|
+
route_id = tcell_context.route_id
|
24
|
+
session_id = tcell_context.hmac_session_id
|
25
|
+
user_id = tcell_context.user_id
|
26
|
+
uri = tcell_context.uri
|
27
|
+
end
|
49
28
|
|
50
|
-
|
51
|
-
|
29
|
+
matches_without_emtpy_values = matches.map do |match|
|
30
|
+
CommandInjectionMatchEvent.new(
|
31
|
+
match['rule_id'], match['command']
|
32
|
+
)
|
52
33
|
end
|
53
|
-
end
|
54
34
|
|
35
|
+
CommandInjectionEvent.new(
|
36
|
+
apply_response['commands'],
|
37
|
+
apply_response.fetch('blocked', false),
|
38
|
+
matches_without_emtpy_values,
|
39
|
+
method,
|
40
|
+
remote_address,
|
41
|
+
route_id,
|
42
|
+
session_id,
|
43
|
+
user_id,
|
44
|
+
uri,
|
45
|
+
apply_response['full_commandline']
|
46
|
+
)
|
47
|
+
end
|
55
48
|
|
56
49
|
def initialize(commands,
|
57
50
|
blocked,
|
58
51
|
matches,
|
59
|
-
method=nil,
|
60
|
-
remote_address=nil,
|
61
|
-
route_id=nil,
|
62
|
-
session_id=nil,
|
63
|
-
user_id=nil,
|
64
|
-
uri=nil,
|
65
|
-
full_commandline=nil)
|
66
|
-
super(
|
67
|
-
|
68
|
-
self[
|
69
|
-
self[
|
70
|
-
self[
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
if
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
if route_id
|
81
|
-
self["rid"] = route_id
|
82
|
-
end
|
83
|
-
|
84
|
-
if session_id
|
85
|
-
self["sid"] = session_id
|
86
|
-
end
|
87
|
-
|
88
|
-
if user_id
|
89
|
-
self["uid"] = user_id
|
90
|
-
end
|
91
|
-
|
92
|
-
if full_commandline
|
93
|
-
self["full_commandline"] = full_commandline
|
94
|
-
end
|
95
|
-
|
96
|
-
if uri
|
97
|
-
self["uri"] = TCellAgent::SensorEvents::Util.strip_uri_values(uri)
|
98
|
-
end
|
52
|
+
method = nil,
|
53
|
+
remote_address = nil,
|
54
|
+
route_id = nil,
|
55
|
+
session_id = nil,
|
56
|
+
user_id = nil,
|
57
|
+
uri = nil,
|
58
|
+
full_commandline = nil)
|
59
|
+
super('cmdi')
|
60
|
+
|
61
|
+
self['commands'] = commands
|
62
|
+
self['blocked'] = blocked
|
63
|
+
self['matches'] = matches
|
64
|
+
self['m'] = method if method
|
65
|
+
|
66
|
+
self['remote_addr'] = remote_address if remote_address
|
67
|
+
self['rid'] = route_id if route_id
|
68
|
+
self['sid'] = session_id if session_id
|
69
|
+
self['uid'] = user_id if user_id
|
70
|
+
self['full_commandline'] = full_commandline if full_commandline
|
71
|
+
self['uri'] = TCellAgent::SensorEvents::Util.strip_uri_values(uri) if uri
|
99
72
|
end
|
100
73
|
end
|
101
|
-
|
102
74
|
end
|
103
75
|
end
|
@@ -1,30 +1,30 @@
|
|
1
1
|
require 'tcell_agent/sensor_events/sensor'
|
2
2
|
|
3
3
|
module TCellAgent
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
4
|
+
module SensorEvents
|
5
|
+
class DiscoveryEvent < TCellSensorEvent
|
6
|
+
DATABASE_TYPE = 'db'.freeze
|
7
|
+
def initialize(route_id = nil)
|
8
|
+
super('discovery')
|
9
|
+
self['rid'] = route_id if route_id
|
10
|
+
end
|
11
|
+
|
12
|
+
def for_database(database, schema, table, field)
|
13
|
+
self['type'] = 'db'
|
14
|
+
self['db'] = database
|
15
|
+
self['schema'] = schema
|
16
|
+
self['table'] = table
|
17
|
+
self['field'] = field
|
18
|
+
end
|
19
|
+
|
20
|
+
def for_database_fields(database, schema, table, fields)
|
21
|
+
self['type'] = 'db'
|
22
|
+
self['db'] = database
|
23
|
+
self['schema'] = schema
|
24
|
+
self['table'] = table
|
25
|
+
self['fields'] = fields
|
26
|
+
self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -4,60 +4,54 @@ require 'tcell_agent/sensor_events/util/sanitizer_utilities'
|
|
4
4
|
require 'tcell_agent/sensor_events/sensor'
|
5
5
|
require 'tcell_agent/sensor_events/util/sanitizer_utilities'
|
6
6
|
module TCellAgent
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
def post_process
|
57
|
-
if @raw_uri
|
58
|
-
self["uri"] = Util.strip_uri_values(@raw_uri)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
7
|
+
module SensorEvents
|
8
|
+
class DlpEvent < TCellSensorEvent
|
9
|
+
FOUND_IN_BODY = 'body'.freeze
|
10
|
+
FOUND_IN_LOG = 'log'.freeze
|
11
|
+
FOUND_IN_CONSOLE = 'console'.freeze
|
12
|
+
|
13
|
+
FRAMEWORK_VARIABLE_SESSION_ID = 'session_id'.freeze
|
14
|
+
|
15
|
+
REQUEST_CONTEXT_FORM = 'form'.freeze
|
16
|
+
REQUEST_CONTEXT_COOKIE = 'cookie'.freeze
|
17
|
+
REQUEST_CONTEXT_HEADER = 'header'.freeze
|
18
|
+
|
19
|
+
def initialize(route_id, raw_uri, found_in, id = nil, hmac_session_id = nil, user_id = nil)
|
20
|
+
super('dlp')
|
21
|
+
self['rid'] = route_id if route_id
|
22
|
+
self['found_in'] = found_in
|
23
|
+
@raw_uri = raw_uri
|
24
|
+
self['sid'] = hmac_session_id if hmac_session_id
|
25
|
+
self['uid'] = user_id if user_id
|
26
|
+
self['rule'] = id if id
|
27
|
+
end
|
28
|
+
|
29
|
+
def for_database(database, schema, table, field)
|
30
|
+
self['type'] = 'db'
|
31
|
+
self['db'] = database
|
32
|
+
self['schema'] = schema
|
33
|
+
self['table'] = table
|
34
|
+
self['field'] = field
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
def for_framework(variable)
|
39
|
+
self['type'] = 'fw'
|
40
|
+
self['context'] = 'framework'
|
41
|
+
self['variable'] = variable
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
def for_request(variable_context, variable)
|
46
|
+
self['type'] = 'req'
|
47
|
+
self['context'] = variable_context
|
48
|
+
self['variable'] = variable
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
def post_process
|
53
|
+
self['uri'] = Util.strip_uri_values(@raw_uri) if @raw_uri
|
54
|
+
end
|
62
55
|
end
|
63
|
-
end
|
56
|
+
end
|
57
|
+
end
|