newrelic_rpm 3.9.1.236 → 3.9.2.239
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -4
- data/CHANGELOG +96 -2
- data/lib/new_relic/agent.rb +47 -4
- data/lib/new_relic/agent/agent.rb +51 -26
- data/lib/new_relic/agent/agent_logger.rb +4 -0
- data/lib/new_relic/agent/configuration.rb +2 -32
- data/lib/new_relic/agent/configuration/default_source.rb +153 -118
- data/lib/new_relic/agent/configuration/dotted_hash.rb +52 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
- data/lib/new_relic/agent/configuration/manager.rb +101 -2
- data/lib/new_relic/agent/configuration/manual_source.rb +17 -0
- data/lib/new_relic/agent/configuration/server_source.rb +12 -4
- data/lib/new_relic/agent/configuration/yaml_source.rb +46 -22
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- data/lib/new_relic/agent/cross_app_tracing.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +55 -14
- data/lib/new_relic/agent/database/obfuscator.rb +22 -7
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +6 -8
- data/lib/new_relic/agent/error_collector.rb +24 -16
- data/lib/new_relic/agent/event_loop.rb +189 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +8 -17
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +17 -16
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +41 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -11
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -8
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -9
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -18
- data/lib/new_relic/agent/instrumentation/rubyprof.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +12 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
- data/lib/new_relic/agent/method_tracer.rb +33 -39
- data/lib/new_relic/agent/new_relic_service.rb +35 -156
- data/lib/new_relic/agent/new_relic_service/encoders.rb +34 -0
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +50 -0
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +52 -0
- data/lib/new_relic/agent/new_relic_service/pruby_marshaller.rb +52 -0
- data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
- data/lib/new_relic/agent/traced_method_stack.rb +16 -2
- data/lib/new_relic/agent/transaction.rb +0 -4
- data/lib/new_relic/collection_helper.rb +2 -2
- data/lib/new_relic/control/frameworks/rails.rb +3 -0
- data/lib/new_relic/control/instrumentation.rb +6 -2
- data/lib/new_relic/json_wrapper.rb +47 -25
- data/lib/new_relic/language_support.rb +0 -4
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/rack/developer_mode.rb +4 -3
- data/lib/new_relic/recipes/capistrano3.rb +2 -2
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
- data/lib/new_relic/timer_lib.rb +1 -1
- data/lib/new_relic/version.rb +2 -2
- data/lib/tasks/config.html.erb +28 -0
- data/lib/tasks/config.rake +134 -0
- data/lib/tasks/config.text.erb +7 -0
- data/lib/tasks/install.rake +0 -63
- data/newrelic.yml +7 -0
- data/test/active_record_fixtures.rb +4 -4
- data/test/agent_helper.rb +58 -18
- data/test/environments/lib/environments/runner.rb +1 -1
- data/test/environments/rails21/Gemfile +1 -1
- data/test/environments/rails21/config/boot.rb +1 -1
- data/test/environments/rails22/Gemfile +1 -1
- data/test/environments/rails22/config/boot.rb +1 -1
- data/test/environments/rails23/config/boot.rb +2 -2
- data/test/environments/rails30/Gemfile +1 -1
- data/test/environments/rails31/Gemfile +1 -1
- data/test/environments/rails32/Gemfile +1 -1
- data/test/environments/rails40/Gemfile +1 -1
- data/test/environments/rails41/Gemfile +1 -1
- data/test/fixtures/cross_agent_tests/labels.json +104 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +23 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.obfuscated +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.obfuscated +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_double_quoted_string.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_comments_and_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_comments_and_quotes.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.sql +3 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/quote_delimiters_in_comments.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/quote_delimiters_in_comments.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.sql +1 -0
- data/test/multiverse/lib/multiverse/output_collector.rb +1 -1
- data/test/multiverse/lib/multiverse/runner.rb +1 -1
- data/test/multiverse/lib/multiverse/suite.rb +19 -4
- data/test/multiverse/suites/agent_only/audit_log_test.rb +1 -38
- data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +25 -35
- data/test/multiverse/suites/agent_only/config/newrelic.yml +2 -0
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +1 -0
- data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +1 -1
- data/test/multiverse/suites/agent_only/keepalive_test.rb +29 -0
- data/test/multiverse/suites/agent_only/labels_test.rb +89 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -3
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +1 -1
- data/test/multiverse/suites/agent_only/start_up_test.rb +9 -1
- data/test/multiverse/suites/capistrano/config/deploy.rb +6 -2
- data/test/multiverse/suites/capistrano/deployment_test.rb +12 -4
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +29 -1
- data/test/multiverse/suites/curb/Envfile +6 -2
- data/test/multiverse/suites/datamapper/Envfile +0 -4
- data/test/multiverse/suites/deferred_instrumentation/Envfile +0 -4
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +1 -1
- data/test/multiverse/suites/excon/Envfile +5 -4
- data/test/multiverse/suites/excon/excon_test.rb +1 -1
- data/test/multiverse/suites/httpclient/Envfile +0 -4
- data/test/multiverse/suites/marshalling/Envfile +12 -0
- data/test/multiverse/suites/marshalling/config/newrelic.yml +20 -0
- data/test/multiverse/suites/marshalling/marshalling_test.rb +60 -0
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +1 -1
- data/test/multiverse/suites/mongo/helpers/mongo_replica_set.rb +1 -1
- data/test/multiverse/suites/mongo/helpers/mongo_server.rb +4 -4
- data/test/multiverse/suites/padrino/Envfile +0 -5
- data/test/multiverse/suites/padrino/padrino_test.rb +1 -1
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +2 -1
- data/test/multiverse/suites/rails/ignore_test.rb +22 -0
- data/test/multiverse/suites/rails/rails2_app/config/boot.rb +2 -2
- data/test/multiverse/suites/rails/rails2_app/config/routes.rb +1 -0
- data/test/multiverse/suites/resque/Envfile +0 -4
- data/test/multiverse/suites/sequel/Envfile +0 -5
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +22 -0
- data/test/multiverse/suites/typhoeus/Envfile +1 -4
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +1 -13
- data/test/new_relic/agent/agent_logger_test.rb +11 -0
- data/test/new_relic/agent/agent_test.rb +43 -20
- data/test/new_relic/agent/audit_logger_test.rb +7 -3
- data/test/new_relic/agent/commands/thread_profiler_session_test.rb +0 -1
- data/test/new_relic/agent/commands/xray_session_collection_test.rb +1 -1
- data/test/new_relic/agent/configuration/dotted_hash_test.rb +53 -0
- data/test/new_relic/agent/configuration/manager_test.rb +99 -6
- data/test/new_relic/agent/configuration/manual_source_test.rb +18 -0
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +1 -1
- data/test/new_relic/agent/configuration/yaml_source_test.rb +8 -4
- data/test/new_relic/agent/database/sql_obfuscation_test.rb +76 -0
- data/test/new_relic/agent/database_test.rb +2 -38
- data/test/new_relic/agent/error_collector/notice_error_test.rb +21 -3
- data/test/new_relic/agent/error_collector_test.rb +15 -2
- data/test/new_relic/agent/event_loop_test.rb +202 -0
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +4 -0
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +283 -182
- data/test/new_relic/agent/method_tracer_test.rb +1 -2
- data/test/new_relic/agent/new_relic_service_test.rb +83 -27
- data/test/new_relic/agent/pipe_channel_manager_test.rb +6 -6
- data/test/new_relic/agent/rpm_agent_test.rb +1 -8
- data/test/new_relic/agent/sql_sampler_test.rb +10 -8
- data/test/new_relic/agent/threading/backtrace_service_test.rb +1 -1
- data/test/new_relic/agent/traced_method_stack_test.rb +45 -13
- data/test/new_relic/agent/transaction_sample_builder_test.rb +1 -2
- data/test/new_relic/agent/transaction_test.rb +3 -3
- data/test/new_relic/agent_test.rb +47 -8
- data/test/new_relic/collection_helper_test.rb +5 -5
- data/test/new_relic/control/instrumentation_test.rb +56 -0
- data/test/new_relic/control_test.rb +4 -3
- data/test/new_relic/fake_collector.rb +7 -2
- data/test/new_relic/http_client_test_cases.rb +4 -4
- data/test/new_relic/latest_changes_test.rb +3 -3
- data/test/new_relic/transaction_sample/segment_test.rb +0 -1
- data/test/new_relic/transaction_sample_test.rb +19 -2
- data/test/performance/lib/performance/runner.rb +4 -4
- data/test/performance/suites/marshalling.rb +46 -30
- data/test/performance/suites/sql_obfuscation.rb +30 -0
- data/test/test_helper.rb +1 -1
- data/ui/helpers/developer_mode_helper.rb +2 -2
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +1 -1
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +1 -1
- metadata +84 -3
- metadata.gz.sig +0 -0
- data/test/environments/rails23/config/environments/development.rb +0 -11
@@ -110,7 +110,7 @@ module Environments
|
|
110
110
|
return if File.basename(dir) == "norails"
|
111
111
|
|
112
112
|
puts "Making sure the database is there for '#{File.basename(dir)}'..."
|
113
|
-
|
113
|
+
`cd #{dir} && RAILS_ENV=test bundle exec rake --trace db:create`
|
114
114
|
end
|
115
115
|
|
116
116
|
def run(dir)
|
@@ -64,7 +64,7 @@ module Rails
|
|
64
64
|
else
|
65
65
|
gem 'rails'
|
66
66
|
end
|
67
|
-
rescue Gem::LoadError
|
67
|
+
rescue Gem::LoadError
|
68
68
|
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
69
69
|
exit 1
|
70
70
|
end
|
@@ -64,7 +64,7 @@ module Rails
|
|
64
64
|
else
|
65
65
|
gem 'rails'
|
66
66
|
end
|
67
|
-
rescue Gem::LoadError
|
67
|
+
rescue Gem::LoadError
|
68
68
|
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
69
69
|
exit 1
|
70
70
|
end
|
@@ -64,7 +64,7 @@ module Rails
|
|
64
64
|
else
|
65
65
|
gem 'rails'
|
66
66
|
end
|
67
|
-
rescue Gem::LoadError
|
67
|
+
rescue Gem::LoadError
|
68
68
|
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
69
69
|
exit 1
|
70
70
|
end
|
@@ -121,7 +121,7 @@ class Rails::Boot
|
|
121
121
|
|
122
122
|
Rails::Initializer.run(:set_load_path)
|
123
123
|
end
|
124
|
-
end
|
124
|
+
end
|
125
125
|
|
126
126
|
# All that for this:
|
127
127
|
Rails.boot!
|
@@ -0,0 +1,104 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"name": "empty",
|
4
|
+
"labelString": "",
|
5
|
+
"warning": false,
|
6
|
+
"expected": []
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"name": "multiple_values",
|
10
|
+
"labelString": "Data Center: East;Data Center :West; Server : North;Server:South; ",
|
11
|
+
"warning": false,
|
12
|
+
"expected": [
|
13
|
+
{ "label_type": "Data Center", "label_value": "East" },
|
14
|
+
{ "label_type": "Data Center", "label_value": "West" },
|
15
|
+
{ "label_type": "Server", "label_value": "North" },
|
16
|
+
{ "label_type": "Server", "label_value": "South" }
|
17
|
+
]
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"name": "single",
|
21
|
+
"labelString": "Server:East",
|
22
|
+
"warning": false,
|
23
|
+
"expected": [ { "label_type": "Server", "label_value": "East" } ]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"name": "single_trailing_semicolon",
|
27
|
+
"labelString": "Server:East;",
|
28
|
+
"warning": false,
|
29
|
+
"expected": [ { "label_type": "Server", "label_value": "East" } ]
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"name": "pair",
|
33
|
+
"labelString": "Data Center:Primary;Server:East",
|
34
|
+
"warning": false,
|
35
|
+
"expected": [
|
36
|
+
{ "label_type": "Data Center", "label_value": "Primary" },
|
37
|
+
{ "label_type": "Server", "label_value": "East" }
|
38
|
+
]
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"name": "truncation",
|
42
|
+
"labelString": "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK:VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
43
|
+
"warning": false,
|
44
|
+
"expected": [ {
|
45
|
+
"label_type": "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK",
|
46
|
+
"label_value": "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
|
47
|
+
} ]
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"name": "failed_no_delimiters",
|
51
|
+
"labelString": "Server",
|
52
|
+
"warning": true,
|
53
|
+
"expected": []
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"name": "failed_no_delimiter",
|
57
|
+
"labelString": "ServerNorth;",
|
58
|
+
"warning": true,
|
59
|
+
"expected": []
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"name": "failed_too_many_delimiters",
|
63
|
+
"labelString": "Server:North:South;",
|
64
|
+
"warning": true,
|
65
|
+
"expected": []
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"name": "failed_no_value",
|
69
|
+
"labelString": "Server: ",
|
70
|
+
"warning": true,
|
71
|
+
"expected": []
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"name": "failed_no_key",
|
75
|
+
"labelString": ":North",
|
76
|
+
"warning": true,
|
77
|
+
"expected": []
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"name": "failed_no_delimiter_in_later_pair",
|
81
|
+
"labelString": "Server:North;South;",
|
82
|
+
"warning": true,
|
83
|
+
"expected": []
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"name": "so_many_labels",
|
87
|
+
"labelString": "0:0;1:1;2:2;3:3;4:4;5:5;6:6;7:7;8:8;9:9;10:10;11:11;12:12;13:13;14:14;15:15;16:16;17:17;18:18;19:19;20:20;21:21;22:22;23:23;24:24;25:25;26:26;27:27;28:28;29:29;30:30;31:31;32:32;33:33;34:34;35:35;36:36;37:37;38:38;39:39;40:40;41:41;42:42;43:43;44:44;45:45;46:46;47:47;48:48;49:49;50:50;51:51;52:52;53:53;54:54;55:55;56:56;57:57;58:58;59:59;60:60;61:61;62:62;63:63;64:64;65:65;66:66;67:67;68:68;69:69;70:70;71:71;72:72;73:73;74:74;75:75;76:76;77:77;78:78;79:79;80:80;81:81;82:82;83:83;84:84;85:85;86:86;87:87;88:88;89:89;90:90;91:91;92:92;93:93;94:94;95:95;96:96;97:97;98:98;99:99;",
|
88
|
+
"warning": true,
|
89
|
+
"expected": [
|
90
|
+
{ "label_type": "0", "label_value": "0" }, { "label_type": "1", "label_value": "1" }, { "label_type": "2", "label_value": "2" }, { "label_type": "3", "label_value": "3" }, { "label_type": "4", "label_value": "4" },
|
91
|
+
{ "label_type": "5", "label_value": "5" }, { "label_type": "6", "label_value": "6" }, { "label_type": "7", "label_value": "7" }, { "label_type": "8", "label_value": "8" }, { "label_type": "9", "label_value": "9" },
|
92
|
+
{ "label_type": "10", "label_value": "10" }, { "label_type": "11", "label_value": "11" }, { "label_type": "12", "label_value": "12" }, { "label_type": "13", "label_value": "13" }, { "label_type": "14", "label_value": "14" },
|
93
|
+
{ "label_type": "15", "label_value": "15" }, { "label_type": "16", "label_value": "16" }, { "label_type": "17", "label_value": "17" }, { "label_type": "18", "label_value": "18" }, { "label_type": "19", "label_value": "19" },
|
94
|
+
{ "label_type": "20", "label_value": "20" }, { "label_type": "21", "label_value": "21" }, { "label_type": "22", "label_value": "22" }, { "label_type": "23", "label_value": "23" }, { "label_type": "24", "label_value": "24" },
|
95
|
+
{ "label_type": "25", "label_value": "25" }, { "label_type": "26", "label_value": "26" }, { "label_type": "27", "label_value": "27" }, { "label_type": "28", "label_value": "28" }, { "label_type": "29", "label_value": "29" },
|
96
|
+
{ "label_type": "30", "label_value": "30" }, { "label_type": "31", "label_value": "31" }, { "label_type": "32", "label_value": "32" }, { "label_type": "33", "label_value": "33" }, { "label_type": "34", "label_value": "34" },
|
97
|
+
{ "label_type": "35", "label_value": "35" }, { "label_type": "36", "label_value": "36" }, { "label_type": "37", "label_value": "37" }, { "label_type": "38", "label_value": "38" }, { "label_type": "39", "label_value": "39" },
|
98
|
+
{ "label_type": "40", "label_value": "40" }, { "label_type": "41", "label_value": "41" }, { "label_type": "42", "label_value": "42" }, { "label_type": "43", "label_value": "43" }, { "label_type": "44", "label_value": "44" },
|
99
|
+
{ "label_type": "45", "label_value": "45" }, { "label_type": "46", "label_value": "46" }, { "label_type": "47", "label_value": "47" }, { "label_type": "48", "label_value": "48" }, { "label_type": "49", "label_value": "49" },
|
100
|
+
{ "label_type": "50", "label_value": "50" }, { "label_type": "51", "label_value": "51" }, { "label_type": "52", "label_value": "52" }, { "label_type": "53", "label_value": "53" }, { "label_type": "54", "label_value": "54" },
|
101
|
+
{ "label_type": "55", "label_value": "55" }, { "label_type": "56", "label_value": "56" }, { "label_type": "57", "label_value": "57" }, { "label_type": "58", "label_value": "58" }, { "label_type": "59", "label_value": "59" },
|
102
|
+
{ "label_type": "60", "label_value": "60" }, { "label_type": "61", "label_value": "61" }, { "label_type": "62", "label_value": "62" }, { "label_type": "63", "label_value": "63" } ]
|
103
|
+
}
|
104
|
+
]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
These test cases cover obfuscation (more properly, masking) of literal values
|
2
|
+
from SQL statements captured by agents. SQL statements may be captured and
|
3
|
+
attached to transaction trace nodes, or to slow SQL traces.
|
4
|
+
|
5
|
+
Input queries end with the suffix `.sql`, and the expected obfuscated results
|
6
|
+
end with the suffix `.obfuscated`. Input queries may contain comment lines
|
7
|
+
explaining notes about the test case. Comment lines will precede the actual
|
8
|
+
query, and begin with a `#` symbol.
|
9
|
+
|
10
|
+
Test cases that have a `.mysql` or `.postgres` tag in the filename preceding the
|
11
|
+
`.sql` suffix are specific to either mysql or postgres obfuscation. This is
|
12
|
+
relevant because PostgreSQL uses different identifier and string quoting rules
|
13
|
+
than MySQL (most notably, double-quoted string literals are not allowed in
|
14
|
+
PostgreSQL, where double-quotes are instead used around identifiers).
|
15
|
+
|
16
|
+
The `malformed` directory contains SQL queries that are not valid SQL in any
|
17
|
+
quoting mode. Some agents may choose to attempt to obfuscate these cases, and
|
18
|
+
others may instead just replace the query entirely with a placeholder message.
|
19
|
+
|
20
|
+
The following database documentation may be helpful in understanding these test
|
21
|
+
cases:
|
22
|
+
* [MySQL String Literals](http://dev.mysql.com/doc/refman/5.5/en/string-literals.html)
|
23
|
+
* [PostgreSQL String Constants](http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS)
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = ? AND c3=? LIMIT ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = 'value' AND c3="othervalue" LIMIT ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM t WHERE foo=? AND baz=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM t WHERE foo="bar/*" AND baz="whatever */qux"
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT "t001"."c2" FROM "t001" WHERE "t001"."c2" = ? AND c3=? LIMIT ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT "t001"."c2" FROM "t001" WHERE "t001"."c2" = 'value' AND c3=1234 LIMIT 1
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM t WHERE ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM foo WHERE bar=? ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM foo WHERE bar='baz' /* Hide Me */
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT foo, bar FROM baz WHERE password=? ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT foo, bar FROM baz WHERE password='hunter2' # Secret
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT "col1", "col2" from "table" WHERE "col3"=E? AND country=e?
|
@@ -0,0 +1,4 @@
|
|
1
|
+
# PostgreSQL supports an alternate string quoting mode where backslash escape
|
2
|
+
# sequences are interpreted.
|
3
|
+
# See: http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
|
4
|
+
SELECT "col1", "col2" from "table" WHERE "col3"=E'foo\'bar\\baz' AND country=e'foo\'bar\\baz'
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE foo='bar' AND baz="nothing to see here'
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE foo='bar' AND baz='nothing to see here
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM t WHERE ?
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM t WHERE ?
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM t WHERE ?
|
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO `X` values(?,?, ? , ?, ?)
|
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO `X` values("test",0, 1 , 2, 'test')
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value='nothing'
|
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO X VALUES(?, ?, ?.?, ?+?)
|
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO X VALUES(1, 23456, 123.456, 99+100)
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM foo WHERE col=? AND ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM foo WHERE col='value1' AND /* don't */ col2='value1' /* won't */
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name=? AND value=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name="foo" AND value="don't"
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name=? AND value = ?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name='foo' AND value = 'bar'
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE col=?
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE col1=? AND col2=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE col1='foo"bar' AND col2='what"ever'
|
@@ -0,0 +1 @@
|
|
1
|
+
select * from accounts where accounts.name != ? order by accounts.name
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE col1=? AND col2=?
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.sql
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE col1="don't" AND col2="won't"
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO X values(?, ?,?, ? , ?, ?, ?)
|
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO X values('', 'jim''s ssn',0, 1 , 'jim''s son''s son', """jim''s"" hat", "\"jim''s secret\"")
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name=? AND color=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE foo=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE foo="this string ends with a backslash\\"
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE foo=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE foo='this string ends with a backslash\\'
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name=? AND color=?
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT * FROM table WHERE name='foo\'' AND color='blue'
|
data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO X values(?, ?,?, ? , ?)
|
@@ -0,0 +1 @@
|
|
1
|
+
INSERT INTO X values('', 'a''b c',0, 1 , 'd''e f''s h')
|