tcell_agent 2.1.2 → 2.4.1

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +2 -2
  3. data/bin/tcell_agent +41 -150
  4. data/lib/tcell_agent.rb +8 -16
  5. data/lib/tcell_agent/agent.rb +87 -52
  6. data/lib/tcell_agent/config_initializer.rb +62 -0
  7. data/lib/tcell_agent/configuration.rb +72 -267
  8. data/lib/tcell_agent/hooks/login_fraud.rb +1 -1
  9. data/lib/tcell_agent/instrument_servers.rb +14 -18
  10. data/lib/tcell_agent/instrumentation.rb +14 -6
  11. data/lib/tcell_agent/instrumentation/cmdi.rb +32 -0
  12. data/lib/tcell_agent/instrumentation/lfi.rb +55 -9
  13. data/lib/tcell_agent/instrumentation/monkey_patches/ruby_2/file.rb +21 -0
  14. data/lib/tcell_agent/instrumentation/monkey_patches/ruby_2/io.rb +75 -0
  15. data/lib/tcell_agent/instrumentation/monkey_patches/ruby_2/kernel.rb +80 -0
  16. data/lib/tcell_agent/instrumentation/monkey_patches/ruby_3/file.rb +21 -0
  17. data/lib/tcell_agent/instrumentation/monkey_patches/ruby_3/io.rb +75 -0
  18. data/lib/tcell_agent/instrumentation/monkey_patches/ruby_3/kernel.rb +80 -0
  19. data/lib/tcell_agent/logger.rb +3 -4
  20. data/lib/tcell_agent/policies/dataloss_policy.rb +15 -8
  21. data/lib/tcell_agent/policies/headers_policy.rb +2 -2
  22. data/lib/tcell_agent/policies/patches_policy.rb +8 -4
  23. data/lib/tcell_agent/policies/policies_manager.rb +1 -0
  24. data/lib/tcell_agent/policies/policy_polling.rb +4 -3
  25. data/lib/tcell_agent/rails/auth/authlogic.rb +49 -44
  26. data/lib/tcell_agent/rails/auth/authlogic_helper.rb +20 -0
  27. data/lib/tcell_agent/rails/auth/devise.rb +103 -102
  28. data/lib/tcell_agent/rails/auth/devise_helper.rb +29 -0
  29. data/lib/tcell_agent/rails/auth/doorkeeper.rb +54 -57
  30. data/lib/tcell_agent/{userinfo.rb → rails/auth/userinfo.rb} +0 -0
  31. data/lib/tcell_agent/rails/better_ip.rb +7 -19
  32. data/lib/tcell_agent/rails/csrf_exception.rb +0 -8
  33. data/lib/tcell_agent/rails/dlp.rb +48 -52
  34. data/lib/tcell_agent/rails/dlp/process_request.rb +5 -0
  35. data/lib/tcell_agent/rails/dlp_handler.rb +9 -10
  36. data/lib/tcell_agent/rails/js_agent_insert.rb +2 -3
  37. data/lib/tcell_agent/rails/middleware/context_middleware.rb +2 -1
  38. data/lib/tcell_agent/rails/middleware/global_middleware.rb +3 -4
  39. data/lib/tcell_agent/rails/middleware/headers_middleware.rb +1 -0
  40. data/lib/tcell_agent/rails/{on_start.rb → railties/tcell_agent_railties.rb} +9 -16
  41. data/lib/tcell_agent/rails/railties/tcell_agent_unicorn_railties.rb +8 -0
  42. data/lib/tcell_agent/rails/routes.rb +3 -6
  43. data/lib/tcell_agent/rails/routes/grape.rb +3 -4
  44. data/lib/tcell_agent/rails/settings_reporter.rb +3 -6
  45. data/lib/tcell_agent/rails/tcell_body_proxy.rb +4 -7
  46. data/lib/tcell_agent/routes/table.rb +3 -0
  47. data/lib/tcell_agent/rust/agent_config.rb +59 -33
  48. data/lib/tcell_agent/rust/{libtcellagent-4.18.0.so → libtcellagent-alpine.so} +0 -0
  49. data/lib/tcell_agent/rust/libtcellagent-x64.dll +0 -0
  50. data/lib/tcell_agent/rust/{libtcellagent-4.18.0.dylib → libtcellagent.dylib} +0 -0
  51. data/lib/tcell_agent/rust/{libtcellagent-alpine-4.18.0.so → libtcellagent.so} +0 -0
  52. data/lib/tcell_agent/rust/models.rb +9 -0
  53. data/lib/tcell_agent/rust/native_agent.rb +58 -50
  54. data/lib/tcell_agent/rust/native_library.rb +8 -10
  55. data/lib/tcell_agent/sensor_events/server_agent.rb +3 -100
  56. data/lib/tcell_agent/sensor_events/util/sanitizer_utilities.rb +1 -0
  57. data/lib/tcell_agent/servers/puma.rb +30 -13
  58. data/lib/tcell_agent/servers/rack_puma_handler.rb +33 -0
  59. data/lib/tcell_agent/servers/rails_server.rb +4 -4
  60. data/lib/tcell_agent/servers/unicorn.rb +1 -1
  61. data/lib/tcell_agent/servers/webrick.rb +12 -3
  62. data/lib/tcell_agent/settings_reporter.rb +0 -93
  63. data/lib/tcell_agent/sinatra.rb +1 -0
  64. data/lib/tcell_agent/tcell_context.rb +16 -7
  65. data/lib/tcell_agent/utils/headers.rb +0 -1
  66. data/lib/tcell_agent/utils/strings.rb +2 -2
  67. data/lib/tcell_agent/version.rb +1 -1
  68. data/spec/cruby_spec_helper.rb +26 -0
  69. data/spec/lib/tcell_agent/configuration_spec.rb +62 -212
  70. data/spec/lib/tcell_agent/instrument_servers_spec.rb +95 -0
  71. data/spec/lib/tcell_agent/instrumentation/cmdi/io_cmdi_spec.rb +2 -2
  72. data/spec/lib/tcell_agent/instrumentation/lfi/file_lfi_spec.rb +211 -272
  73. data/spec/lib/tcell_agent/instrumentation/lfi/io_lfi_spec.rb +207 -223
  74. data/spec/lib/tcell_agent/instrumentation/lfi/kernel_lfi_spec.rb +89 -70
  75. data/spec/lib/tcell_agent/instrumentation/lfi_spec.rb +73 -0
  76. data/spec/lib/tcell_agent/patches_spec.rb +2 -1
  77. data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +1 -2
  78. data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +5 -6
  79. data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +21 -2
  80. data/spec/lib/tcell_agent/policies/policies_manager_spec.rb +1 -1
  81. data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +14 -8
  82. data/spec/lib/tcell_agent/rails/better_ip_spec.rb +9 -11
  83. data/spec/lib/tcell_agent/rails/csrf_exception_spec.rb +6 -6
  84. data/spec/lib/tcell_agent/rails/dlp_spec.rb +1 -0
  85. data/spec/lib/tcell_agent/rails/js_agent_insert_spec.rb +10 -2
  86. data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +2 -1
  87. data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +4 -4
  88. data/spec/lib/tcell_agent/rust/agent_config_spec.rb +27 -0
  89. data/spec/lib/tcell_agent/settings_reporter_spec.rb +2 -89
  90. data/spec/lib/tcell_agent/tcell_context_spec.rb +6 -5
  91. data/spec/spec_helper.rb +9 -1
  92. data/spec/support/builders.rb +8 -7
  93. data/spec/support/server_mocks/passenger_mock.rb +7 -0
  94. data/spec/support/server_mocks/puma_mock.rb +21 -0
  95. data/spec/support/server_mocks/rails_mock.rb +7 -0
  96. data/spec/support/server_mocks/thin_mock.rb +7 -0
  97. data/spec/support/server_mocks/unicorn_mock.rb +11 -0
  98. data/spec/support/shared_spec.rb +29 -0
  99. data/tcell_agent.gemspec +14 -14
  100. metadata +44 -27
  101. data/Rakefile +0 -18
  102. data/lib/tcell_agent/authlogic.rb +0 -23
  103. data/lib/tcell_agent/config/unknown_options.rb +0 -119
  104. data/lib/tcell_agent/devise.rb +0 -33
  105. data/lib/tcell_agent/instrumentation/monkey_patches/file.rb +0 -25
  106. data/lib/tcell_agent/instrumentation/monkey_patches/io.rb +0 -131
  107. data/lib/tcell_agent/instrumentation/monkey_patches/kernel.rb +0 -102
  108. data/lib/tcell_agent/rails/start_agent_after_initializers.rb +0 -12
  109. data/lib/tcell_agent/rust/tcellagent-4.18.0.dll +0 -0
  110. data/spec/lib/tcell_agent/config/unknown_options_spec.rb +0 -195
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhusionPassenger
4
+ module LoaderSharedHelpers
5
+ def before_handling_requests; end
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Puma
4
+ class Server
5
+ def run; end
6
+ end
7
+
8
+ class Config
9
+ def self.options
10
+ {}
11
+ end
12
+ end
13
+
14
+ def self.cli_config
15
+ Config
16
+ end
17
+
18
+ module Const
19
+ PUMA_VERSION = "5.1.0"
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails
4
+ module Server
5
+ def build_app; end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Thin
4
+ module Server
5
+ def start; end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unicorn
4
+ class HttpServer
5
+ START_CTX = {}.freeze
6
+
7
+ def init_worker_process; end
8
+
9
+ def load_config!; end
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ def test_ruby2_ruby3_keywords(cls, func, args, options, res, min_ruby = '2.0.0')
2
+ ruby_version = Gem::Version.new(RUBY_VERSION)
3
+
4
+ context 'using ruby2_3 helper function' do
5
+ after(:each) do
6
+ expect(@result).to eq res unless res.nil?
7
+ end
8
+
9
+ if ruby_version >= Gem::Version.new(min_ruby) && \
10
+ ruby_version < Gem::Version.new('3.0.0')
11
+ # This spec tests the following format:
12
+ # File.new('/dev/null', 'w', 0o644, { :binmode => true })
13
+ it 'behaves correctly in ruby < 2.7' do
14
+ args_cp = Array.new(args)
15
+ args_cp << options
16
+
17
+ @result = cls.send(func, *args_cp)
18
+ end
19
+ end
20
+
21
+ if ruby_version >= Gem::Version.new(min_ruby)
22
+ # This spec tests the following format:
23
+ # File.new('/dev/null', 'w', 0o644, :binmode => true )
24
+ it 'behaves correctly in ruby >= 3.0' do
25
+ @result = cls.send(func, *args, **options)
26
+ end
27
+ end
28
+ end
29
+ end
data/tcell_agent.gemspec CHANGED
@@ -6,23 +6,23 @@ require 'tcell_agent/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'tcell_agent'
8
8
  spec.version = TCellAgent::VERSION
