tcell_agent 2.1.1 → 2.4.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 (111) 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 +47 -15
  12. data/lib/tcell_agent/instrumentation/lfi.rb +68 -11
  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 +5 -12
  44. data/lib/tcell_agent/rails/settings_reporter.rb +0 -8
  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 +52 -32
  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/cmdi_spec.rb +46 -4
  73. data/spec/lib/tcell_agent/instrumentation/lfi/file_lfi_spec.rb +211 -272
  74. data/spec/lib/tcell_agent/instrumentation/lfi/io_lfi_spec.rb +207 -223
  75. data/spec/lib/tcell_agent/instrumentation/lfi/kernel_lfi_spec.rb +89 -70
  76. data/spec/lib/tcell_agent/instrumentation/lfi_spec.rb +120 -2
  77. data/spec/lib/tcell_agent/patches_spec.rb +2 -1
  78. data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +1 -2
  79. data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +5 -6
  80. data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +21 -2
  81. data/spec/lib/tcell_agent/policies/policies_manager_spec.rb +1 -1
  82. data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +14 -8
  83. data/spec/lib/tcell_agent/rails/better_ip_spec.rb +9 -11
  84. data/spec/lib/tcell_agent/rails/csrf_exception_spec.rb +6 -6
  85. data/spec/lib/tcell_agent/rails/dlp_spec.rb +1 -0
  86. data/spec/lib/tcell_agent/rails/js_agent_insert_spec.rb +10 -2
  87. data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +2 -1
  88. data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +4 -4
  89. data/spec/lib/tcell_agent/rust/agent_config_spec.rb +27 -0
  90. data/spec/lib/tcell_agent/settings_reporter_spec.rb +2 -89
  91. data/spec/lib/tcell_agent/tcell_context_spec.rb +6 -5
  92. data/spec/spec_helper.rb +9 -1
  93. data/spec/support/builders.rb +8 -7
  94. data/spec/support/server_mocks/passenger_mock.rb +7 -0
  95. data/spec/support/server_mocks/puma_mock.rb +21 -0
  96. data/spec/support/server_mocks/rails_mock.rb +7 -0
  97. data/spec/support/server_mocks/thin_mock.rb +7 -0
  98. data/spec/support/server_mocks/unicorn_mock.rb +11 -0
  99. data/spec/support/shared_spec.rb +29 -0
  100. data/tcell_agent.gemspec +14 -14
  101. metadata +44 -27
  102. data/Rakefile +0 -18
  103. data/lib/tcell_agent/authlogic.rb +0 -23
  104. data/lib/tcell_agent/config/unknown_options.rb +0 -119
  105. data/lib/tcell_agent/devise.rb +0 -33
  106. data/lib/tcell_agent/instrumentation/monkey_patches/file.rb +0 -25
  107. data/lib/tcell_agent/instrumentation/monkey_patches/io.rb +0 -131
  108. data/lib/tcell_agent/instrumentation/monkey_patches/kernel.rb +0 -163
  109. data/lib/tcell_agent/rails/start_agent_after_initializers.rb +0 -12
  110. data/lib/tcell_agent/rust/tcellagent-4.18.0.dll +0 -0
  111. data/spec/lib/tcell_agent/config/unknown_options_spec.rb +0 -195
@@ -4,9 +4,9 @@ module TCellAgent
4
4
  describe MetaData do
5
5
  describe '#set_headers_dict' do
6
6
  it 'should set all headers that start with http and skip cookies' do
7
- method = remote_address = route_id = session_id = user_id = transaction_id = location = nil
7
+ method = remote_address = route_id = session_id = user_id = transaction_id = location = reverse_proxy_header_value = nil
8
8
 
