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