9
- spec.authors = %w[Rafael]
10
- spec.email = ['rafael@tcell.io']
11
- spec.summary = 'tCell.io Agent for Rails'
12
- spec.description = 'This agent allows users to use the tCell.io service with their Rails app.'
13
- spec.homepage = 'https://www.tcell.io'
14
- spec.license = 'Copyright (c) 2017 tCell.io (see LICENSE file)'
9
+ spec.authors = 'Rapid7, Inc.'
10
+ spec.summary = 'tCell Agent for Rails'
11
+ spec.description = 'This agent allows users to use the tCell service with their Rails app.'
12
+ spec.homepage = 'https://www.rapid7.com/tcell'
13
+ spec.license = 'Copyright (c) 2020 Rapid7, Inc. (see LICENSE file)'
15
14
 
16
15
  spec.files = Dir[
17
- 'Rakefile',
16
+ 'README.md',
17
+ 'LICENSE',
18
+ 'tcell_agent.gemspec',
19
+ 'spec/**/*',
18
20
  'lib/tcell_agent.rb',
19
- '{lib/tcell_agent,spec}/**/*',
20
- 'lib/tcell_agent/rust/libtcellagent-*.so',
21
- 'lib/tcell_agent/rust/libtcellagent-*.dylib',
22
- 'lib/tcell_agent/rust/tcellagent-*.dll',
23
- 'README*',
24
- 'LICENSE*',
25
- 'tcell_agent.gemspec'
21
+ 'lib/tcell_agent/**/*rb',
22
+ 'lib/tcell_agent/rust/libtcellagent.dylib',
23
+ 'lib/tcell_agent/rust/libtcellagent.so',
24
+ 'lib/tcell_agent/rust/libtcellagent-alpine.so',
25
+ 'lib/tcell_agent/rust/libtcellagent-x64.dll',
26
26
  ]