9
- meta = MetaData.new(method, remote_address, route_id, session_id, user_id, transaction_id, location)
9
+ meta = MetaData.new(method, remote_address, route_id, session_id, user_id, transaction_id, location, reverse_proxy_header_value)
10
10
  meta.headers_dict = {
11
11
  'rack.version' => [1, 2],
12
12
  'REQUEST_METHOD' => 'POST',
@@ -24,9 +24,9 @@ module TCellAgent
24
24
  end
25
25
 
26
26
  it 'should set all headers that start with http and include content_length and content_type' do
27
- method = remote_address = route_id = session_id = user_id = transaction_id = location = nil
27
+ method = remote_address = route_id = session_id = user_id = transaction_id = location = reverse_proxy_header_value = nil
28
28
 
29
- meta = MetaData.new(method, remote_address, route_id, session_id, user_id, transaction_id, location)
29
+ meta = MetaData.new(method, remote_address, route_id, session_id, user_id, transaction_id, location, reverse_proxy_header_value)
30
30
  meta.headers_dict = {
31
31
  'REQUEST_METHOD' => 'POST',
32
32
  'HTTP_VERSION' => 'HTTP/1.1',
@@ -71,7 +71,8 @@ module TCellAgent
71
71
  'session_id',
72
72
  'user_id',
73
73
  'transaction_id',
74
- 'http://test.com'
74
+ 'http://test.com',
75
+ '0.0.0.0'
75
76
  )
76
77
  end
77
78
 
data/spec/spec_helper.rb CHANGED
@@ -12,11 +12,19 @@ end
12
12
  ENV['TCELL_AGENT_SERVER'] = 'mock'
13
13
  require File.join(File.dirname(__FILE__), '..', 'lib', 'tcell_agent')
14
14
 
15
- Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each { |f| require f }
15
+ Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].sort.each { |f| require f }
16
16
 
17
17
  def get_test_resource_path(name)
18
18
  File.join(File.dirname(__FILE__), 'support', 'resources', name)
19
19
  end
20
20
 
21
+ NEW_FILE_NAME ||= "/tmp/#{SecureRandom.uuid}".freeze
22
+
21
23
  require 'tcell_agent/agent'
22
24
  require 'tcell_agent/rails/routes'
25
+
26
+ TCellAgent.configuration.enabled = true
27
+ TCellAgent.configuration.instrument = true
28
+ TCellAgent.configuration.enable_intercept_requests = true
29
+ TCellAgent.configuration.disabled_instrumentation = []
30
+ TCellAgent.thread_agent.instrument_built_ins
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
+ require 'tcell_agent/config_initializer'
3
+
2
4
  module TCellAgent
3
5
  module Tests
4
6
  class ConfigurationBuilder
5
7
  def initialize
6
- @configuration = TCellAgent::Configuration.new
7
- @configuration.config_filename = 'tcell_agent.config'
8
- @configuration.demomode = false
9
- @configuration.enable_event_manager = false
8
+ @configuration = TCellAgent::ConfigInitializer.new
10
9
  @configuration.fetch_policies_from_tcell = false
11
10
  @configuration.max_csp_header_bytes = nil
12
11
  @configuration.app_id = 'TestAppId-AppId'
@@ -18,11 +17,12 @@ module TCellAgent
18
17
  @configuration.allow_payloads = true
19
18
  @configuration.js_agent_api_base_url = @configuration.tcell_api_url
20
19
  @configuration.js_agent_url = 'https://jsagent.tcell.io/tcellagent.min.js'
21
- @configuration.cache_folder = nil
22
20
  @configuration.agent_log_dir = 'tcell/logs'
23
- @configuration.logging_options = { 'enabled' => false }
21
+ @configuration.logging_options = { :enabled => false }
24
22
  @configuration.host_identifier = 'python-test-suite'
25
23
  @configuration.reverse_proxy_ip_address_header = 'X-Forwarded-For'
24
+ @configuration.enable_intercept_requests = true
25
+ @configuration.enabled = true
26
26
  end
27
27
 
28
28
  def update_attribute(attribute, setting)
@@ -73,7 +73,8 @@ module TCellAgent
73
73
  'session-id',
74
74
  'user-id',
75
75
  SecureRandom.uuid,
76
- 'http://domain.com/some/path?hide-my-value=sensitive'
76
+ 'http://domain.com/some/path?hide-my-value=sensitive',
77
+ '0.0.0.0'
77
78
  )
78
79
 
79
80
  @meta_data.path = '/some/path'
@@ -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.1
4
+ version: 2.4.0
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-05-26 00:00:00.000000000 Z
11
+ date: 2021-06-29 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