tcell_agent 2.0.0 → 2.2.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.
- checksums.yaml +4 -4
- data/bin/tcell_agent +42 -146
- data/lib/tcell_agent.rb +8 -16
- data/lib/tcell_agent/agent.rb +76 -46
- data/lib/tcell_agent/config_initializer.rb +66 -0
- data/lib/tcell_agent/configuration.rb +72 -267
- data/lib/tcell_agent/instrument_servers.rb +14 -18
- data/lib/tcell_agent/instrumentation/cmdi.rb +15 -15
- data/lib/tcell_agent/instrumentation/lfi.rb +21 -10
- data/lib/tcell_agent/instrumentation/monkey_patches/io.rb +20 -12
- data/lib/tcell_agent/instrumentation/monkey_patches/kernel.rb +45 -102
- data/lib/tcell_agent/logger.rb +1 -2
- data/lib/tcell_agent/policies/command_injection_policy.rb +1 -1
- 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 -58
- data/lib/tcell_agent/{userinfo.rb → rails/auth/userinfo.rb} +0 -0
- data/lib/tcell_agent/rails/csrf_exception.rb +0 -8
- data/lib/tcell_agent/rails/dlp.rb +10 -8
- data/lib/tcell_agent/rails/middleware/global_middleware.rb +4 -1
- 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 +6 -9
- data/lib/tcell_agent/rails/routes/grape.rb +4 -12
- data/lib/tcell_agent/rails/tcell_body_proxy.rb +0 -1
- data/lib/tcell_agent/rust/agent_config.rb +43 -32
- data/lib/tcell_agent/rust/{libtcellagent-4.14.0.dylib → libtcellagent-5.0.2.dylib} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-4.14.0.so → libtcellagent-5.0.2.so} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-alpine-4.14.0.so → libtcellagent-alpine-5.0.2.so} +0 -0
- data/lib/tcell_agent/rust/models.rb +9 -0
- data/lib/tcell_agent/rust/native_agent.rb +18 -0
- data/lib/tcell_agent/rust/native_library.rb +2 -1
- data/lib/tcell_agent/rust/{tcellagent-4.14.0.dll → tcellagent-5.0.2.dll} +0 -0
- data/lib/tcell_agent/servers/puma.rb +7 -7
- data/lib/tcell_agent/servers/rack_puma_handler.rb +23 -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 +0 -1
- data/lib/tcell_agent/settings_reporter.rb +0 -79
- data/lib/tcell_agent/tcell_context.rb +1 -1
- data/lib/tcell_agent/version.rb +1 -1
- 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/{cmdi_spec.rb → instrumentation/cmdi_spec.rb} +50 -0
- data/spec/lib/tcell_agent/instrumentation/lfi/io_lfi_spec.rb +6 -0
- data/spec/lib/tcell_agent/instrumentation/lfi/kernel_lfi_spec.rb +19 -4
- data/spec/lib/tcell_agent/instrumentation/lfi_spec.rb +47 -2
- data/spec/lib/tcell_agent/rust/agent_config_spec.rb +27 -0
- data/spec/lib/tcell_agent/settings_reporter_spec.rb +0 -73
- data/spec/spec_helper.rb +6 -0
- data/spec/support/builders.rb +6 -6
- data/spec/support/server_mocks/passenger_mock.rb +7 -0
- data/spec/support/server_mocks/puma_mock.rb +17 -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
- metadata +29 -16
- 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/rails/start_agent_after_initializers.rb +0 -12
- data/spec/lib/tcell_agent/config/unknown_options_spec.rb +0 -195
@@ -147,5 +147,55 @@ module TCellAgent
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
end
|
150
|
+
describe '.parse_command_from_open' do
|
151
|
+
context 'with empty parameters' do
|
152
|
+
it 'should not return a command' do
|
153
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open
|
154
|
+
expect(cmd).to eq('')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
context 'with empty array' do
|
158
|
+
it 'should not return a command' do
|
159
|
+
args = []
|
160
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open(*args)
|
161
|
+
expect(cmd).to eq('')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
context 'with a string command' do
|
165
|
+
context 'with an empty string' do
|
166
|
+
it 'should return an empty string' do
|
167
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open('')
|
168
|
+
expect(cmd).to eq('')
|
169
|
+
end
|
170
|
+
end
|
171
|
+
context 'with an empty command' do
|
172
|
+
it 'should return an empty string' do
|
173
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open('|')
|
174
|
+
expect(cmd).to eq('')
|
175
|
+
end
|
176
|
+
end
|
177
|
+
context 'with a non-empty command' do
|
178
|
+
it 'should parse the command properly' do
|
179
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open('|echo')
|
180
|
+
expect(cmd).to eq('echo')
|
181
|
+
|
182
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open('|ls -l /tmp')
|
183
|
+
expect(cmd).to eq('ls -l /tmp')
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
context 'with a filename argument' do
|
188
|
+
it 'should not return a command' do
|
189
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open('/tmp')
|
190
|
+
expect(cmd).to eq('')
|
191
|
+
end
|
192
|
+
end
|
193
|
+
context 'with a non-string first argument' do
|
194
|
+
it 'should return an empty string' do
|
195
|
+
cmd = TCellAgent::Cmdi.parse_command_from_open({})
|
196
|
+
expect(cmd).to eq('')
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
150
200
|
end
|
151
201
|
end
|
@@ -42,6 +42,7 @@ describe 'IO' do
|
|
42
42
|
TCellAgent::PolicyTypes::LFI
|
43
43
|
).and_return(@local_files_policy)
|
44
44
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(false)
|
45
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
@@ -75,6 +76,7 @@ describe 'IO' do
|
|
75
76
|
TCellAgent::PolicyTypes::LFI
|
76
77
|
).and_return(@local_files_policy)
|
77
78
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(true)
|
79
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -254,6 +256,7 @@ describe 'IO' do
|
|
254
256
|
).and_return(@local_files_policy)
|
255
257
|
|
256
258
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(false)
|
259
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
257
260
|
end
|
258
261
|
end
|
259
262
|
|
@@ -288,6 +291,7 @@ describe 'IO' do
|
|
288
291
|
).and_return(@local_files_policy)
|
289
292
|
|
290
293
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(true)
|
294
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
291
295
|
end
|
292
296
|
end
|
293
297
|
|
@@ -338,6 +342,7 @@ describe 'IO' do
|
|
338
342
|
).and_return(@local_files_policy)
|
339
343
|
|
340
344
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(false)
|
345
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
341
346
|
end
|
342
347
|
end
|
343
348
|
|
@@ -366,6 +371,7 @@ describe 'IO' do
|
|
366
371
|
).and_return(@local_files_policy)
|
367
372
|
|
368
373
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(true)
|
374
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
369
375
|
end
|
370
376
|
end
|
371
377
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# rubocop:disable Lint/UselessAssignment
|
3
3
|
require 'spec_helper'
|
4
4
|
require 'securerandom'
|
5
|
+
require 'pathname'
|
5
6
|
|
6
7
|
describe 'Kernel' do
|
7
8
|
before do
|
@@ -15,6 +16,7 @@ describe 'Kernel' do
|
|
15
16
|
|
16
17
|
before(:all) do
|
17
18
|
@new_file_name = '/tmp/' + SecureRandom.uuid
|
19
|
+
@new_pathname = Pathname.new(@new_file_name)
|
18
20
|
end
|
19
21
|
describe '#open and ::open' do
|
20
22
|
context 'empty path' do
|
@@ -39,13 +41,14 @@ describe 'Kernel' do
|
|
39
41
|
end.to raise_error(Errno::ENOENT)
|
40
42
|
end
|
41
43
|
end
|
42
|
-
context 'with a filename not blocked for read/write' do
|
44
|
+
context 'with a non-existent file, with filename not blocked for read/write' do
|
43
45
|
before do |test|
|
44
46
|
unless test.metadata[:skip_before]
|
45
47
|
expect(TCellAgent).to receive(:policy).with(
|
46
48
|
TCellAgent::PolicyTypes::LFI
|
47
49
|
).and_return(@local_files_policy, @local_files_policy)
|
48
50
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(false, false)
|
51
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
@@ -56,7 +59,18 @@ describe 'Kernel' do
|
|
56
59
|
result = open('|echo test').read
|
57
60
|
expect(result).to eq "test\n"
|
58
61
|
end
|
59
|
-
context 'with a
|
62
|
+
context 'with a pathname filename with mode w' do
|
63
|
+
it 'should create the file' do
|
64
|
+
Kernel.open(@new_pathname, 'w')
|
65
|
+
expect(File.exist?(@new_pathname)).to be_truthy
|
66
|
+
File.delete(@new_pathname)
|
67
|
+
|
68
|
+
open(@new_pathname, 'w')
|
69
|
+
expect(File.exist?(@new_pathname)).to be_truthy
|
70
|
+
File.delete(@new_pathname)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
context 'with a filename with mode w' do
|
60
74
|
it 'should create the file' do
|
61
75
|
Kernel.open(@new_file_name, 'w')
|
62
76
|
expect(File.exist?(@new_file_name)).to be_truthy
|
@@ -90,13 +104,14 @@ describe 'Kernel' do
|
|
90
104
|
end
|
91
105
|
end
|
92
106
|
end
|
93
|
-
context 'with a filename blocked for read/write' do
|
107
|
+
context 'with a non-existent file, with filename blocked for read/write' do
|
94
108
|
before do |test|
|
95
109
|
unless test.metadata[:skip_before]
|
96
110
|
expect(TCellAgent).to receive(:policy).with(
|
97
111
|
TCellAgent::PolicyTypes::LFI
|
98
112
|
).and_return(@local_files_policy, @local_files_policy)
|
99
113
|
expect(@local_files_policy).to receive(:block_file_access?).and_return(true, true)
|
114
|
+
expect(TCellAgent::Cmdi).not_to receive(:parse_command_from_open)
|
100
115
|
end
|
101
116
|
end
|
102
117
|
|
@@ -107,7 +122,7 @@ describe 'Kernel' do
|
|
107
122
|
result = open('|echo test').read
|
108
123
|
expect(result).to eq "test\n"
|
109
124
|
end
|
110
|
-
context 'with a
|
125
|
+
context 'with a filename with mode w' do
|
111
126
|
it 'should raise an error' do
|
112
127
|
expect do
|
113
128
|
Kernel.open(@new_file_name, 'w')
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
module TCellAgent
|
4
4
|
module Instrumentation
|
5
5
|
module Lfi
|
6
|
-
describe '
|
6
|
+
describe '.extract_path_mode' do
|
7
7
|
context 'with path' do
|
8
8
|
it 'should extract the path correctly' do
|
9
9
|
args = '/path-to-file'
|
@@ -34,51 +34,91 @@ module TCellAgent
|
|
34
34
|
args = '/path-to-file', 'r'
|
35
35
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
36
36
|
expect(mode).to eq('Read')
|
37
|
+
|
38
|
+
args = '/path-to-file', { :mode => 'r' }
|
39
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
40
|
+
expect(mode).to eq('Read')
|
37
41
|
end
|
38
42
|
it 'should return Write for mode w' do
|
39
43
|
args = '/path-to-file', 'w'
|
40
44
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
41
45
|
expect(mode).to eq('Write')
|
46
|
+
|
47
|
+
args = '/path-to-file', { :mode => 'w' }
|
48
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
49
|
+
expect(mode).to eq('Write')
|
42
50
|
end
|
43
51
|
it 'should return Write for mode a' do
|
44
52
|
args = '/path-to-file', 'a'
|
45
53
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
46
54
|
expect(mode).to eq('Write')
|
55
|
+
|
56
|
+
args = '/path-to-file', { :mode => 'a' }
|
57
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
58
|
+
expect(mode).to eq('Write')
|
47
59
|
end
|
48
60
|
it 'should return ReadWrite for mode r+' do
|
49
61
|
args = '/path-to-file', 'r+'
|
50
62
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
51
63
|
expect(mode).to eq('ReadWrite')
|
64
|
+
|
65
|
+
args = '/path-to-file', { :mode => 'r+' }
|
66
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
67
|
+
expect(mode).to eq('ReadWrite')
|
52
68
|
end
|
53
69
|
it 'should return ReadWrite for mode w+' do
|
54
70
|
args = '/path-to-file', 'w+'
|
55
71
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
56
72
|
expect(mode).to eq('ReadWrite')
|
73
|
+
|
74
|
+
args = '/path-to-file', { :mode => 'w+' }
|
75
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
76
|
+
expect(mode).to eq('ReadWrite')
|
57
77
|
end
|
58
78
|
it 'should return ReadWrite for mode a+' do
|
59
79
|
args = '/path-to-file', 'a+'
|
60
80
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
61
81
|
expect(mode).to eq('ReadWrite')
|
82
|
+
|
83
|
+
args = '/path-to-file', { :mode => 'a+' }
|
84
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
85
|
+
expect(mode).to eq('ReadWrite')
|
62
86
|
end
|
63
87
|
it 'should return Read for mode ::File::RDONLY (0)' do
|
64
88
|
args = '/path-to-file', ::File::RDONLY
|
65
89
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
66
90
|
expect(mode).to eq('Read')
|
91
|
+
|
92
|
+
args = '/path-to-file', { :mode => ::File::RDONLY }
|
93
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
94
|
+
expect(mode).to eq('Read')
|
67
95
|
end
|
68
96
|
it 'should return Write for mode ::File::WRONLY (1)' do
|
69
97
|
args = '/path-to-file', ::File::WRONLY
|
70
98
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
71
99
|
expect(mode).to eq('Write')
|
100
|
+
|
101
|
+
args = '/path-to-file', { :mode => ::File::WRONLY }
|
102
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
103
|
+
expect(mode).to eq('Write')
|
72
104
|
end
|
73
105
|
it 'should return ReadWrite for mode ::File::RDWR (2)' do
|
74
106
|
args = '/path-to-file', ::File::RDWR
|
75
107
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
76
108
|
expect(mode).to eq('ReadWrite')
|
109
|
+
|
110
|
+
args = '/path-to-file', { :mode => ::File::RDWR }
|
111
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
112
|
+
expect(mode).to eq('ReadWrite')
|
77
113
|
end
|
78
114
|
it 'should return Write for mode ::File::CREAT | ::File::EXCL | ::File::WRONLY (2561)' do
|
79
115
|
args = '/path-to-file', ::File::CREAT | ::File::EXCL | ::File::WRONLY
|
80
116
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
81
117
|
expect(mode).to eq('Write')
|
118
|
+
|
119
|
+
args = '/path-to-file', { :mode => ::File::CREAT | ::File::EXCL | ::File::WRONLY }
|
120
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
121
|
+
expect(mode).to eq('Write')
|
82
122
|
end
|
83
123
|
end
|
84
124
|
context 'with an invalid mode' do
|
@@ -87,11 +127,16 @@ module TCellAgent
|
|
87
127
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
88
128
|
expect(mode).to eq('Read')
|
89
129
|
end
|
90
|
-
it 'should return Read when mode is
|
130
|
+
it 'should return Read when mode is an empty hash' do
|
91
131
|
args = '/path-to-file', {}
|
92
132
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
93
133
|
expect(mode).to eq('Read')
|
94
134
|
end
|
135
|
+
it 'should return Read when mode is a hash without a :mode key' do
|
136
|
+
args = '/path-to-file', { :placeholder => 'testing' }
|
137
|
+
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
138
|
+
expect(mode).to eq('Read')
|
139
|
+
end
|
95
140
|
it 'should return Read when mode is an array' do
|
96
141
|
args = '/path-to-file', []
|
97
142
|
_path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TCellAgent
|
4
|
+
module Rust
|
5
|
+
describe AgentConfig do
|
6
|
+
context 'with initializers set' do
|
7
|
+
before do
|
8
|
+
TCellAgent.configure do |config|
|
9
|
+
config.app_id = 'initializer_app_id_set'
|
10
|
+
config.api_key = 'initializer_api_key_set'
|
11
|
+
config.enabled_instrumentations = { 'authlogic' => false, :devise => false, 'doorkeeper' => false }
|
12
|
+
config.hmac_key = config.app_id
|
13
|
+
end
|
14
|
+
end
|
15
|
+
it 'should return the correct values' do
|
16
|
+
config = AgentConfig.new(TCellAgent.initializer_configuration)
|
17
|
+
|
18
|
+
expect(config['agent_type']).to eq 'Ruby'
|
19
|
+
expect(config['overrides']['disabled_instrumentation']).to contain_exactly('authlogic', 'devise', 'doorkeeper')
|
20
|
+
expect(config['overrides']['applications'][0][:api_key]).to eq 'initializer_api_key_set'
|
21
|
+
expect(config['overrides']['applications'][0][:app_id]).to eq 'initializer_app_id_set'
|
22
|
+
expect(config['overrides']['applications'][0][:api_key]).to eq 'initializer_api_key_set'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -14,7 +14,6 @@ module TCellAgent
|
|
14
14
|
:reverse_proxy => true,
|
15
15
|
:reverse_proxy_ip_address_header => nil,
|
16
16
|
:log_filename => 'log-filename',
|
17
|
-
:config_filename => 'config-filename',
|
18
17
|
:agent_log_dir => 'agent-log-dir',
|
19
18
|
:agent_home_dir => 'agent-home-dir',
|
20
19
|
:agent_home_owner => nil,
|
@@ -57,78 +56,6 @@ module TCellAgent
|
|
57
56
|
'value' => 'true'
|
58
57
|
}
|
59
58
|
)
|
60
|
-
expect(TCellAgent).to receive(:send_event).with(
|
61
|
-
{
|
62
|
-
'event_type' => 'app_config_setting',
|
63
|
-
'package' => 'tcell',
|
64
|
-
'section' => 'config',
|
65
|
-
'name' => 'allow_payloads',
|
66
|
-
'value' => 'true'
|
67
|
-
}
|
68
|
-
)
|
69
|
-
expect(TCellAgent).to receive(:send_event).with(
|
70
|
-
{
|
71
|
-
'event_type' => 'app_config_setting',
|
72
|
-
'package' => 'tcell',
|
73
|
-
'section' => 'config',
|
74
|
-
'name' => 'reverse_proxy',
|
75
|
-
'value' => 'true'
|
76
|
-
}
|
77
|
-
)
|
78
|
-
expect(TCellAgent).to receive(:send_event).with(
|
79
|
-
{
|
80
|
-
'event_type' => 'app_config_setting',
|
81
|
-
'package' => 'tcell',
|
82
|
-
'section' => 'config',
|
83
|
-
'name' => 'config_filename',
|
84
|
-
'value' => 'config-filename'
|
85
|
-
}
|
86
|
-
)
|
87
|
-
expect(TCellAgent).to receive(:send_event).with(
|
88
|
-
{
|
89
|
-
'event_type' => 'app_config_setting',
|
90
|
-
'package' => 'tcell',
|
91
|
-
'section' => 'config',
|
92
|
-
'name' => 'logging_directory',
|
93
|
-
'value' => 'agent-log-dir'
|
94
|
-
}
|
95
|
-
)
|
96
|
-
expect(TCellAgent).to receive(:send_event).with(
|
97
|
-
{
|
98
|
-
'event_type' => 'app_config_setting',
|
99
|
-
'package' => 'tcell',
|
100
|
-
'section' => 'config',
|
101
|
-
'name' => 'agent_home_directory',
|
102
|
-
'value' => 'agent-home-dir'
|
103
|
-
}
|
104
|
-
)
|
105
|
-
expect(TCellAgent).to receive(:send_event).with(
|
106
|
-
{
|
107
|
-
'event_type' => 'app_config_setting',
|
108
|
-
'package' => 'tcell',
|
109
|
-
'section' => 'config',
|
110
|
-
'name' => 'logging_enabled',
|
111
|
-
'value' => 'true'
|
112
|
-
}
|
113
|
-
)
|
114
|
-
expect(TCellAgent).to receive(:send_event).with(
|
115
|
-
{
|
116
|
-
'event_type' => 'app_config_setting',
|
117
|
-
'package' => 'tcell',
|
118
|
-
'section' => 'config',
|
119
|
-
'name' => 'logging_level',
|
120
|
-
'value' => 'INFO'
|
121
|
-
}
|
122
|
-
)
|
123
|
-
expect(TCellAgent).to receive(:send_event).with(
|
124
|
-
{
|
125
|
-
'event_type' => 'app_config_setting',
|
126
|
-
'package' => 'tcell',
|
127
|
-
'section' => 'config',
|
128
|
-
'name' => 'reverse_proxy_ip_address_header',
|
129
|
-
'value' => ''
|
130
|
-
}
|
131
|
-
)
|
132
59
|
|
133
60
|
TCellAgent.report_settings
|
134
61
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -20,3 +20,9 @@ end
|
|
20
20
|
|
21
21
|
require 'tcell_agent/agent'
|
22
22
|
require 'tcell_agent/rails/routes'
|
23
|
+
|
24
|
+
TCellAgent.configuration.enabled = true
|
25
|
+
TCellAgent.configuration.instrument = true
|
26
|
+
TCellAgent.configuration.enable_intercept_requests = true
|
27
|
+
TCellAgent.configuration.disabled_instrumentation = []
|
28
|
+
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)
|