tcell_agent 0.2.29.rc2 → 0.2.29
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 +16 -4
- data/lib/tcell_agent/agent/event_processor.rb +2 -8
- data/lib/tcell_agent/agent/fork_pipe_manager.rb +0 -2
- data/lib/tcell_agent/agent/policy_manager.rb +12 -18
- data/lib/tcell_agent/api.rb +50 -27
- data/lib/tcell_agent/appsensor/injections_reporter.rb +7 -5
- data/lib/tcell_agent/appsensor/sensor.rb +8 -4
- data/lib/tcell_agent/config/unknown_options.rb +116 -0
- data/lib/tcell_agent/configuration.rb +17 -20
- data/lib/tcell_agent/instrumentation.rb +0 -1
- data/lib/tcell_agent/logger.rb +17 -21
- data/lib/tcell_agent/patches/block_rule.rb +43 -8
- data/lib/tcell_agent/patches/meta_data.rb +2 -1
- data/lib/tcell_agent/patches/sensors_matcher.rb +2 -1
- data/lib/tcell_agent/policies/appsensor/database_sensor.rb +5 -2
- data/lib/tcell_agent/policies/appsensor/misc_sensor.rb +10 -3
- data/lib/tcell_agent/policies/appsensor/payloads_policy.rb +8 -3
- data/lib/tcell_agent/policies/appsensor/request_size_sensor.rb +1 -1
- data/lib/tcell_agent/policies/appsensor/response_codes_sensor.rb +7 -2
- data/lib/tcell_agent/policies/appsensor/size_sensor.rb +7 -3
- data/lib/tcell_agent/policies/appsensor/sqli_sensor.rb +3 -5
- data/lib/tcell_agent/policies/appsensor/user_agent_sensor.rb +6 -2
- data/lib/tcell_agent/policies/appsensor/xss_sensor.rb +3 -5
- data/lib/tcell_agent/policies/appsensor_policy.rb +11 -6
- data/lib/tcell_agent/policies/content_security_policy.rb +19 -14
- data/lib/tcell_agent/rails/dlp.rb +1 -1
- data/lib/tcell_agent/rails/middleware/headers_middleware.rb +10 -7
- data/lib/tcell_agent/rails/on_start.rb +0 -1
- data/lib/tcell_agent/sensor_events/appsensor_event.rb +7 -5
- data/lib/tcell_agent/sinatra.rb +3 -6
- data/lib/tcell_agent/start_background_thread.rb +0 -7
- data/lib/tcell_agent/utils/strings.rb +18 -0
- data/lib/tcell_agent/version.rb +1 -1
- data/spec/lib/tcell_agent/api/api_spec.rb +1 -1
- data/spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb +1 -1
- data/spec/lib/tcell_agent/config/unknown_options_spec.rb +188 -0
- data/spec/lib/tcell_agent/configuration_spec.rb +56 -0
- data/spec/lib/tcell_agent/patches/block_rule_spec.rb +110 -16
- data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_log_spec.rb +226 -293
- data/spec/lib/tcell_agent/policies/appsensor/response_codes_sensor_spec.rb +32 -4
- data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +11 -0
- data/spec/lib/tcell_agent/utils/strings_spec.rb +50 -0
- data/spec/support/static_agent_overrides.rb +1 -1
- data/tcell_agent.gemspec +1 -3
- metadata +9 -37
- data/lib/tcell_agent/rails/tracing.rb +0 -22
- data/spec/integration/puma.rb +0 -195
@@ -158,6 +158,34 @@ module TCellAgent
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
+
context "with enabled series_400_enabled and full uri" do
|
162
|
+
context "with 400 response code" do
|
163
|
+
before(:each) do
|
164
|
+
@sensor = ResponseCodesSensor.new({
|
165
|
+
"enabled" => true,
|
166
|
+
"series_400_enabled" => true,
|
167
|
+
"collect_full_uri" => true
|
168
|
+
})
|
169
|
+
@meta = TCellAgent::SensorEvents::AppSensorMetaEvent.new
|
170
|
+
@meta.remote_address = "remote_address"
|
171
|
+
@meta.method = "get"
|
172
|
+
@meta.location = "location"
|
173
|
+
@meta.route_id = "route_id"
|
174
|
+
@meta.session_id = "session_id"
|
175
|
+
@meta.user_id = "user_id"
|
176
|
+
@meta.transaction_id = "transaction_id"
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should send an event" do
|
180
|
+
expect(TCellAgent::AppSensor::Sensor).to receive(:send_event).with(
|
181
|
+
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil, true
|
182
|
+
)
|
183
|
+
@sensor.check(@meta, 400)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
|
161
189
|
context "with enabled series_400_enabled" do
|
162
190
|
context "with 400 response code" do
|
163
191
|
before(:each) do
|
@@ -177,7 +205,7 @@ module TCellAgent
|
|
177
205
|
|
178
206
|
it "should send an event" do
|
179
207
|
expect(TCellAgent::AppSensor::Sensor).to receive(:send_event).with(
|
180
|
-
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil
|
208
|
+
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil, false
|
181
209
|
)
|
182
210
|
@sensor.check(@meta, 400)
|
183
211
|
end
|
@@ -187,7 +215,7 @@ module TCellAgent
|
|
187
215
|
@sensor.excluded_route_ids = {}
|
188
216
|
|
189
217
|
expect(TCellAgent::AppSensor::Sensor).to receive(:send_event).with(
|
190
|
-
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil
|
218
|
+
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil, false
|
191
219
|
)
|
192
220
|
@sensor.check(@meta, 400)
|
193
221
|
end
|
@@ -207,7 +235,7 @@ module TCellAgent
|
|
207
235
|
@sensor.excluded_route_ids = {"unmatching_route_id" => true}
|
208
236
|
|
209
237
|
expect(TCellAgent::AppSensor::Sensor).to receive(:send_event).with(
|
210
|
-
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil
|
238
|
+
@meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[4], nil, {code: 400} , nil, nil, false
|
211
239
|
)
|
212
240
|
@sensor.check(@meta, 400)
|
213
241
|
end
|
@@ -255,7 +283,7 @@ module TCellAgent
|
|
255
283
|
meta.transaction_id = "transaction_id"
|
256
284
|
|
257
285
|
expect(TCellAgent::AppSensor::Sensor).to receive(:send_event).with(
|
258
|
-
meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[500], nil, {code: 500} , nil, nil
|
286
|
+
meta, ResponseCodesSensor::RESPONSE_CODE_DP_DICT[500], nil, {code: 500} , nil, nil, false
|
259
287
|
)
|
260
288
|
sensor.check(meta, 500)
|
261
289
|
end
|
@@ -418,6 +418,9 @@ module TCellAgent
|
|
418
418
|
"version" => 2,
|
419
419
|
"data" => {
|
420
420
|
"options" => {
|
421
|
+
"uri_options" => {
|
422
|
+
"collect_full_uri" => true
|
423
|
+
},
|
421
424
|
"payloads" => {
|
422
425
|
"send_payloads" => true,
|
423
426
|
"send_blacklist" => {
|
@@ -504,16 +507,23 @@ module TCellAgent
|
|
504
507
|
expect(policy.options["database"]).to_not be_nil
|
505
508
|
|
506
509
|
expect(policy.options["req_size"].enabled).to eq(true)
|
510
|
+
expect(policy.options["req_size"].collect_full_uri).to eq(true)
|
507
511
|
expect(policy.options["resp_size"].enabled).to eq(true)
|
512
|
+
expect(policy.options["resp_size"].collect_full_uri).to eq(true)
|
508
513
|
expect(policy.options["resp_codes"].enabled).to eq(true)
|
514
|
+
expect(policy.options["resp_codes"].collect_full_uri).to eq(true)
|
509
515
|
expect(policy.options["ua"].enabled).to eq(true)
|
510
516
|
expect(policy.options["ua"].empty_enabled).to eq(true)
|
517
|
+
expect(policy.options["ua"].collect_full_uri).to eq(true)
|
511
518
|
expect(policy.options["errors"].enabled).to eq(true)
|
512
519
|
expect(policy.options["errors"].csrf_exception_enabled).to eq(true)
|
513
520
|
expect(policy.options["errors"].sql_exception_enabled).to eq(true)
|
521
|
+
expect(policy.options["errors"].collect_full_uri).to eq(true)
|
514
522
|
expect(policy.options["database"].enabled).to eq(true)
|
515
523
|
expect(policy.options["database"].max_rows).to eq(10)
|
524
|
+
expect(policy.options["database"].collect_full_uri).to eq(true)
|
516
525
|
|
526
|
+
expect(policy.injections_reporter.collect_full_uri).to eq(true)
|
517
527
|
expect(policy.injections_reporter.payloads_policy.send_payloads).to eq(true)
|
518
528
|
expect(policy.injections_reporter.payloads_policy.send_blacklist).to eq({
|
519
529
|
"jsessionid" => Set.new(["cookie"]),
|
@@ -528,6 +538,7 @@ module TCellAgent
|
|
528
538
|
expect(policy.injections_reporter.payloads_policy.log_whitelist).to eq({
|
529
539
|
"username" => Set.new(["*"]),
|
530
540
|
})
|
541
|
+
expect(policy.injections_reporter.payloads_policy.collect_full_uri).to eq(true)
|
531
542
|
|
532
543
|
injections_matcher = policy.injections_reporter.injections_matcher
|
533
544
|
sorted_sensors = injections_matcher.sensors.sort do
|
@@ -27,5 +27,55 @@ module TCellAgent
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
describe ".remove_trailing_slash" do
|
32
|
+
context "with nil" do
|
33
|
+
it "should return nil" do
|
34
|
+
expect(Strings.remove_trailing_slash(nil)).to eq(nil)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with empty string" do
|
39
|
+
it "should return empty string" do
|
40
|
+
expect(Strings.remove_trailing_slash("")).to eq("")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with / route" do
|
45
|
+
it "should return /" do
|
46
|
+
expect(Strings.remove_trailing_slash("/")).to eq("/")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "with no trailing slash" do
|
51
|
+
it "should return original string" do
|
52
|
+
expect(Strings.remove_trailing_slash("/index")).to eq("/index")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "with a trailing slash" do
|
57
|
+
it "should remove the trailing slash" do
|
58
|
+
expect(Strings.remove_trailing_slash("/index")).to eq("/index")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe ".java_hashcode" do
|
64
|
+
context "with some string" do
|
65
|
+
it "should equal the older java hash" do
|
66
|
+
java = 312563920
|
67
|
+
us = Strings.java_hashcode("The quick brown fox jumped over the lazy dogs.")
|
68
|
+
expect(us).to eq(java)
|
69
|
+
|
70
|
+
java = -1225848487
|
71
|
+
us = Strings.java_hashcode("I have a negative hash")
|
72
|
+
expect(us).to eq(java)
|
73
|
+
|
74
|
+
java = 628018387
|
75
|
+
us = Strings.java_hashcode("你好世界")
|
76
|
+
expect(us).to eq(java)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
30
80
|
end
|
31
81
|
end
|
data/tcell_agent.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "tcell_agent"
|
9
9
|
spec.version = TCellAgent::VERSION
|
10
10
|
spec.authors = ["Garrett"]
|
11
|
-
spec.email = ["
|
11
|
+
spec.email = ["rafael@tcell.io"]
|
12
12
|
spec.summary = "tCell.io Agent for Rails & Sinatra"
|
13
13
|
spec.description = "This agent allows users to use the tCell.io service with their Rails or Sinatra app."
|
14
14
|
spec.homepage = "https://www.tcell.io"
|
@@ -36,10 +36,8 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
37
37
|
spec.require_paths = ["lib","config","spec"]
|
38
38
|
|
39
|
-
spec.add_runtime_dependency "rest-client",">= 1.6"
|
40
39
|
spec.add_runtime_dependency "json",">=1.8"
|
41
40
|
spec.add_runtime_dependency "pbkdf2",">=0.1"
|
42
|
-
spec.add_runtime_dependency "rbtrace",">=0.4"
|
43
41
|
spec.add_development_dependency "rspec-core"
|
44
42
|
spec.add_development_dependency "bundler", ">= 1.7"
|
45
43
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tcell_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.29
|
4
|
+
version: 0.2.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garrett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rest-client
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.6'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.6'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: json
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +38,6 @@ dependencies:
|
|
52
38
|
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rbtrace
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.4'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.4'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: rspec-core
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,7 +111,7 @@ dependencies:
|
|
139
111
|
description: This agent allows users to use the tCell.io service with their Rails
|
140
112
|
or Sinatra app.
|
141
113
|
email:
|
142
|
-
-
|
114
|
+
- rafael@tcell.io
|
143
115
|
executables:
|
144
116
|
- tcell_agent
|
145
117
|
extensions:
|
@@ -178,6 +150,7 @@ files:
|
|
178
150
|
- lib/tcell_agent/appsensor/rules/baserules.json
|
179
151
|
- lib/tcell_agent/appsensor/sensor.rb
|
180
152
|
- lib/tcell_agent/authlogic.rb
|
153
|
+
- lib/tcell_agent/config/unknown_options.rb
|
181
154
|
- lib/tcell_agent/configuration.rb
|
182
155
|
- lib/tcell_agent/devise.rb
|
183
156
|
- lib/tcell_agent/instrumentation.rb
|
@@ -233,7 +206,6 @@ files:
|
|
233
206
|
- lib/tcell_agent/rails/routes/route_id.rb
|
234
207
|
- lib/tcell_agent/rails/settings_reporter.rb
|
235
208
|
- lib/tcell_agent/rails/tcell_body_proxy.rb
|
236
|
-
- lib/tcell_agent/rails/tracing.rb
|
237
209
|
- lib/tcell_agent/routes/table.rb
|
238
210
|
- lib/tcell_agent/sensor_events/app_config.rb
|
239
211
|
- lib/tcell_agent/sensor_events/appsensor_event.rb
|
@@ -307,7 +279,6 @@ files:
|
|
307
279
|
- spec/apps/rails-4.1/config/routes.rb
|
308
280
|
- spec/apps/rails-4.1/config/secrets.yml
|
309
281
|
- spec/controllers/application_controller.rb
|
310
|
-
- spec/integration/puma.rb
|
311
282
|
- spec/lib/tcell_agent/agent/fork_pipe_manager_spec.rb
|
312
283
|
- spec/lib/tcell_agent/agent/policy_manager_spec.rb
|
313
284
|
- spec/lib/tcell_agent/agent/static_agent_spec.rb
|
@@ -316,6 +287,7 @@ files:
|
|
316
287
|
- spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb
|
317
288
|
- spec/lib/tcell_agent/appsensor/rules/appsensor_rule_manager_spec.rb
|
318
289
|
- spec/lib/tcell_agent/appsensor/rules/appsensor_rule_set_spec.rb
|
290
|
+
- spec/lib/tcell_agent/config/unknown_options_spec.rb
|
319
291
|
- spec/lib/tcell_agent/configuration_spec.rb
|
320
292
|
- spec/lib/tcell_agent/instrumentation_spec.rb
|
321
293
|
- spec/lib/tcell_agent/patches/block_rule_spec.rb
|
@@ -391,12 +363,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
391
363
|
version: '0'
|
392
364
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
393
365
|
requirements:
|
394
|
-
- - "
|
366
|
+
- - ">="
|
395
367
|
- !ruby/object:Gem::Version
|
396
|
-
version:
|
368
|
+
version: '0'
|
397
369
|
requirements: []
|
398
370
|
rubyforge_project:
|
399
|
-
rubygems_version: 2.6.
|
371
|
+
rubygems_version: 2.6.8
|
400
372
|
signing_key:
|
401
373
|
specification_version: 4
|
402
374
|
summary: tCell.io Agent for Rails & Sinatra
|
@@ -445,7 +417,6 @@ test_files:
|
|
445
417
|
- spec/apps/rails-4.1/config/routes.rb
|
446
418
|
- spec/apps/rails-4.1/config/secrets.yml
|
447
419
|
- spec/controllers/application_controller.rb
|
448
|
-
- spec/integration/puma.rb
|
449
420
|
- spec/lib/tcell_agent/agent/fork_pipe_manager_spec.rb
|
450
421
|
- spec/lib/tcell_agent/agent/policy_manager_spec.rb
|
451
422
|
- spec/lib/tcell_agent/agent/static_agent_spec.rb
|
@@ -454,6 +425,7 @@ test_files:
|
|
454
425
|
- spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb
|
455
426
|
- spec/lib/tcell_agent/appsensor/rules/appsensor_rule_manager_spec.rb
|
456
427
|
- spec/lib/tcell_agent/appsensor/rules/appsensor_rule_set_spec.rb
|
428
|
+
- spec/lib/tcell_agent/config/unknown_options_spec.rb
|
457
429
|
- spec/lib/tcell_agent/configuration_spec.rb
|
458
430
|
- spec/lib/tcell_agent/instrumentation_spec.rb
|
459
431
|
- spec/lib/tcell_agent/patches/block_rule_spec.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module TCellAgent
|
2
|
-
module Instrumentation
|
3
|
-
|
4
|
-
module Rails
|
5
|
-
|
6
|
-
ActiveSupport.on_load(:action_controller) do
|
7
|
-
ActionController::Base.class_eval do
|
8
|
-
if (::Rails::VERSION::MAJOR == 5)
|
9
|
-
before_action :require_rbtrace
|
10
|
-
elsif (::Rails::VERSION::MAJOR < 5)
|
11
|
-
before_filter :require_rbtrace
|
12
|
-
end
|
13
|
-
def require_rbtrace
|
14
|
-
require 'rbtrace'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
data/spec/integration/puma.rb
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'webmock/rspec'
|
3
|
-
|
4
|
-
class Puma
|
5
|
-
end
|
6
|
-
|
7
|
-
class Puma::Server
|
8
|
-
def run(background=true)
|
9
|
-
# Fake puma server
|
10
|
-
# this is called to trigger the
|
11
|
-
# agent details, server packages,
|
12
|
-
# and routes instrumentation
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe ".Puma" do
|
17
|
-
|
18
|
-
it "should fire off all the initial instrumentation" do
|
19
|
-
cfg = double("config", options: {})
|
20
|
-
expect(Puma).to receive(:cli_config).and_return(cfg)
|
21
|
-
|
22
|
-
ENV["RAILS_ENV"] = "test"
|
23
|
-
ENV["TCELL_APP_ID"] = "spec-app-id"
|
24
|
-
ENV["TCELL_API_KEY"] = "spec-api-key"
|
25
|
-
ENV["TCELL_API_URL"] = "http://test.tcell.io/api/v1"
|
26
|
-
ENV["TCELL_INPUT_URL"] = "http://test.tcell.io/api/v1"
|
27
|
-
ENV["TCELL_RAISE_EXCEPTIONS"] = "true"
|
28
|
-
|
29
|
-
stub_request(:get, "http://test.tcell.io/api/v1/app/spec-app-id/update?last_timestamp=0").to_return(
|
30
|
-
:status => 200,
|
31
|
-
:body => "{\"result\":{\"last_timestamp\":1454368562251000, \"secure-headers\":null, \"http-redirect\":null, \"http-tx\":null, \"csp-headers\":{\"app_id\":\"raftest-EyJZR\", \"policy_id\":\"c2c271b0-c939-11e5-a610-7d4b78bcb792\", \"headers\":[{\"name\":\"Content-Security-Policy-Report-Only\", \"value\":\"script-src 'unsafe-inline' https: https://api.tcell.io; font-src https:; media-src https:; connect-src https: https://api.tcell.io https://input.tcell-preview.io/; style-src https:; object-src https:; default-src https:; frame-src https:; img-src https:\", \"report-uri\":\"https://input.tcell-preview.io/csp/f2612f09e5261d9aa0439dfd49a64c5365408deb1d2b2f011a4aef17ccbf6471\"}], \"data\":{\"options\":{}}}, \"clickjacking\":null, \"dlp\":null, \"appsensor\":null, \"login\":{\"app_id\":\"raftest-EyJZR\", \"policy_id\":\"363b8b60-a9a8-11e5-bb10-a9372a56b8a7\", \"data\":{\"options\":{\"login_success_enabled\":true, \"login_failed_enabled\":true}}}}}",
|
32
|
-
headers: {}
|
33
|
-
)
|
34
|
-
|
35
|
-
stub_request(:post, "http://test.tcell.io/api/v1/app/spec-app-id/server_agent").to_return(:status => 200, :body => "", :headers => {})
|
36
|
-
|
37
|
-
require "rails"
|
38
|
-
case Rails.version
|
39
|
-
when '3.2.12'
|
40
|
-
ENV['DATABASE_URL'] = 'sqlite3://localhost/:memory:'
|
41
|
-
require "apps/rails-3.2/config/environment"
|
42
|
-
when '4.1.0'
|
43
|
-
ENV['DATABASE_URL'] = 'sqlite3::memory:'
|
44
|
-
require "apps/rails-4.1/config/environment"
|
45
|
-
end
|
46
|
-
|
47
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
48
|
-
[
|
49
|
-
hash_including("event_type"=>"app_config_setting"),
|
50
|
-
hash_including("event_type"=>"app_config_setting"),
|
51
|
-
hash_including("event_type"=>"app_config_setting"),
|
52
|
-
hash_including("event_type"=>"server_agent_details")
|
53
|
-
]
|
54
|
-
).and_call_original
|
55
|
-
|
56
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
57
|
-
[hash_including("event_type"=>"server_agent_details")]
|
58
|
-
).and_call_original
|
59
|
-
|
60
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
61
|
-
[hash_including("event_type"=>"server_agent_packages")]
|
62
|
-
).and_call_original
|
63
|
-
|
64
|
-
case Rails.version
|
65
|
-
when '3.2.12'
|
66
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
67
|
-
[
|
68
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp", "method"=>"get"),
|
69
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp", "method"=>"post"),
|
70
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/new", "method"=>"get"),
|
71
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id/edit", "method"=>"get"),
|
72
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"get"),
|
73
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"put"),
|
74
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"delete"),
|
75
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/1", "method"=>"get"),
|
76
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/2", "method"=>"get"),
|
77
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/3", "method"=>"get"),
|
78
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/4", "method"=>"get"),
|
79
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/5", "method"=>"get"),
|
80
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/6", "method"=>"get"),
|
81
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/7", "method"=>"get"),
|
82
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/8", "method"=>"get"),
|
83
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/9", "method"=>"get"),
|
84
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/10", "method"=>"get"),
|
85
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/11", "method"=>"get"),
|
86
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/12", "method"=>"get"),
|
87
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/13", "method"=>"get"),
|
88
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/14", "method"=>"get"),
|
89
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/15", "method"=>"get"),
|
90
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/16", "method"=>"get"),
|
91
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/17", "method"=>"get"),
|
92
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/18", "method"=>"get")
|
93
|
-
]
|
94
|
-
).and_call_original
|
95
|
-
|
96
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
97
|
-
[
|
98
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/19", "method"=>"get"),
|
99
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/20", "method"=>"get"),
|
100
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/21", "method"=>"get"),
|
101
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/22", "method"=>"get"),
|
102
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/23", "method"=>"get"),
|
103
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/24", "method"=>"get"),
|
104
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/25", "method"=>"get"),
|
105
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/26", "method"=>"get"),
|
106
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/27", "method"=>"get"),
|
107
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/28", "method"=>"get"),
|
108
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/29", "method"=>"get"),
|
109
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/30", "method"=>"get"),
|
110
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/31", "method"=>"get"),
|
111
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/32", "method"=>"get"),
|
112
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/33", "method"=>"get"),
|
113
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/34", "method"=>"get"),
|
114
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/35", "method"=>"get"),
|
115
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/36", "method"=>"get"),
|
116
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/37", "method"=>"get"),
|
117
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/38", "method"=>"get"),
|
118
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/39", "method"=>"get"),
|
119
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/40", "method"=>"get"),
|
120
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/41", "method"=>"get"),
|
121
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/42", "method"=>"get"),
|
122
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/43", "method"=>"get")
|
123
|
-
]
|
124
|
-
).and_call_original
|
125
|
-
|
126
|
-
when '4.1.0'
|
127
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
128
|
-
[
|
129
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp", "method"=>"get"),
|
130
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp", "method"=>"post"),
|
131
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/new", "method"=>"get"),
|
132
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id/edit", "method"=>"get"),
|
133
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"get"),
|
134
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"patch"),
|
135
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"put"),
|
136
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/tcellapp/:id", "method"=>"delete"),
|
137
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/:controller(/:action(/:id))", "method"=>"get"),
|
138
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/:controller(/:action(/:id))", "method"=>"post"),
|
139
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/1", "method"=>"get"),
|
140
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/2", "method"=>"get"),
|
141
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/3", "method"=>"get"),
|
142
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/4", "method"=>"get"),
|
143
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/5", "method"=>"get"),
|
144
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/6", "method"=>"get"),
|
145
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/7", "method"=>"get"),
|
146
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/8", "method"=>"get"),
|
147
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/9", "method"=>"get"),
|
148
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/10", "method"=>"get"),
|
149
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/11", "method"=>"get"),
|
150
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/12", "method"=>"get"),
|
151
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/13", "method"=>"get"),
|
152
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/14", "method"=>"get"),
|
153
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/15", "method"=>"get"),
|
154
|
-
]
|
155
|
-
).and_call_original
|
156
|
-
|
157
|
-
expect_any_instance_of(TCellAgent::TCellApi).to receive(:sendEventSet).with(
|
158
|
-
[
|
159
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/16", "method"=>"get"),
|
160
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/17", "method"=>"get"),
|
161
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/18", "method"=>"get"),
|
162
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/19", "method"=>"get"),
|
163
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/20", "method"=>"get"),
|
164
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/21", "method"=>"get"),
|
165
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/22", "method"=>"get"),
|
166
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/23", "method"=>"get"),
|
167
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/24", "method"=>"get"),
|
168
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/25", "method"=>"get"),
|
169
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/26", "method"=>"get"),
|
170
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/27", "method"=>"get"),
|
171
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/28", "method"=>"get"),
|
172
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/29", "method"=>"get"),
|
173
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/30", "method"=>"get"),
|
174
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/31", "method"=>"get"),
|
175
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/32", "method"=>"get"),
|
176
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/33", "method"=>"get"),
|
177
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/34", "method"=>"get"),
|
178
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/35", "method"=>"get"),
|
179
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/36", "method"=>"get"),
|
180
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/37", "method"=>"get"),
|
181
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/38", "method"=>"get"),
|
182
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/39", "method"=>"get"),
|
183
|
-
hash_including("event_type"=>"appserver_routes", "uri"=>"/40", "method"=>"get"),
|
184
|
-
]
|
185
|
-
).and_call_original
|
186
|
-
|
187
|
-
end
|
188
|
-
|
189
|
-
server = Puma::Server.new
|
190
|
-
server.run
|
191
|
-
sleep 10
|
192
|
-
|
193
|
-
end
|
194
|
-
|
195
|
-
end
|