27
27
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
28
28
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcell_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
- - Rafael
7
+ - Rapid7, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-11 00:00:00.000000000 Z
11
+ date: 2021-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -94,10 +94,8 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: This agent allows users to use the tCell.io service with their Rails
98
- app.
99
- email:
100
- - rafael@tcell.io
97
+ description: This agent allows users to use the tCell service with their Rails app.
98
+ email:
101
99
  executables:
102
100
  - tcell_agent
103
101
  extensions: []
@@ -105,24 +103,24 @@ extra_rdoc_files: []
105
103
  files:
106
104
  - LICENSE
107
105
  - README.md
108
- - Rakefile
109
106
  - bin/tcell_agent
110
107
  - lib/tcell_agent.rb
111
108
  - lib/tcell_agent/agent.rb
112
109
  - lib/tcell_agent/agent/route_manager.rb
113
110
  - lib/tcell_agent/agent/static_agent.rb
114
- - lib/tcell_agent/authlogic.rb
115
- - lib/tcell_agent/config/unknown_options.rb
111
+ - lib/tcell_agent/config_initializer.rb
116
112
  - lib/tcell_agent/configuration.rb
117
- - lib/tcell_agent/devise.rb
118
113
  - lib/tcell_agent/hooks/login_fraud.rb
119
114
  - lib/tcell_agent/instrument_servers.rb
