tcell_agent 0.4.0 → 1.0.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.
- checksums.yaml +4 -4
- data/Rakefile +9 -22
- data/bin/tcell_agent +127 -132
- data/lib/tcell_agent/agent/event_processor.rb +23 -22
- data/lib/tcell_agent/agent/fork_pipe_manager.rb +7 -7
- data/lib/tcell_agent/agent/policy_manager.rb +20 -15
- data/lib/tcell_agent/agent/policy_types.rb +5 -11
- data/lib/tcell_agent/agent/static_agent.rb +5 -1
- data/lib/tcell_agent/agent.rb +6 -4
- data/lib/tcell_agent/api.rb +7 -9
- data/lib/tcell_agent/appsensor/meta_data.rb +11 -4
- data/lib/tcell_agent/authlogic.rb +3 -3
- data/lib/tcell_agent/cmdi.rb +6 -4
- data/lib/tcell_agent/config/unknown_options.rb +3 -1
- data/lib/tcell_agent/configuration.rb +47 -49
- data/lib/tcell_agent/devise.rb +2 -2
- data/lib/tcell_agent/hooks/login_fraud.rb +58 -29
- data/lib/tcell_agent/instrumentation.rb +11 -10
- data/lib/tcell_agent/logger.rb +2 -2
- data/lib/tcell_agent/patches/meta_data.rb +9 -13
- data/lib/tcell_agent/patches.rb +7 -10
- data/lib/tcell_agent/policies/clickjacking_policy.rb +4 -5
- data/lib/tcell_agent/policies/content_security_policy.rb +6 -12
- data/lib/tcell_agent/policies/dataloss_policy.rb +2 -2
- data/lib/tcell_agent/policies/http_redirect_policy.rb +2 -2
- data/lib/tcell_agent/policies/policy.rb +0 -2
- data/lib/tcell_agent/policies/rust_policies.rb +90 -0
- data/lib/tcell_agent/policies/secure_headers_policy.rb +2 -2
- data/lib/tcell_agent/rails/auth/authlogic.rb +42 -24
- data/lib/tcell_agent/rails/auth/devise.rb +44 -23
- data/lib/tcell_agent/rails/auth/doorkeeper.rb +33 -15
- data/lib/tcell_agent/rails/better_ip.rb +1 -1
- data/lib/tcell_agent/rails/csrf_exception.rb +2 -2
- data/lib/tcell_agent/rails/dlp/process_request.rb +1 -1
- data/lib/tcell_agent/rails/dlp.rb +6 -6
- data/lib/tcell_agent/rails/dlp_handler.rb +1 -1
- data/lib/tcell_agent/rails/js_agent_insert.rb +1 -1
- data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +1 -1
- data/lib/tcell_agent/rails/middleware/context_middleware.rb +3 -2
- data/lib/tcell_agent/rails/middleware/headers_middleware.rb +10 -9
- data/lib/tcell_agent/rails/routes/grape.rb +6 -6
- data/lib/tcell_agent/rails/routes.rb +8 -11
- data/lib/tcell_agent/rust/libtcellagent-0.11.1.dylib +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-0.6.1.so → libtcellagent-0.11.1.so} +0 -0
- data/lib/tcell_agent/rust/models.rb +16 -0
- data/lib/tcell_agent/rust/tcellagent-0.11.1.dll +0 -0
- data/lib/tcell_agent/rust/whisperer.rb +119 -48
- data/lib/tcell_agent/sensor_events/appsensor_meta_event.rb +17 -20
- data/lib/tcell_agent/sensor_events/command_injection.rb +50 -5
- data/lib/tcell_agent/sensor_events/login_fraud.rb +34 -18
- data/lib/tcell_agent/sensor_events/patches.rb +21 -0
- data/lib/tcell_agent/sensor_events/server_agent.rb +3 -3
- data/lib/tcell_agent/sensor_events/util/utils.rb +4 -3
- data/lib/tcell_agent/servers/puma.rb +2 -2
- data/lib/tcell_agent/servers/unicorn.rb +1 -1
- data/lib/tcell_agent/utils/passwords.rb +28 -0
- data/lib/tcell_agent/version.rb +1 -1
- data/lib/tcell_agent.rb +1 -5
- data/spec/apps/rails-3.2/config/tcell_agent.config +15 -0
- data/spec/apps/rails-3.2/log/development.log +0 -0
- data/spec/apps/rails-3.2/log/test.log +12 -0
- data/spec/apps/rails-4.1/log/test.log +0 -0
- data/spec/lib/tcell_agent/agent/fork_pipe_manager_spec.rb +46 -45
- data/spec/lib/tcell_agent/agent/policy_manager_spec.rb +276 -164
- data/spec/lib/tcell_agent/agent/static_agent_spec.rb +44 -47
- data/spec/lib/tcell_agent/api/api_spec.rb +16 -16
- data/spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb +131 -116
- data/spec/lib/tcell_agent/appsensor/meta_data_spec.rb +55 -51
- data/spec/lib/tcell_agent/cmdi_spec.rb +413 -436
- data/spec/lib/tcell_agent/config/unknown_options_spec.rb +145 -128
- data/spec/lib/tcell_agent/configuration_spec.rb +165 -169
- data/spec/lib/tcell_agent/hooks/login_fraud_spec.rb +144 -153
- data/spec/lib/tcell_agent/instrumentation_spec.rb +84 -85
- data/spec/lib/tcell_agent/patches_spec.rb +70 -111
- data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +313 -244
- data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +28 -28
- data/spec/lib/tcell_agent/policies/command_injection_policy_spec.rb +643 -513
- data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +55 -102
- data/spec/lib/tcell_agent/policies/dataloss_policy_spec.rb +111 -134
- data/spec/lib/tcell_agent/policies/http_redirect_policy_spec.rb +141 -146
- data/spec/lib/tcell_agent/policies/http_tx_policy_spec.rb +8 -8
- data/spec/lib/tcell_agent/policies/login_policy_spec.rb +15 -17
- data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +231 -559
- data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +27 -27
- data/spec/lib/tcell_agent/rails/better_ip_spec.rb +30 -34
- data/spec/lib/tcell_agent/rails/logger_spec.rb +50 -49
- data/spec/lib/tcell_agent/rails/middleware/appsensor_middleware_spec.rb +182 -199
- data/spec/lib/tcell_agent/rails/middleware/dlp_middleware_spec.rb +110 -84
- data/spec/lib/tcell_agent/rails/middleware/global_middleware_spec.rb +107 -85
- data/spec/lib/tcell_agent/rails/middleware/redirect_middleware_spec.rb +68 -40
- data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +81 -67
- data/spec/lib/tcell_agent/rails/responses_spec.rb +33 -37
- data/spec/lib/tcell_agent/rails/routes/grape_spec.rb +116 -121
- data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +25 -28
- data/spec/lib/tcell_agent/rails/routes/routes_spec.rb +87 -85
- data/spec/lib/tcell_agent/rails_spec.rb +1 -6
- data/spec/lib/tcell_agent/rust/models_spec.rb +112 -0
- data/spec/lib/tcell_agent/rust/whisperer_spec.rb +502 -179
- data/spec/lib/tcell_agent/sensor_events/appsensor_meta_event_spec.rb +44 -33
- data/spec/lib/tcell_agent/sensor_events/dlp_spec.rb +4 -4
- data/spec/lib/tcell_agent/sensor_events/sessions_metric_spec.rb +183 -169
- data/spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb +25 -25
- data/spec/lib/tcell_agent/utils/bounded_queue_spec.rb +17 -20
- data/spec/lib/tcell_agent/utils/params_spec.rb +28 -28
- data/spec/lib/tcell_agent/utils/passwords_spec.rb +143 -0
- data/spec/lib/tcell_agent/utils/strings_spec.rb +35 -35
- data/spec/lib/tcell_agent_spec.rb +8 -8
- data/spec/spec_helper.rb +4 -4
- data/spec/support/middleware_helper.rb +10 -10
- data/spec/support/static_agent_overrides.rb +16 -12
- data/tcell_agent.gemspec +17 -33
- metadata +43 -198
- data/LICENSE_libinjection +0 -32
- data/Readme.txt +0 -7
- data/ext/libinjection/extconf.rb +0 -3
- data/ext/libinjection/libinjection.h +0 -65
- data/ext/libinjection/libinjection_html5.c +0 -847
- data/ext/libinjection/libinjection_html5.h +0 -54
- data/ext/libinjection/libinjection_sqli.c +0 -2317
- data/ext/libinjection/libinjection_sqli.h +0 -295
- data/ext/libinjection/libinjection_sqli_data.h +0 -9004
- data/ext/libinjection/libinjection_wrap.c +0 -3525
- data/ext/libinjection/libinjection_xss.c +0 -531
- data/ext/libinjection/libinjection_xss.h +0 -21
- data/lib/tcell_agent/appsensor/injections_matcher.rb +0 -155
- data/lib/tcell_agent/appsensor/rules/appsensor_rule_manager.rb +0 -49
- data/lib/tcell_agent/appsensor/rules/appsensor_rule_set.rb +0 -67
- data/lib/tcell_agent/appsensor/rules/baserules.json +0 -467
- data/lib/tcell_agent/patches/block_rule.rb +0 -93
- data/lib/tcell_agent/patches/sensors_matcher.rb +0 -31
- data/lib/tcell_agent/policies/appsensor/cmdi_sensor.rb +0 -23
- data/lib/tcell_agent/policies/appsensor/fpt_sensor.rb +0 -23
- data/lib/tcell_agent/policies/appsensor/injection_sensor.rb +0 -117
- data/lib/tcell_agent/policies/appsensor/nullbyte_sensor.rb +0 -26
- data/lib/tcell_agent/policies/appsensor/retr_sensor.rb +0 -22
- data/lib/tcell_agent/policies/appsensor/sqli_sensor.rb +0 -34
- data/lib/tcell_agent/policies/appsensor/xss_sensor.rb +0 -34
- data/lib/tcell_agent/policies/appsensor_policy.rb +0 -49
- data/lib/tcell_agent/policies/command_injection_policy.rb +0 -196
- data/lib/tcell_agent/policies/honeytokens_policy.rb +0 -69
- data/lib/tcell_agent/policies/patches_policy.rb +0 -84
- data/lib/tcell_agent/rust/libtcellagent-0.6.1.dylib +0 -0
- data/lib/tcell_agent/rust/tcellagent-0.6.1.dll +0 -0
- data/spec/apps/rails-3.2/Gemfile +0 -25
- data/spec/apps/rails-3.2/Gemfile.lock +0 -126
- data/spec/apps/rails-3.2/Rakefile +0 -7
- data/spec/apps/rails-3.2/app/assets/images/rails.png +0 -0
- data/spec/apps/rails-3.2/app/assets/javascripts/application.js +0 -15
- data/spec/apps/rails-3.2/app/assets/stylesheets/application.css +0 -13
- data/spec/apps/rails-3.2/app/controllers/application_controller.rb +0 -3
- data/spec/apps/rails-3.2/app/controllers/t_cell_app_controller.rb +0 -5
- data/spec/apps/rails-3.2/app/helpers/application_helper.rb +0 -2
- data/spec/apps/rails-3.2/app/views/layouts/application.html.erb +0 -14
- data/spec/apps/rails-3.2/app/views/t_cell_app/index.html.erb +0 -1
- data/spec/apps/rails-3.2/config/application.rb +0 -63
- data/spec/apps/rails-3.2/config/boot.rb +0 -6
- data/spec/apps/rails-3.2/config/environment.rb +0 -5
- data/spec/apps/rails-3.2/config/environments/test.rb +0 -37
- data/spec/apps/rails-3.2/config/routes.rb +0 -11
- data/spec/apps/rails-3.2/config.ru +0 -4
- data/spec/apps/rails-4.1/Gemfile +0 -7
- data/spec/apps/rails-4.1/Gemfile.lock +0 -114
- data/spec/apps/rails-4.1/Rakefile +0 -6
- data/spec/apps/rails-4.1/app/assets/javascripts/application.js +0 -16
- data/spec/apps/rails-4.1/app/assets/stylesheets/application.css +0 -15
- data/spec/apps/rails-4.1/app/controllers/application_controller.rb +0 -5
- data/spec/apps/rails-4.1/app/controllers/t_cell_app_controller.rb +0 -5
- data/spec/apps/rails-4.1/app/helpers/application_helper.rb +0 -2
- data/spec/apps/rails-4.1/app/views/layouts/application.html.erb +0 -14
- data/spec/apps/rails-4.1/app/views/t_cell_app/index.html.erb +0 -1
- data/spec/apps/rails-4.1/config/application.rb +0 -24
- data/spec/apps/rails-4.1/config/boot.rb +0 -4
- data/spec/apps/rails-4.1/config/environment.rb +0 -5
- data/spec/apps/rails-4.1/config/environments/test.rb +0 -41
- data/spec/apps/rails-4.1/config/initializers/assets.rb +0 -8
- data/spec/apps/rails-4.1/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/apps/rails-4.1/config/initializers/cookies_serializer.rb +0 -3
- data/spec/apps/rails-4.1/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/apps/rails-4.1/config/initializers/inflections.rb +0 -16
- data/spec/apps/rails-4.1/config/initializers/mime_types.rb +0 -4
- data/spec/apps/rails-4.1/config/initializers/session_store.rb +0 -3
- data/spec/apps/rails-4.1/config/initializers/wrap_parameters.rb +0 -14
- data/spec/apps/rails-4.1/config/locales/en.yml +0 -23
- data/spec/apps/rails-4.1/config/routes.rb +0 -12
- data/spec/apps/rails-4.1/config/secrets.yml +0 -22
- data/spec/apps/rails-4.1/config.ru +0 -4
- data/spec/controllers/application_controller.rb +0 -12
- data/spec/lib/tcell_agent/appsensor/injections_matcher_spec.rb +0 -522
- data/spec/lib/tcell_agent/appsensor/rules/appsensor_rule_manager_spec.rb +0 -23
- data/spec/lib/tcell_agent/appsensor/rules/appsensor_rule_set_spec.rb +0 -159
- data/spec/lib/tcell_agent/patches/block_rule_spec.rb +0 -458
- data/spec/lib/tcell_agent/patches/sensors_matcher_spec.rb +0 -35
- data/spec/lib/tcell_agent/policies/appsensor/cmdi_sensor_spec.rb +0 -139
- data/spec/lib/tcell_agent/policies/appsensor/fpt_sensor_spec.rb +0 -139
- data/spec/lib/tcell_agent/policies/appsensor/nullbyte_sensor_spec.rb +0 -167
- data/spec/lib/tcell_agent/policies/appsensor/retr_sensor_spec.rb +0 -139
- data/spec/lib/tcell_agent/policies/appsensor/sqli_sensor_spec.rb +0 -246
- data/spec/lib/tcell_agent/policies/appsensor/xss_sensor_spec.rb +0 -882
- data/spec/lib/tcell_agent/policies/honeytokens_policy_spec.rb +0 -22
|
@@ -1,203 +1,201 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
module TCellAgent
|
|
4
|
-
|
|
5
4
|
describe Configuration do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
it "should set cache file, config, and log file to defaults" do
|
|
5
|
+
describe '#agent_home_dir' do
|
|
6
|
+
context 'no TCELL_AGENT_HOME defined' do
|
|
7
|
+
it 'should set cache file, config, and log file to defaults' do
|
|
10
8
|
configuration = Configuration.new
|
|
11
9
|
|
|
12
10
|
expect(configuration.cache_filename_with_app_id).to match(
|
|
13
|
-
/tcell
|
|
11
|
+
%r{/tcell/cache/tcell_agent.cache}
|
|
14
12
|
)
|
|
15
13
|
expect(configuration.log_filename).to eq(
|
|
16
|
-
File.join(Dir.getwd,
|
|
14
|
+
File.join(Dir.getwd, 'tcell/logs/tcell_agent.log')
|
|
17
15
|
)
|
|
18
16
|
expect(configuration.config_filename).to eq(
|
|
19
|
-
File.join(Dir.getwd,
|
|
17
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
20
18
|
)
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
21
|
|
|
24
|
-
context
|
|
25
|
-
it
|
|
26
|
-
old_tcell_agent_home = ENV[
|
|
22
|
+
context 'TCELL_AGENT_HOME defined' do
|
|
23
|
+
it 'should set config filename to default, cache file and log file are updated' do
|
|
24
|
+
old_tcell_agent_home = ENV['TCELL_AGENT_HOME']
|
|
27
25
|
|
|
28
|
-
ENV[
|
|
26
|
+
ENV['TCELL_AGENT_HOME'] = 'spec_tcell_home'
|
|
29
27
|
|
|
30
28
|
configuration = Configuration.new
|
|
31
29
|
|
|
32
30
|
expect(configuration.cache_filename_with_app_id).to match(
|
|
33
|
-
/
|
|
31
|
+
%r{spec_tcell_home/cache/tcell_agent.cache}
|
|
34
32
|
)
|
|
35
33
|
expect(configuration.log_filename).to eq(
|
|
36
|
-
|
|
34
|
+
'spec_tcell_home/logs/tcell_agent.log'
|
|
37
35
|
)
|
|
38
36
|
expect(configuration.config_filename).to eq(
|
|
39
|
-
File.join(Dir.getwd,
|
|
37
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
40
38
|
)
|
|
41
39
|
|
|
42
|
-
ENV[
|
|
40
|
+
ENV['TCELL_AGENT_HOME'] = old_tcell_agent_home
|
|
43
41
|
end
|
|
44
42
|
end
|
|
45
43
|
|
|
46
|
-
context
|
|
47
|
-
it
|
|
48
|
-
old_tcell_agent_home = ENV[
|
|
49
|
-
old_tcell_agent_log_dir = ENV[
|
|
44
|
+
context 'TCELL_AGENT_HOME and TCELL_AGENT_LOG_DIR defined' do
|
|
45
|
+
it 'should set config filename to default, cache file and log file are updated' do
|
|
46
|
+
old_tcell_agent_home = ENV['TCELL_AGENT_HOME']
|
|
47
|
+
old_tcell_agent_log_dir = ENV['TCELL_AGENT_LOG_DIR']
|
|
50
48
|
|
|
51
|
-
ENV[
|
|
52
|
-
ENV[
|
|
49
|
+
ENV['TCELL_AGENT_HOME'] = 'spec_tcell_home'
|
|
50
|
+
ENV['TCELL_AGENT_LOG_DIR'] = 'spec_tcell_log_dir'
|
|
53
51
|
|
|
54
52
|
configuration = Configuration.new
|
|
55
53
|
|
|
56
54
|
expect(configuration.cache_filename_with_app_id).to match(
|
|
57
|
-
/
|
|
55
|
+
%r{spec_tcell_home/cache/tcell_agent.cache}
|
|
58
56
|
)
|
|
59
57
|
expect(configuration.log_filename).to eq(
|
|
60
|
-
|
|
58
|
+
'spec_tcell_log_dir/tcell_agent.log'
|
|
61
59
|
)
|
|
62
60
|
expect(configuration.config_filename).to eq(
|
|
63
|
-
File.join(Dir.getwd,
|
|
61
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
64
62
|
)
|
|
65
63
|
|
|
66
|
-
ENV[
|
|
67
|
-
ENV[
|
|
64
|
+
ENV['TCELL_AGENT_HOME'] = old_tcell_agent_home
|
|
65
|
+
ENV['TCELL_AGENT_LOG_DIR'] = old_tcell_agent_log_dir
|
|
68
66
|
end
|
|
69
67
|
end
|
|
70
68
|
|
|
71
|
-
context
|
|
72
|
-
it
|
|
73
|
-
old_tcell_agent_home = ENV[
|
|
74
|
-
old_tcell_agent_log_dir = ENV[
|
|
75
|
-
old_config_filename = ENV[
|
|
69
|
+
context 'TCELL_AGENT_HOME, TCELL_AGENT_LOG_DIR, and TCELL_AGENT_CONFIG defined ' do
|
|
70
|
+
it 'should update config filename, cache file, and log file' do
|
|
71
|
+
old_tcell_agent_home = ENV['TCELL_AGENT_HOME']
|
|
72
|
+
old_tcell_agent_log_dir = ENV['TCELL_AGENT_LOG_DIR']
|
|
73
|
+
old_config_filename = ENV['TCELL_AGENT_CONFIG']
|
|
76
74
|
|
|
77
|
-
ENV[
|
|
78
|
-
ENV[
|
|
79
|
-
ENV[
|
|
75
|
+
ENV['TCELL_AGENT_HOME'] = 'spec_tcell_home'
|
|
76
|
+
ENV['TCELL_AGENT_LOG_DIR'] = 'spec_tcell_log_dir'
|
|
77
|
+
ENV['TCELL_AGENT_CONFIG'] = 'spec_config/tcell_agent.config'
|
|
80
78
|
|
|
81
79
|
configuration = Configuration.new
|
|
82
80
|
|
|
83
81
|
expect(configuration.cache_filename_with_app_id).to match(
|
|
84
|
-
/
|
|
82
|
+
%r{spec_tcell_home/cache/tcell_agent.cache}
|
|
85
83
|
)
|
|
86
84
|
expect(configuration.log_filename).to eq(
|
|
87
|
-
|
|
85
|
+
'spec_tcell_log_dir/tcell_agent.log'
|
|
88
86
|
)
|
|
89
87
|
expect(configuration.config_filename).to eq(
|
|
90
|
-
|
|
88
|
+
'spec_config/tcell_agent.config'
|
|
91
89
|
)
|
|
92
90
|
|
|
93
|
-
ENV[
|
|
94
|
-
ENV[
|
|
95
|
-
ENV[
|
|
91
|
+
ENV['TCELL_AGENT_HOME'] = old_tcell_agent_home
|
|
92
|
+
ENV['TCELL_AGENT_LOG_DIR'] = old_tcell_agent_log_dir
|
|
93
|
+
ENV['TCELL_AGENT_CONFIG'] = old_config_filename
|
|
96
94
|
end
|
|
97
95
|
end
|
|
98
96
|
end
|
|
99
97
|
|
|
100
|
-
describe
|
|
101
|
-
context
|
|
102
|
-
it
|
|
98
|
+
describe '#data_exposure' do
|
|
99
|
+
context 'no data_exposure defined' do
|
|
100
|
+
it 'should set max_data_ex_db_records_per_request to default' do
|
|
103
101
|
no_data_ex = double(
|
|
104
|
-
|
|
105
|
-
read
|
|
106
|
-
version
|
|
107
|
-
applications
|
|
108
|
-
app_id
|
|
109
|
-
name
|
|
110
|
-
api_key
|
|
102
|
+
'no_data_ex',
|
|
103
|
+
:read => {
|
|
104
|
+
:version => 1,
|
|
105
|
+
:applications => [
|
|
106
|
+
:app_id => 'app_id',
|
|
107
|
+
:name => 'test',
|
|
108
|
+
:api_key => 'api_key'
|
|
111
109
|
]
|
|
112
110
|
}.to_json
|
|
113
111
|
)
|
|
114
112
|
expect(File).to receive(:file?).with(
|
|
115
|
-
File.join(Dir.getwd,
|
|
113
|
+
File.join(Dir.getwd, 'no_data_ex.config')
|
|
116
114
|
).and_return(true)
|
|
117
115
|
expect(File).to receive(:open).with(
|
|
118
|
-
File.join(Dir.getwd,
|
|
116
|
+
File.join(Dir.getwd, 'no_data_ex.config')
|
|
119
117
|
).and_return(no_data_ex)
|
|
120
|
-
configuration = Configuration.new(
|
|
118
|
+
configuration = Configuration.new('no_data_ex.config')
|
|
121
119
|
|
|
122
120
|
expect(configuration.max_data_ex_db_records_per_request).to eq(1000)
|
|
123
121
|
end
|
|
124
122
|
end
|
|
125
123
|
|
|
126
|
-
context
|
|
127
|
-
it
|
|
124
|
+
context 'data_exposure is empty' do
|
|
125
|
+
it 'should set max_data_ex_db_records_per_request to default' do
|
|
128
126
|
no_data_ex = double(
|
|
129
|
-
|
|
130
|
-
read
|
|
131
|
-
version
|
|
132
|
-
applications
|
|
133
|
-
app_id
|
|
134
|
-
name
|
|
135
|
-
api_key
|
|
136
|
-
data_exposure
|
|
127
|
+
'no_data_ex',
|
|
128
|
+
:read => {
|
|
129
|
+
:version => 1,
|
|
130
|
+
:applications => [
|
|
131
|
+
:app_id => 'app_id',
|
|
132
|
+
:name => 'test',
|
|
133
|
+
:api_key => 'api_key',
|
|
134
|
+
:data_exposure => {}
|
|
137
135
|
]
|
|
138
136
|
}.to_json
|
|
139
137
|
)
|
|
140
138
|
expect(File).to receive(:file?).with(
|
|
141
|
-
File.join(Dir.getwd,
|
|
139
|
+
File.join(Dir.getwd, 'no_data_ex.config')
|
|
142
140
|
).and_return(true)
|
|
143
141
|
expect(File).to receive(:open).with(
|
|
144
|
-
File.join(Dir.getwd,
|
|
142
|
+
File.join(Dir.getwd, 'no_data_ex.config')
|
|
145
143
|
).and_return(no_data_ex)
|
|
146
|
-
configuration = Configuration.new(
|
|
144
|
+
configuration = Configuration.new('no_data_ex.config')
|
|
147
145
|
|
|
148
146
|
expect(configuration.max_data_ex_db_records_per_request).to eq(1000)
|
|
149
147
|
end
|
|
150
148
|
end
|
|
151
149
|
|
|
152
|
-
context
|
|
153
|
-
it
|
|
150
|
+
context 'data_exposure contains an override' do
|
|
151
|
+
it 'should set max_data_ex_db_records_per_request to override' do
|
|
154
152
|
no_data_ex = double(
|
|
155
|
-
|
|
156
|
-
read
|
|
157
|
-
version
|
|
158
|
-
applications
|
|
159
|
-
app_id
|
|
160
|
-
name
|
|
161
|
-
api_key
|
|
162
|
-
data_exposure
|
|
163
|
-
max_data_ex_db_records_per_request
|
|
153
|
+
'no_data_ex',
|
|
154
|
+
:read => {
|
|
155
|
+
:version => 1,
|
|
156
|
+
:applications => [
|
|
157
|
+
:app_id => 'app_id',
|
|
158
|
+
:name => 'test',
|
|
159
|
+
:api_key => 'api_key',
|
|
160
|
+
:data_exposure => {
|
|
161
|
+
:max_data_ex_db_records_per_request => 5000
|
|
164
162
|
}
|
|
165
163
|
]
|
|
166
164
|
}.to_json
|
|
167
165
|
)
|
|
168
166
|
expect(File).to receive(:file?).with(
|
|
169
|
-
File.join(Dir.getwd,
|
|
167
|
+
File.join(Dir.getwd, 'no_data_ex.config')
|
|
170
168
|
).and_return(true)
|
|
171
169
|
expect(File).to receive(:open).with(
|
|
172
|
-
File.join(Dir.getwd,
|
|
170
|
+
File.join(Dir.getwd, 'no_data_ex.config')
|
|
173
171
|
).and_return(no_data_ex)
|
|
174
|
-
configuration = Configuration.new(
|
|
172
|
+
configuration = Configuration.new('no_data_ex.config')
|
|
175
173
|
|
|
176
174
|
expect(configuration.max_data_ex_db_records_per_request).to eq(5000)
|
|
177
175
|
end
|
|
178
176
|
end
|
|
179
177
|
end
|
|
180
178
|
|
|
181
|
-
describe
|
|
182
|
-
context
|
|
183
|
-
context
|
|
184
|
-
it
|
|
179
|
+
describe '#allow_payloads' do
|
|
180
|
+
context 'setting it via config' do
|
|
181
|
+
context 'using allow_unencrypted_appsensor_payloads' do
|
|
182
|
+
it 'should be false' do
|
|
185
183
|
allow_unencrypted_appfirewall_payloads_enabled = double(
|
|
186
|
-
|
|
187
|
-
read
|
|
188
|
-
version
|
|
189
|
-
applications
|
|
190
|
-
app_id
|
|
191
|
-
api_key
|
|
192
|
-
allow_unencrypted_appsensor_payloads
|
|
184
|
+
'no_data_ex',
|
|
185
|
+
:read => {
|
|
186
|
+
:version => 1,
|
|
187
|
+
:applications => [
|
|
188
|
+
:app_id => 'app_id',
|
|
189
|
+
:api_key => 'api_key',
|
|
190
|
+
:allow_unencrypted_appsensor_payloads => false
|
|
193
191
|
]
|
|
194
192
|
}.to_json
|
|
195
193
|
)
|
|
196
194
|
expect(File).to receive(:file?).with(
|
|
197
|
-
File.join(Dir.getwd,
|
|
195
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
198
196
|
).and_return(true)
|
|
199
197
|
expect(File).to receive(:open).with(
|
|
200
|
-
File.join(Dir.getwd,
|
|
198
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
201
199
|
).and_return(allow_unencrypted_appfirewall_payloads_enabled)
|
|
202
200
|
|
|
203
201
|
configuration = Configuration.new
|
|
@@ -206,24 +204,24 @@ module TCellAgent
|
|
|
206
204
|
end
|
|
207
205
|
end
|
|
208
206
|
|
|
209
|
-
context
|
|
210
|
-
it
|
|
207
|
+
context 'using allow_unencrypted_appfirewall_payloads' do
|
|
208
|
+
it 'should be false' do
|
|
211
209
|
allow_unencrypted_appfirewall_payloads_enabled = double(
|
|
212
|
-
|
|
213
|
-
read
|
|
214
|
-
version
|
|
215
|
-
applications
|
|
216
|
-
app_id
|
|
217
|
-
api_key
|
|
218
|
-
allow_unencrypted_appfirewall_payloads
|
|
210
|
+
'no_data_ex',
|
|
211
|
+
:read => {
|
|
212
|
+
:version => 1,
|
|
213
|
+
:applications => [
|
|
214
|
+
:app_id => 'app_id',
|
|
215
|
+
:api_key => 'api_key',
|
|
216
|
+
:allow_unencrypted_appfirewall_payloads => false
|
|
219
217
|
]
|
|
220
218
|
}.to_json
|
|
221
219
|
)
|
|
222
220
|
expect(File).to receive(:file?).with(
|
|
223
|
-
File.join(Dir.getwd,
|
|
221
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
224
222
|
).and_return(true)
|
|
225
223
|
expect(File).to receive(:open).with(
|
|
226
|
-
File.join(Dir.getwd,
|
|
224
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
227
225
|
).and_return(allow_unencrypted_appfirewall_payloads_enabled)
|
|
228
226
|
|
|
229
227
|
configuration = Configuration.new
|
|
@@ -232,24 +230,24 @@ module TCellAgent
|
|
|
232
230
|
end
|
|
233
231
|
end
|
|
234
232
|
|
|
235
|
-
context
|
|
236
|
-
it
|
|
233
|
+
context 'using allow_payloads' do
|
|
234
|
+
it 'should be false' do
|
|
237
235
|
allow_unencrypted_appfirewall_payloads_enabled = double(
|
|
238
|
-
|
|
239
|
-
read
|
|
240
|
-
version
|
|
241
|
-
applications
|
|
242
|
-
app_id
|
|
243
|
-
api_key
|
|
244
|
-
allow_payloads
|
|
236
|
+
'no_data_ex',
|
|
237
|
+
:read => {
|
|
238
|
+
:version => 1,
|
|
239
|
+
:applications => [
|
|
240
|
+
:app_id => 'app_id',
|
|
241
|
+
:api_key => 'api_key',
|
|
242
|
+
:allow_payloads => false
|
|
245
243
|
]
|
|
246
244
|
}.to_json
|
|
247
245
|
)
|
|
248
246
|
expect(File).to receive(:file?).with(
|
|
249
|
-
File.join(Dir.getwd,
|
|
247
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
250
248
|
).and_return(true)
|
|
251
249
|
expect(File).to receive(:open).with(
|
|
252
|
-
File.join(Dir.getwd,
|
|
250
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
253
251
|
).and_return(allow_unencrypted_appfirewall_payloads_enabled)
|
|
254
252
|
|
|
255
253
|
configuration = Configuration.new
|
|
@@ -259,113 +257,111 @@ module TCellAgent
|
|
|
259
257
|
end
|
|
260
258
|
end
|
|
261
259
|
|
|
262
|
-
context
|
|
263
|
-
context
|
|
264
|
-
it
|
|
265
|
-
old_allow_unencrypted_appsensor_payloads = ENV[
|
|
260
|
+
context 'setting it via env var' do
|
|
261
|
+
context 'TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS overrides config file' do
|
|
262
|
+
it 'should be false' do
|
|
263
|
+
old_allow_unencrypted_appsensor_payloads = ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS']
|
|
266
264
|
|
|
267
|
-
ENV[
|
|
265
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS'] = 'false'
|
|
268
266
|
|
|
269
267
|
allow_unencrypted_appfirewall_payloads_enabled = double(
|
|
270
|
-
|
|
271
|
-
read
|
|
272
|
-
version
|
|
273
|
-
applications
|
|
274
|
-
app_id
|
|
275
|
-
api_key
|
|
276
|
-
allow_unencrypted_appsensor_payloads
|
|
268
|
+
'no_data_ex',
|
|
269
|
+
:read => {
|
|
270
|
+
:version => 1,
|
|
271
|
+
:applications => [
|
|
272
|
+
:app_id => 'app_id',
|
|
273
|
+
:api_key => 'api_key',
|
|
274
|
+
:allow_unencrypted_appsensor_payloads => true
|
|
277
275
|
]
|
|
278
276
|
}.to_json
|
|
279
277
|
)
|
|
280
278
|
expect(File).to receive(:file?).with(
|
|
281
|
-
File.join(Dir.getwd,
|
|
279
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
282
280
|
).and_return(true)
|
|
283
281
|
expect(File).to receive(:open).with(
|
|
284
|
-
File.join(Dir.getwd,
|
|
282
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
285
283
|
).and_return(allow_unencrypted_appfirewall_payloads_enabled)
|
|
286
284
|
|
|
287
285
|
configuration = Configuration.new
|
|
288
286
|
|
|
289
|
-
ENV[
|
|
287
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS'] = old_allow_unencrypted_appsensor_payloads
|
|
290
288
|
|
|
291
289
|
expect(configuration.allow_payloads).to eq(false)
|
|
292
290
|
end
|
|
293
291
|
end
|
|
294
292
|
|
|
295
|
-
context
|
|
296
|
-
it
|
|
297
|
-
old_allow_unencrypted_appfirewall_payloads = ENV[
|
|
293
|
+
context 'TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS overrides config file' do
|
|
294
|
+
it 'should be false' do
|
|
295
|
+
old_allow_unencrypted_appfirewall_payloads = ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS']
|
|
298
296
|
|
|
299
|
-
ENV[
|
|
297
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS'] = 'false'
|
|
300
298
|
|
|
301
299
|
allow_unencrypted_appfirewall_payloads_enabled = double(
|
|
302
|
-
|
|
303
|
-
read
|
|
304
|
-
version
|
|
305
|
-
applications
|
|
306
|
-
app_id
|
|
307
|
-
api_key
|
|
308
|
-
allow_unencrypted_appfirewall_payloads
|
|
300
|
+
'no_data_ex',
|
|
301
|
+
:read => {
|
|
302
|
+
:version => 1,
|
|
303
|
+
:applications => [
|
|
304
|
+
:app_id => 'app_id',
|
|
305
|
+
:api_key => 'api_key',
|
|
306
|
+
:allow_unencrypted_appfirewall_payloads => true
|
|
309
307
|
]
|
|
310
308
|
}.to_json
|
|
311
309
|
)
|
|
312
310
|
expect(File).to receive(:file?).with(
|
|
313
|
-
File.join(Dir.getwd,
|
|
311
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
314
312
|
).and_return(true)
|
|
315
313
|
expect(File).to receive(:open).with(
|
|
316
|
-
File.join(Dir.getwd,
|
|
314
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
317
315
|
).and_return(allow_unencrypted_appfirewall_payloads_enabled)
|
|
318
316
|
|
|
319
317
|
configuration = Configuration.new
|
|
320
318
|
|
|
321
|
-
ENV[
|
|
319
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS'] = old_allow_unencrypted_appfirewall_payloads
|
|
322
320
|
|
|
323
321
|
expect(configuration.allow_payloads).to eq(false)
|
|
324
322
|
end
|
|
325
323
|
end
|
|
326
324
|
|
|
327
|
-
context
|
|
328
|
-
it
|
|
329
|
-
old_allow_unencrypted_appsensor_payloads = ENV[
|
|
330
|
-
old_allow_unencrypted_appfirewall_payloads = ENV[
|
|
331
|
-
old_tcell_agent_allow_payloads = ENV[
|
|
325
|
+
context 'TCELL_AGENT_ALLOW_PAYLOADS overrides everything else' do
|
|
326
|
+
it 'should be false' do
|
|
327
|
+
old_allow_unencrypted_appsensor_payloads = ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS']
|
|
328
|
+
old_allow_unencrypted_appfirewall_payloads = ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS']
|
|
329
|
+
old_tcell_agent_allow_payloads = ENV['TCELL_AGENT_ALLOW_PAYLOADS']
|
|
332
330
|
|
|
333
|
-
ENV[
|
|
334
|
-
ENV[
|
|
335
|
-
ENV[
|
|
331
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS'] = 'true'
|
|
332
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS'] = 'true'
|
|
333
|
+
ENV['TCELL_AGENT_ALLOW_PAYLOADS'] = 'false'
|
|
336
334
|
|
|
337
335
|
allow_unencrypted_appfirewall_payloads_enabled = double(
|
|
338
|
-
|
|
339
|
-
read
|
|
340
|
-
version
|
|
341
|
-
applications
|
|
342
|
-
app_id
|
|
343
|
-
api_key
|
|
344
|
-
allow_unencrypted_appsensor_payloads
|
|
345
|
-
allow_unencrypted_appfirewall_payloads
|
|
346
|
-
allow_payloads
|
|
336
|
+
'no_data_ex',
|
|
337
|
+
:read => {
|
|
338
|
+
:version => 1,
|
|
339
|
+
:applications => [
|
|
340
|
+
:app_id => 'app_id',
|
|
341
|
+
:api_key => 'api_key',
|
|
342
|
+
:allow_unencrypted_appsensor_payloads => true,
|
|
343
|
+
:allow_unencrypted_appfirewall_payloads => true,
|
|
344
|
+
:allow_payloads => true
|
|
347
345
|
]
|
|
348
346
|
}.to_json
|
|
349
347
|
)
|
|
350
348
|
expect(File).to receive(:file?).with(
|
|
351
|
-
File.join(Dir.getwd,
|
|
349
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
352
350
|
).and_return(true)
|
|
353
351
|
expect(File).to receive(:open).with(
|
|
354
|
-
File.join(Dir.getwd,
|
|
352
|
+
File.join(Dir.getwd, 'config/tcell_agent.config')
|
|
355
353
|
).and_return(allow_unencrypted_appfirewall_payloads_enabled)
|
|
356
354
|
|
|
357
355
|
configuration = Configuration.new
|
|
358
356
|
|
|
359
|
-
ENV[
|
|
360
|
-
ENV[
|
|
361
|
-
ENV[
|
|
357
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPSENSOR_PAYLOADS'] = old_allow_unencrypted_appsensor_payloads
|
|
358
|
+
ENV['TCELL_AGENT_ALLOW_UNENCRYPTED_APPFIREWALL_PAYLOADS'] = old_allow_unencrypted_appfirewall_payloads
|
|
359
|
+
ENV['TCELL_AGENT_ALLOW_PAYLOADS'] = old_tcell_agent_allow_payloads
|
|
362
360
|
|
|
363
361
|
expect(configuration.allow_payloads).to eq(false)
|
|
364
362
|
end
|
|
365
363
|
end
|
|
366
364
|
end
|
|
367
365
|
end
|
|
368
|
-
|
|
369
366
|
end
|
|
370
|
-
|
|
371
367
|
end
|