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.
- checksums.yaml +4 -4
- data/LICENSE +2 -2
- data/bin/tcell_agent +41 -150
- data/lib/tcell_agent.rb +8 -16
- data/lib/tcell_agent/agent.rb +87 -52
- data/lib/tcell_agent/config_initializer.rb +62 -0
- data/lib/tcell_agent/configuration.rb +72 -267
- data/lib/tcell_agent/hooks/login_fraud.rb +1 -1
- data/lib/tcell_agent/instrument_servers.rb +14 -18
- data/lib/tcell_agent/instrumentation.rb +14 -6
- data/lib/tcell_agent/instrumentation/cmdi.rb +47 -15
- data/lib/tcell_agent/instrumentation/lfi.rb +68 -11
- data/lib/tcell_agent/instrumentation/monkey_patches/ruby_2/file.rb +21 -0
- data/lib/tcell_agent/instrumentation/monkey_patches/ruby_2/io.rb +75 -0
- data/lib/tcell_agent/instrumentation/monkey_patches/ruby_2/kernel.rb +80 -0
- data/lib/tcell_agent/instrumentation/monkey_patches/ruby_3/file.rb +21 -0
- data/lib/tcell_agent/instrumentation/monkey_patches/ruby_3/io.rb +75 -0
- data/lib/tcell_agent/instrumentation/monkey_patches/ruby_3/kernel.rb +80 -0
- data/lib/tcell_agent/logger.rb +3 -4
- data/lib/tcell_agent/policies/dataloss_policy.rb +15 -8
- data/lib/tcell_agent/policies/headers_policy.rb +2 -2
- data/lib/tcell_agent/policies/patches_policy.rb +8 -4
- data/lib/tcell_agent/policies/policies_manager.rb +1 -0
- data/lib/tcell_agent/policies/policy_polling.rb +4 -3
- data/lib/tcell_agent/rails/auth/authlogic.rb +49 -44
- data/lib/tcell_agent/rails/auth/authlogic_helper.rb +20 -0
- data/lib/tcell_agent/rails/auth/devise.rb +103 -102
- data/lib/tcell_agent/rails/auth/devise_helper.rb +29 -0
- data/lib/tcell_agent/rails/auth/doorkeeper.rb +54 -57
- data/lib/tcell_agent/{userinfo.rb → rails/auth/userinfo.rb} +0 -0
- data/lib/tcell_agent/rails/better_ip.rb +7 -19
- data/lib/tcell_agent/rails/csrf_exception.rb +0 -8
- data/lib/tcell_agent/rails/dlp.rb +48 -52
- data/lib/tcell_agent/rails/dlp/process_request.rb +5 -0
- data/lib/tcell_agent/rails/dlp_handler.rb +9 -10
- data/lib/tcell_agent/rails/js_agent_insert.rb +2 -3
- data/lib/tcell_agent/rails/middleware/context_middleware.rb +2 -1
- data/lib/tcell_agent/rails/middleware/global_middleware.rb +3 -4
- data/lib/tcell_agent/rails/middleware/headers_middleware.rb +1 -0
- data/lib/tcell_agent/rails/{on_start.rb → railties/tcell_agent_railties.rb} +9 -16
- data/lib/tcell_agent/rails/railties/tcell_agent_unicorn_railties.rb +8 -0
- data/lib/tcell_agent/rails/routes.rb +3 -6
- data/lib/tcell_agent/rails/routes/grape.rb +5 -12
- data/lib/tcell_agent/rails/settings_reporter.rb +0 -8
- data/lib/tcell_agent/rails/tcell_body_proxy.rb +4 -7
- data/lib/tcell_agent/routes/table.rb +3 -0
- data/lib/tcell_agent/rust/agent_config.rb +52 -32
- data/lib/tcell_agent/rust/{libtcellagent-4.18.0.so → libtcellagent-alpine.so} +0 -0
- data/lib/tcell_agent/rust/libtcellagent-x64.dll +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-4.18.0.dylib → libtcellagent.dylib} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-alpine-4.18.0.so → libtcellagent.so} +0 -0
- data/lib/tcell_agent/rust/models.rb +9 -0
- data/lib/tcell_agent/rust/native_agent.rb +58 -50
- data/lib/tcell_agent/rust/native_library.rb +8 -10
- data/lib/tcell_agent/sensor_events/server_agent.rb +3 -100
- data/lib/tcell_agent/sensor_events/util/sanitizer_utilities.rb +1 -0
- data/lib/tcell_agent/servers/puma.rb +30 -13
- data/lib/tcell_agent/servers/rack_puma_handler.rb +33 -0
- data/lib/tcell_agent/servers/rails_server.rb +4 -4
- data/lib/tcell_agent/servers/unicorn.rb +1 -1
- data/lib/tcell_agent/servers/webrick.rb +12 -3
- data/lib/tcell_agent/settings_reporter.rb +0 -93
- data/lib/tcell_agent/sinatra.rb +1 -0
- data/lib/tcell_agent/tcell_context.rb +16 -7
- data/lib/tcell_agent/utils/headers.rb +0 -1
- data/lib/tcell_agent/utils/strings.rb +2 -2
- data/lib/tcell_agent/version.rb +1 -1
- data/spec/cruby_spec_helper.rb +26 -0
- data/spec/lib/tcell_agent/configuration_spec.rb +62 -212
- data/spec/lib/tcell_agent/instrument_servers_spec.rb +95 -0
- data/spec/lib/tcell_agent/instrumentation/cmdi/io_cmdi_spec.rb +2 -2
- data/spec/lib/tcell_agent/instrumentation/cmdi_spec.rb +46 -4
- data/spec/lib/tcell_agent/instrumentation/lfi/file_lfi_spec.rb +211 -272
- data/spec/lib/tcell_agent/instrumentation/lfi/io_lfi_spec.rb +207 -223
- data/spec/lib/tcell_agent/instrumentation/lfi/kernel_lfi_spec.rb +89 -70
- data/spec/lib/tcell_agent/instrumentation/lfi_spec.rb +120 -2
- data/spec/lib/tcell_agent/patches_spec.rb +2 -1
- data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +1 -2
- data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +5 -6
- data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +21 -2
- data/spec/lib/tcell_agent/policies/policies_manager_spec.rb +1 -1
- data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +14 -8
- data/spec/lib/tcell_agent/rails/better_ip_spec.rb +9 -11
- data/spec/lib/tcell_agent/rails/csrf_exception_spec.rb +6 -6
- data/spec/lib/tcell_agent/rails/dlp_spec.rb +1 -0
- data/spec/lib/tcell_agent/rails/js_agent_insert_spec.rb +10 -2
- data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +2 -1
- data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +4 -4
- data/spec/lib/tcell_agent/rust/agent_config_spec.rb +27 -0
- data/spec/lib/tcell_agent/settings_reporter_spec.rb +2 -89
- data/spec/lib/tcell_agent/tcell_context_spec.rb +6 -5
- data/spec/spec_helper.rb +9 -1
- data/spec/support/builders.rb +8 -7
- data/spec/support/server_mocks/passenger_mock.rb +7 -0
- data/spec/support/server_mocks/puma_mock.rb +21 -0
- data/spec/support/server_mocks/rails_mock.rb +7 -0
- data/spec/support/server_mocks/thin_mock.rb +7 -0
- data/spec/support/server_mocks/unicorn_mock.rb +11 -0
- data/spec/support/shared_spec.rb +29 -0
- data/tcell_agent.gemspec +14 -14
- metadata +44 -27
- data/Rakefile +0 -18
- data/lib/tcell_agent/authlogic.rb +0 -23
- data/lib/tcell_agent/config/unknown_options.rb +0 -119
- data/lib/tcell_agent/devise.rb +0 -33
- data/lib/tcell_agent/instrumentation/monkey_patches/file.rb +0 -25
- data/lib/tcell_agent/instrumentation/monkey_patches/io.rb +0 -131
- data/lib/tcell_agent/instrumentation/monkey_patches/kernel.rb +0 -163
- data/lib/tcell_agent/rails/start_agent_after_initializers.rb +0 -12
- data/lib/tcell_agent/rust/tcellagent-4.18.0.dll +0 -0
- 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
|
data/spec/support/builders.rb
CHANGED
|
@@ -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::
|
|
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 = {
|
|
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,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,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 =
|
|
10
|
-
spec.
|
|
11
|
-
spec.
|
|
12
|
-
spec.
|
|
13
|
-
spec.
|
|
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
|
-
'
|
|
16
|
+
'README.md',
|
|
17
|
+
'LICENSE',
|
|
18
|
+
'tcell_agent.gemspec',
|
|
19
|
+
'spec/**/*',
|
|
18
20
|
'lib/tcell_agent.rb',
|
|
19
|
-
'
|
|
20
|
-
'lib/tcell_agent/rust/libtcellagent
|
|
21
|
-
'lib/tcell_agent/rust/libtcellagent
|
|
22
|
-
'lib/tcell_agent/rust/
|
|
23
|
-
'
|
|
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.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Rapid7, Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
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
|
|
98
|
-
|
|
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/
|
|
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/
|
|
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-
|
|
166
|
-
- lib/tcell_agent/rust/libtcellagent-
|
|
167
|
-
- lib/tcell_agent/rust/libtcellagent
|
|
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/
|
|
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
|
|
252
|
+
homepage: https://www.rapid7.com/tcell
|
|
244
253
|
licenses:
|
|
245
|
-
- Copyright (c)
|
|
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.
|
|
273
|
+
rubygems_version: 3.2.15
|
|
265
274
|
signing_key:
|
|
266
275
|
specification_version: 4
|
|
267
|
-
summary: tCell
|
|
276
|
+
summary: tCell Agent for Rails
|
|
268
277
|
test_files:
|
|
269
|
-
- spec/
|
|
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
|