120
115
  - lib/tcell_agent/instrumentation.rb
121
116
  - lib/tcell_agent/instrumentation/cmdi.rb
122
117
  - lib/tcell_agent/instrumentation/lfi.rb
123
- - lib/tcell_agent/instrumentation/monkey_patches/file.rb
124
- - lib/tcell_agent/instrumentation/monkey_patches/io.rb
125
- - lib/tcell_agent/instrumentation/monkey_patches/kernel.rb
118
+ - lib/tcell_agent/instrumentation/monkey_patches/ruby_2/file.rb
119
+ - lib/tcell_agent/instrumentation/monkey_patches/ruby_2/io.rb
120
+ - lib/tcell_agent/instrumentation/monkey_patches/ruby_2/kernel.rb
121
+ - lib/tcell_agent/instrumentation/monkey_patches/ruby_3/file.rb
122
+ - lib/tcell_agent/instrumentation/monkey_patches/ruby_3/io.rb
123
+ - lib/tcell_agent/instrumentation/monkey_patches/ruby_3/kernel.rb
126
124
  - lib/tcell_agent/logger.rb
127
125
  - lib/tcell_agent/patches.rb
128
126
  - lib/tcell_agent/policies/appfirewall_policy.rb
@@ -140,8 +138,11 @@ files:
140
138
  - lib/tcell_agent/policies/policy_types.rb
141
139
  - lib/tcell_agent/policies/system_enablements.rb
142
140
  - lib/tcell_agent/rails/auth/authlogic.rb
141
+ - lib/tcell_agent/rails/auth/authlogic_helper.rb
143
142
  - lib/tcell_agent/rails/auth/devise.rb
143
+ - lib/tcell_agent/rails/auth/devise_helper.rb
144
144
  - lib/tcell_agent/rails/auth/doorkeeper.rb
145
+ - lib/tcell_agent/rails/auth/userinfo.rb
145
146
  - lib/tcell_agent/rails/better_ip.rb
146
147
  - lib/tcell_agent/rails/csrf_exception.rb
147
148
  - lib/tcell_agent/rails/dlp.rb
@@ -152,24 +153,24 @@ files:
152
153
  - lib/tcell_agent/rails/middleware/context_middleware.rb
153
154
  - lib/tcell_agent/rails/middleware/global_middleware.rb
154
155
  - lib/tcell_agent/rails/middleware/headers_middleware.rb
155
- - lib/tcell_agent/rails/on_start.rb
156
+ - lib/tcell_agent/rails/railties/tcell_agent_railties.rb
157
+ - lib/tcell_agent/rails/railties/tcell_agent_unicorn_railties.rb
156
158
  - lib/tcell_agent/rails/responses.rb
157
159
  - lib/tcell_agent/rails/routes.rb
158
160
  - lib/tcell_agent/rails/routes/grape.rb
159
161
  - lib/tcell_agent/rails/routes/route_id.rb
160
162
  - lib/tcell_agent/rails/settings_reporter.rb
161
- - lib/tcell_agent/rails/start_agent_after_initializers.rb
162
163
  - lib/tcell_agent/rails/tcell_body_proxy.rb
163
164
  - lib/tcell_agent/routes/table.rb
164
165
  - lib/tcell_agent/rust/agent_config.rb
165
- - lib/tcell_agent/rust/libtcellagent-4.18.0.dylib
166
- - lib/tcell_agent/rust/libtcellagent-4.18.0.so
167
- - lib/tcell_agent/rust/libtcellagent-alpine-4.18.0.so
166
+ - lib/tcell_agent/rust/libtcellagent-alpine.so
167
+ - lib/tcell_agent/rust/libtcellagent-x64.dll
168
+ - lib/tcell_agent/rust/libtcellagent.dylib
169
+ - lib/tcell_agent/rust/libtcellagent.so
168
170
  - lib/tcell_agent/rust/models.rb
169
171
  - lib/tcell_agent/rust/native_agent.rb
170
172
  - lib/tcell_agent/rust/native_agent_response.rb
171
173
  - lib/tcell_agent/rust/native_library.rb
172
- - lib/tcell_agent/rust/tcellagent-4.18.0.dll
173
174
  - lib/tcell_agent/sensor_events/agent_setting_event.rb
174
175
  - lib/tcell_agent/sensor_events/app_config_setting_event.rb
175
176
  - lib/tcell_agent/sensor_events/discovery.rb
@@ -180,6 +181,7 @@ files:
180
181
  - lib/tcell_agent/sensor_events/util/utils.rb
181
182
  - lib/tcell_agent/servers/passenger.rb
182
183
  - lib/tcell_agent/servers/puma.rb
184
+ - lib/tcell_agent/servers/rack_puma_handler.rb
183
185
  - lib/tcell_agent/servers/rails_server.rb
184
186
  - lib/tcell_agent/servers/thin.rb
185
187
  - lib/tcell_agent/servers/unicorn.rb
@@ -187,14 +189,14 @@ files:
187
189
  - lib/tcell_agent/settings_reporter.rb
188
190
  - lib/tcell_agent/sinatra.rb
189
191
  - lib/tcell_agent/tcell_context.rb
190
- - lib/tcell_agent/userinfo.rb
191
192
  - lib/tcell_agent/utils/headers.rb
192
193
  - lib/tcell_agent/utils/params.rb
193
194
  - lib/tcell_agent/utils/strings.rb
194
195
  - lib/tcell_agent/version.rb
195
- - spec/lib/tcell_agent/config/unknown_options_spec.rb
196
+ - spec/cruby_spec_helper.rb
196
197
  - spec/lib/tcell_agent/configuration_spec.rb
197
198
  - spec/lib/tcell_agent/hooks/login_fraud_spec.rb
199
+ - spec/lib/tcell_agent/instrument_servers_spec.rb
198
200
  - spec/lib/tcell_agent/instrumentation/cmdi/io_cmdi_spec.rb
199
201
  - spec/lib/tcell_agent/instrumentation/cmdi/kernel_cmdi_spec.rb
200
202
  - spec/lib/tcell_agent/instrumentation/cmdi_spec.rb
@@ -226,6 +228,7 @@ files:
226
228
  - spec/lib/tcell_agent/rails/routes/route_id_spec.rb
227
229
  - spec/lib/tcell_agent/rails/routes/routes_spec.rb
228
230
  - spec/lib/tcell_agent/rails_spec.rb
231
+ - spec/lib/tcell_agent/rust/agent_config_spec.rb
229
232
  - spec/lib/tcell_agent/sensor_events/dlp_spec.rb
230
233
  - spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb
231
234
  - spec/lib/tcell_agent/settings_reporter_spec.rb
@@ -238,11 +241,17 @@ files:
238
241
  - spec/support/middleware_helper.rb
239
242
  - spec/support/resources/lfi_sample_file.txt
240
243
  - spec/support/resources/normal_config.json
244
+ - spec/support/server_mocks/passenger_mock.rb
245
+ - spec/support/server_mocks/puma_mock.rb
246
+ - spec/support/server_mocks/rails_mock.rb
247
+ - spec/support/server_mocks/thin_mock.rb
248
+ - spec/support/server_mocks/unicorn_mock.rb
249
+ - spec/support/shared_spec.rb
241
250
  - spec/support/static_agent_overrides.rb
242
251
  - tcell_agent.gemspec
243
- homepage: https://www.tcell.io
252
+ homepage: https://www.rapid7.com/tcell
244
253
  licenses:
245
- - Copyright (c) 2017 tCell.io (see LICENSE file)
254
+ - Copyright (c) 2020 Rapid7, Inc. (see LICENSE file)
246
255
  metadata: {}
247
256
  post_install_message:
248
257
  rdoc_options: []
@@ -261,14 +270,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
270
  - !ruby/object:Gem::Version
262
271
  version: '0'
263
272
  requirements: []
264
- rubygems_version: 3.0.3
273
+ rubygems_version: 3.2.15
265
274
  signing_key:
266
275
  specification_version: 4
267
- summary: tCell.io Agent for Rails
276
+ summary: tCell Agent for Rails
268
277
  test_files:
269
- - spec/lib/tcell_agent/config/unknown_options_spec.rb
278
+ - spec/cruby_spec_helper.rb
270
279
  - spec/lib/tcell_agent/configuration_spec.rb
271
280
  - spec/lib/tcell_agent/hooks/login_fraud_spec.rb
281
+ - spec/lib/tcell_agent/instrument_servers_spec.rb
272
282
  - spec/lib/tcell_agent/instrumentation/cmdi/io_cmdi_spec.rb
273
283
  - spec/lib/tcell_agent/instrumentation/cmdi/kernel_cmdi_spec.rb
274
284
  - spec/lib/tcell_agent/instrumentation/cmdi_spec.rb
@@ -300,6 +310,7 @@ test_files:
300
310
  - spec/lib/tcell_agent/rails/routes/route_id_spec.rb
301
311
  - spec/lib/tcell_agent/rails/routes/routes_spec.rb
302
312
  - spec/lib/tcell_agent/rails_spec.rb
313
+ - spec/lib/tcell_agent/rust/agent_config_spec.rb
303
314
  - spec/lib/tcell_agent/sensor_events/dlp_spec.rb
304
315
  - spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb
305
316
  - spec/lib/tcell_agent/settings_reporter_spec.rb
@@ -312,4 +323,10 @@ test_files:
312
323
  - spec/support/middleware_helper.rb
313
324
  - spec/support/resources/lfi_sample_file.txt
314
325
  - spec/support/resources/normal_config.json
326
+ - spec/support/server_mocks/passenger_mock.rb
327
+ - spec/support/server_mocks/puma_mock.rb
328
+ - spec/support/server_mocks/rails_mock.rb
329
+ - spec/support/server_mocks/thin_mock.rb
330
+ - spec/support/server_mocks/unicorn_mock.rb
331
+ - spec/support/shared_spec.rb
315
332
  - spec/support/static_agent_overrides.rb
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- RSpec::Core::RakeTask.new(:spec)
4
-
5
- desc 'Run tests'
6
- task :default => [:spec]
7
- task :test => :spec
8
-
9
- task 'init-integration-tests' do
10
- system('docker-compose run railsintegration224 bundle install')
11
- system('docker-compose run railsintegration224 bundle exec rake db:create db:setup')
12
- system('docker-compose stop')
13
- end
14
-
15
- task 'integration-test' do
16
- system('docker-compose up railsintegration224')
17
- system('docker-compose stop')
18
- end
@@ -1,23 +0,0 @@
1
- if TCellAgent.configuration.should_instrument_authlogic? && defined?(Authlogic)
2
-
3
- require 'tcell_agent/userinfo'
4
-
5
- module TCellAgent
6
- TCellAgent::UserInformation.class_eval do
7
- class << self
8
- alias_method :original_get_user_from_request, :get_user_from_request
9
- def get_user_from_request(request)
10
- orig_user_id = original_get_user_from_request(request)
11
- begin
12
- if request.session && request.session.key?('user_credentials_id')
13
- return request.session['user_credentials_id'].to_s
14
- end
15
- rescue StandardError
16
- return orig_user_id
17
- end
18
- orig_user_id
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,119 +0,0 @@
1
- require 'set'
2
-
3
- module TCellAgent
4
- module Config
5
- module Validate
6
- def self.get_unknown_options(config_json)
7
- messages = []
8
-
9
- known_tcell_env_vars = Set.new(
10
- [
11
- 'TCELL_AGENT_SERVER', # this is only meant for specs
12
- 'TCELL_AGENT_APP_ID',
13
- 'TCELL_AGENT_API_KEY',
14
- 'TCELL_HMAC_KEY',
15
- 'TCELL_PASSWORD_HMAC_KEY',
16
- 'TCELL_AGENT_HOST_IDENTIFIER',
17
- 'TCELL_API_URL',
18
- 'TCELL_INPUT_URL',
19
- 'TCELL_DEMOMODE',
20
- 'TCELL_AGENT_HOME',
21
- 'TCELL_AGENT_LOG_DIR',
22
- 'TCELL_AGENT_CONFIG',
23
- 'TCELL_AGENT_ALLOW_PAYLOADS',
24
- 'TCELL_AGENT_LOG_LEVEL',
25
- 'TCELL_AGENT_LOG_FILENAME',
26
- 'TCELL_AGENT_LOG_ENABLED'
27
- ]
28
- )
29
-
30
- ENV.keys.each do |environment_key|
31
- if environment_key =~ /^TCELL_/ && !known_tcell_env_vars.include?(environment_key)
32
- messages << "Unrecognized environment parameter (TCELL_*) found: #{environment_key}"
33
- end
34
- end
35
-
36
- begin
37
- key_differences = []
38
-
39
- if config_json
40
- first_level_keys = %w[version applications]
41
-
42
- key_differences = config_json.keys - first_level_keys
43
-
44
- applications = config_json.fetch('applications', nil)
45
- if applications
46
-
47
- if applications.size > 1
48
- messages << 'Multiple applications detected in config file'
49
-
50
- elsif applications.size == 1
51
- application = applications[0]
52
-
53
- second_level_keys = %w[
54
- name
55
- app_id
56
- api_key
57
- fetch_policies_from_tcell
58
- preload_policy_filename
59
- log_dir
60
- tcell_api_url
61
- tcell_input_url
62
- host_identifier
63
- hipaaSafeMode
64
- hmac_key
65
- password_hmac_key
66
- js_agent_api_base_url
67
- js_agent_url
68
- max_csp_header_bytes
69
- event_batch_size_limit
70
- allow_payloads
71
- reverse_proxy
72
- reverse_proxy_ip_address_header
73
- demomode
74
- logging_options
75
- data_exposure
76
- disable_all
77
- enabled
78
- enable_event_manager
79
- enable_policy_polling
80
- enable_instrumentation
81
- enable_intercept_requests
82
- instrument_for_events
83
- enabled_instrumentations
84
- stdout_logger
85
- ]
86
-
87
- key_differences += (application.keys - second_level_keys)
88
-
89
- if application.fetch('logging_options', nil)
90
- logging_options = application['logging_options']
91
- key_differences += (logging_options.keys - %w[enabled level filename])
92
- end
93
-
94
- if application.fetch('data_exposure', nil)
95
- data_exposure = application['data_exposure']
96
- key_differences += (data_exposure.keys - ['max_data_ex_db_records_per_request'])
97
- end
98
-
99
- if application.fetch('enabled_instrumentations', nil)
100
- enabled_instrumentations = application['enabled_instrumentations']
101
- key_differences += (enabled_instrumentations.keys - %w[doorkeeper devise authlogic])
102
- end
103
- end
104
- end
105
-
106
- key_differences.each do |key|
107
- messages << "Unrecognized config setting key: #{key}"
108
- end
109
-
110
- end
111
- rescue StandardError => exception
112
- messages << "Something went wrong verifying config file: #{exception}"
113
- end
114
-
115
- messages
116
- end
117
- end
118
- end
119
- end