newrelic_rpm 3.11.2.286 → 3.12.0.288
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/.yardopts +2 -0
- data/CHANGELOG +39 -4
- data/README.md +4 -2
- data/lib/new_relic/agent.rb +229 -214
- data/lib/new_relic/agent/agent.rb +23 -12
- data/lib/new_relic/agent/attribute_filter.rb +242 -0
- data/lib/new_relic/agent/attribute_processing.rb +62 -0
- data/lib/new_relic/agent/commands/xray_session_collection.rb +4 -1
- data/lib/new_relic/agent/configuration/default_source.rb +284 -30
- data/lib/new_relic/agent/configuration/high_security_source.rb +0 -8
- data/lib/new_relic/agent/configuration/manager.rb +1 -1
- data/lib/new_relic/agent/configuration/server_source.rb +86 -31
- data/lib/new_relic/agent/configuration/yaml_source.rb +1 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +8 -13
- data/lib/new_relic/agent/cross_app_tracing.rb +15 -15
- data/lib/new_relic/agent/custom_event_aggregator.rb +6 -2
- data/lib/new_relic/agent/database.rb +15 -2
- data/lib/new_relic/agent/datastores.rb +52 -38
- data/lib/new_relic/agent/datastores/metric_helper.rb +2 -1
- data/lib/new_relic/agent/encoding_normalizer.rb +82 -0
- data/lib/new_relic/agent/error_collector.rb +125 -169
- data/lib/new_relic/agent/hash_extensions.rb +26 -0
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +13 -11
- data/lib/new_relic/agent/http_clients/uri_util.rb +9 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -3
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +12 -5
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +6 -7
- data/lib/new_relic/agent/instrumentation/curb.rb +6 -6
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +4 -3
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +6 -3
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +9 -3
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -1
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +9 -7
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +8 -6
- data/lib/new_relic/agent/instrumentation/resque.rb +2 -3
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -3
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +24 -16
- data/lib/new_relic/agent/parameter_filtering.rb +8 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +2 -2
- data/lib/new_relic/agent/sql_sampler.rb +1 -0
- data/lib/new_relic/agent/stats.rb +0 -4
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +5 -3
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +4 -0
- data/lib/new_relic/agent/supported_versions.rb +2 -2
- data/lib/new_relic/agent/traced_method_stack.rb +3 -3
- data/lib/new_relic/agent/transaction.rb +141 -118
- data/lib/new_relic/agent/transaction/attributes.rb +161 -0
- data/lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb +4 -4
- data/lib/new_relic/agent/transaction/trace.rb +150 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +190 -0
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +2 -2
- data/lib/new_relic/agent/transaction_event_aggregator.rb +23 -7
- data/lib/new_relic/agent/transaction_sample_builder.rb +37 -62
- data/lib/new_relic/agent/transaction_sampler.rb +29 -66
- data/lib/new_relic/cli/commands/install.rb +2 -2
- data/lib/new_relic/coerce.rb +15 -28
- data/lib/new_relic/json_wrapper.rb +14 -73
- data/lib/new_relic/noticed_error.rb +81 -5
- data/lib/new_relic/rack/browser_monitoring.rb +14 -19
- data/lib/new_relic/rack/developer_mode.rb +68 -14
- data/lib/new_relic/rack/developer_mode/segment_summary.rb +56 -0
- data/lib/new_relic/version.rb +2 -2
- data/newrelic.yml +19 -196
- data/test/agent_helper.rb +42 -36
- data/test/config/newrelic.yml +0 -1
- data/test/environments/rails40/Gemfile +1 -1
- data/test/environments/rails41/Gemfile +1 -1
- data/test/environments/rails42/Gemfile +1 -1
- data/test/fixtures/cross_agent_tests/attribute_configuration.json +35 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +19 -12
- data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +365 -0
- data/test/multiverse/lib/multiverse/suite.rb +5 -1
- data/test/multiverse/suites/active_record/active_record_test.rb +8 -8
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +145 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +8 -0
- data/test/multiverse/suites/agent_only/custom_queue_time_test.rb +5 -1
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +6 -6
- data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +2 -3
- data/test/multiverse/suites/agent_only/synthetics_test.rb +3 -3
- data/test/multiverse/suites/agent_only/testing_app.rb +4 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +9 -7
- data/test/multiverse/suites/curb/Envfile +5 -6
- data/test/multiverse/suites/curb/curb_test.rb +4 -5
- data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -2
- data/test/multiverse/suites/excon/Envfile +11 -4
- data/test/multiverse/suites/excon/excon_test.rb +5 -5
- data/test/multiverse/suites/grape/config/newrelic.yml +1 -0
- data/test/multiverse/suites/grape/grape_test.rb +76 -12
- data/test/multiverse/suites/grape/grape_test_api.rb +16 -0
- data/test/multiverse/suites/high_security/config/newrelic.yml +43 -3
- data/test/multiverse/suites/high_security/high_security_test.rb +165 -9
- data/test/multiverse/suites/httpclient/Envfile +5 -1
- data/test/multiverse/suites/httpclient/httpclient_test.rb +2 -2
- data/test/multiverse/suites/memcached/Envfile +1 -1
- data/test/multiverse/suites/mongo/Envfile +8 -1
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +29 -29
- data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +43 -8
- data/test/multiverse/suites/rack/rack_parameter_filtering_test.rb +13 -3
- data/test/multiverse/suites/rails/Envfile +3 -3
- data/test/multiverse/suites/rails/error_tracing_test.rb +52 -31
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/rails/ignore_test.rb +1 -1
- data/test/multiverse/suites/rails/parameter_capture_test.rb +108 -40
- data/test/multiverse/suites/rails/request_statistics_test.rb +10 -4
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +24 -24
- data/test/multiverse/suites/resque/instrumentation_test.rb +46 -12
- data/test/multiverse/suites/sequel/sequel_extension_test.rb +8 -8
- data/test/multiverse/suites/sequel/sequel_helpers.rb +11 -11
- data/test/multiverse/suites/sequel/sequel_plugin_test.rb +11 -11
- data/test/multiverse/suites/sidekiq/Envfile +1 -4
- data/test/multiverse/suites/sidekiq/after_suite.rb +9 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +49 -16
- data/test/multiverse/suites/sidekiq/test_worker.rb +1 -2
- data/test/multiverse/suites/sinatra/Envfile +1 -1
- data/test/multiverse/suites/sinatra/config/newrelic.yml +1 -0
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +0 -4
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +0 -4
- data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +65 -0
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +0 -11
- data/test/multiverse/suites/typhoeus/Envfile +8 -2
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +4 -4
- data/test/new_relic/agent/agent/connect_test.rb +13 -9
- data/test/new_relic/agent/agent_test.rb +34 -24
- data/test/new_relic/agent/attribute_filter_test.rb +218 -0
- data/test/new_relic/agent/attribute_processing_test.rb +160 -0
- data/test/new_relic/agent/configuration/default_source_test.rb +88 -0
- data/test/new_relic/agent/configuration/manager_test.rb +3 -4
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +3 -1
- data/test/new_relic/agent/configuration/server_source_test.rb +39 -0
- data/test/new_relic/agent/cross_app_monitor_test.rb +6 -30
- data/test/new_relic/agent/cross_app_tracing_test.rb +12 -12
- data/test/new_relic/agent/database/sql_obfuscation_test.rb +39 -65
- data/test/new_relic/agent/datastores/metric_helper_test.rb +36 -0
- data/test/new_relic/agent/encoding_normalizer_test.rb +66 -0
- data/test/new_relic/agent/error_collector_test.rb +181 -34
- data/test/new_relic/agent/hash_extensions_test.rb +34 -0
- data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +20 -23
- data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +12 -12
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +5 -5
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +4 -4
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +21 -11
- data/test/new_relic/agent/javascript_instrumentor_test.rb +69 -45
- data/test/new_relic/agent/pipe_service_test.rb +2 -2
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -1
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +8 -7
- data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
- data/test/new_relic/agent/threading/backtrace_node_test.rb +2 -2
- data/test/new_relic/agent/transaction/attributes_test.rb +276 -0
- data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +10 -10
- data/test/new_relic/agent/transaction/trace_node_test.rb +361 -0
- data/test/new_relic/agent/transaction/trace_test.rb +394 -0
- data/test/new_relic/agent/transaction/xray_sample_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +127 -57
- data/test/new_relic/agent/transaction_sample_builder_test.rb +70 -78
- data/test/new_relic/agent/transaction_sampler_test.rb +76 -185
- data/test/new_relic/agent/transaction_test.rb +283 -135
- data/test/new_relic/agent_test.rb +27 -12
- data/test/new_relic/cli/commands/install_test.rb +27 -0
- data/test/new_relic/coerce_test.rb +0 -59
- data/test/new_relic/data_container_tests.rb +5 -5
- data/test/new_relic/fake_collector.rb +27 -9
- data/test/new_relic/filtering_test_app.rb +2 -1
- data/test/new_relic/http_client_test_cases.rb +16 -16
- data/test/new_relic/json_wrapper_test.rb +0 -54
- data/test/new_relic/marshalling_test_cases.rb +1 -0
- data/test/new_relic/multiverse_helpers.rb +144 -0
- data/test/new_relic/noticed_error_test.rb +112 -9
- data/test/new_relic/rack/browser_monitoring_test.rb +12 -7
- data/test/new_relic/{transaction_analysis → rack/developer_mode}/segment_summary_test.rb +5 -4
- data/test/new_relic/rack/developer_mode_test.rb +17 -3
- data/test/new_relic/rack/error_collector_test.rb +1 -1
- data/test/performance/lib/performance/instrumentation/stackprof.rb +1 -1
- data/test/performance/script/runner +2 -2
- data/test/performance/suites/active_record.rb +3 -3
- data/test/performance/suites/agent_attributes.rb +62 -0
- data/test/performance/suites/rack_middleware.rb +78 -28
- data/test/performance/suites/transaction_tracing.rb +35 -0
- data/test/test_helper.rb +9 -1
- data/ui/helpers/developer_mode_helper.rb +16 -23
- data/ui/views/newrelic/_sample.rhtml +3 -3
- data/ui/views/newrelic/_segment.rhtml +1 -1
- data/ui/views/newrelic/_show_sample_summary.rhtml +1 -1
- data/ui/views/newrelic/show_sample.rhtml +5 -4
- metadata +23 -80
- data/lib/new_relic/agent/transaction/force_persist_sample_buffer.rb +0 -25
- data/lib/new_relic/transaction_analysis.rb +0 -80
- data/lib/new_relic/transaction_analysis/segment_summary.rb +0 -53
- data/lib/new_relic/transaction_sample.rb +0 -207
- data/lib/new_relic/transaction_sample/composite_segment.rb +0 -31
- data/lib/new_relic/transaction_sample/fake_segment.rb +0 -13
- data/lib/new_relic/transaction_sample/segment.rb +0 -197
- data/lib/new_relic/transaction_sample/summary_segment.rb +0 -25
- data/lib/new_relic/url_rule.rb +0 -18
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.obfuscated +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.obfuscated +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_double_quoted_string.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/README.md +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.sql +0 -3
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.sql +0 -1
- data/test/new_relic/agent/error_collector/notice_error_test.rb +0 -261
- data/test/new_relic/agent/transaction/force_persist_sample_buffer_test.rb +0 -52
- data/test/new_relic/transaction_analysis_test.rb +0 -125
- data/test/new_relic/transaction_sample/composite_segment_test.rb +0 -38
- data/test/new_relic/transaction_sample/fake_segment_test.rb +0 -18
- data/test/new_relic/transaction_sample/segment_test.rb +0 -361
- data/test/new_relic/transaction_sample/summary_segment_test.rb +0 -34
- data/test/new_relic/transaction_sample_subtest_test.rb +0 -41
- data/test/new_relic/transaction_sample_test.rb +0 -361
data/test/config/newrelic.yml
CHANGED
@@ -345,5 +345,40 @@
|
|
345
345
|
["transaction_events", "transaction_tracer", "error_collector","browser_monitoring"],
|
346
346
|
"expected_destinations":
|
347
347
|
["transaction_events", "transaction_tracer", "error_collector","browser_monitoring"]
|
348
|
+
},
|
349
|
+
|
350
|
+
{
|
351
|
+
"testname":"include with attributes globally disabled",
|
352
|
+
"config":
|
353
|
+
{
|
354
|
+
"attributes.enabled":false,
|
355
|
+
"transaction_events.attributes.include":["alpha"],
|
356
|
+
"transaction_tracer.attributes.include":["alpha"],
|
357
|
+
"error_collector.attributes.include":["alpha"],
|
358
|
+
"browser_monitoring.attributes.include":["alpha"]
|
359
|
+
},
|
360
|
+
"input_key":"alpha",
|
361
|
+
"input_default_destinations":
|
362
|
+
["transaction_events", "transaction_tracer", "error_collector", "browser_monitoring"],
|
363
|
+
"expected_destinations":
|
364
|
+
[]
|
365
|
+
},
|
366
|
+
|
367
|
+
{
|
368
|
+
"testname":"include with disabled destinations",
|
369
|
+
"config":
|
370
|
+
{
|
371
|
+
"transaction_events.attributes.include":["alpha"],
|
372
|
+
"transaction_events.attributes.enabled":false,
|
373
|
+
"transaction_tracer.attributes.include":["alpha"],
|
374
|
+
"error_collector.attributes.include":["alpha"],
|
375
|
+
"browser_monitoring.attributes.enabled":true,
|
376
|
+
"browser_monitoring.attributes.include":["alpha"]
|
377
|
+
},
|
378
|
+
"input_key":"alpha",
|
379
|
+
"input_default_destinations":
|
380
|
+
["transaction_events", "transaction_tracer", "error_collector", "browser_monitoring"],
|
381
|
+
"expected_destinations":
|
382
|
+
["transaction_tracer", "error_collector", "browser_monitoring"]
|
348
383
|
}
|
349
384
|
]
|
@@ -2,20 +2,27 @@ These test cases cover obfuscation (more properly, masking) of literal values
|
|
2
2
|
from SQL statements captured by agents. SQL statements may be captured and
|
3
3
|
attached to transaction trace nodes, or to slow SQL traces.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
query, and begin with a `#` symbol.
|
5
|
+
`sql_obfuscation.json` contains an array of test cases. The inputs for each
|
6
|
+
test case are in the `sql` property of each object. Each test case also has an
|
7
|
+
`obfuscated` property which is an array containing at least one valid output.
|
9
8
|
|
10
|
-
Test cases
|
11
|
-
|
12
|
-
|
13
|
-
than MySQL (most notably,
|
14
|
-
|
9
|
+
Test cases also have a `dialects` property, which is an array of strings which
|
10
|
+
specify which sql dialects the test should apply to. Currently the options are
|
11
|
+
`mysql`, `postgres`, or `all` This is relevant because PostgreSQL uses
|
12
|
+
different identifier and string quoting rules than MySQL (most notably,
|
13
|
+
double-quoted string literals are not allowed in PostgreSQL, where
|
14
|
+
double-quotes are instead used around identifiers).
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
Test cases may also contain the following properties:
|
17
|
+
* `malformed`: (boolean) tests who's SQL queries are not valid SQL in any
|
18
|
+
quoting mode. Some agents may choose to attempt to obfuscate these cases,
|
19
|
+
and others may instead just replace the query entirely with a placeholder
|
20
|
+
message.
|
21
|
+
* `pathological`: (boolean) tests which are designed specifically to break
|
22
|
+
specific methods of obfuscation, or contain patterns that are known to be
|
23
|
+
difficult to handle correctly
|
24
|
+
* `comments`: an array of strings that could be usefult for understanding
|
25
|
+
the test.
|
19
26
|
|
20
27
|
The following database documentation may be helpful in understanding these test
|
21
28
|
cases:
|
@@ -0,0 +1,365 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"name": "back_quoted_identifiers.mysql",
|
4
|
+
"obfuscated": [
|
5
|
+
"SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = ? AND c3=? LIMIT ?"
|
6
|
+
],
|
7
|
+
"dialects": [
|
8
|
+
"mysql"
|
9
|
+
],
|
10
|
+
"sql": "SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = 'value' AND c3=\"othervalue\" LIMIT ?"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"name": "comment_delimiters_in_double_quoted_strings",
|
14
|
+
"obfuscated": [
|
15
|
+
"SELECT * FROM t WHERE foo=? AND baz=?"
|
16
|
+
],
|
17
|
+
"dialects": [
|
18
|
+
"mysql"
|
19
|
+
],
|
20
|
+
"sql": "SELECT * FROM t WHERE foo=\"bar/*\" AND baz=\"whatever */qux\""
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"name": "comment_delimiters_in_single_quoted_strings",
|
24
|
+
"obfuscated": [
|
25
|
+
"SELECT * FROM t WHERE foo=? AND baz=?"
|
26
|
+
],
|
27
|
+
"dialects": [
|
28
|
+
"mysql",
|
29
|
+
"postgres"
|
30
|
+
],
|
31
|
+
"sql": "SELECT * FROM t WHERE foo='bar/*' AND baz='whatever */qux'"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"name": "double_quoted_identifiers.postgres",
|
35
|
+
"obfuscated": [
|
36
|
+
"SELECT \"t001\".\"c2\" FROM \"t001\" WHERE \"t001\".\"c2\" = ? AND c3=? LIMIT ?"
|
37
|
+
],
|
38
|
+
"dialects": [
|
39
|
+
"postgres"
|
40
|
+
],
|
41
|
+
"sql": "SELECT \"t001\".\"c2\" FROM \"t001\" WHERE \"t001\".\"c2\" = 'value' AND c3=1234 LIMIT 1"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"name": "end_of_line_comment_in_double_quoted_string",
|
45
|
+
"obfuscated": [
|
46
|
+
"SELECT * FROM t WHERE foo=? AND\n baz=?"
|
47
|
+
],
|
48
|
+
"dialects": [
|
49
|
+
"mysql"
|
50
|
+
],
|
51
|
+
"sql": "SELECT * FROM t WHERE foo=\"bar--\" AND\n baz=\"qux--\""
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"name": "end_of_line_comment_in_single_quoted_string",
|
55
|
+
"obfuscated": [
|
56
|
+
"SELECT * FROM t WHERE foo=? AND\n baz=?"
|
57
|
+
],
|
58
|
+
"dialects": [
|
59
|
+
"mysql",
|
60
|
+
"postgres"
|
61
|
+
],
|
62
|
+
"sql": "SELECT * FROM t WHERE foo='bar--' AND\n baz='qux--'"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"name": "end_of_query_comment_cstyle",
|
66
|
+
"obfuscated": [
|
67
|
+
"SELECT * FROM foo WHERE bar=? ?"
|
68
|
+
],
|
69
|
+
"dialects": [
|
70
|
+
"mysql",
|
71
|
+
"postgres"
|
72
|
+
],
|
73
|
+
"sql": "SELECT * FROM foo WHERE bar='baz' /* Hide Me */"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"name": "end_of_query_comment_doubledash",
|
77
|
+
"obfuscated": [
|
78
|
+
"SELECT * FROM foobar WHERE password=?\n?"
|
79
|
+
],
|
80
|
+
"dialects": [
|
81
|
+
"mysql",
|
82
|
+
"postgres"
|
83
|
+
],
|
84
|
+
"sql": "SELECT * FROM foobar WHERE password='hunter2'\n-- No peeking!"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"name": "end_of_query_comment_hash",
|
88
|
+
"obfuscated": [
|
89
|
+
"SELECT foo, bar FROM baz WHERE password=? ?"
|
90
|
+
],
|
91
|
+
"dialects": [
|
92
|
+
"mysql",
|
93
|
+
"postgres"
|
94
|
+
],
|
95
|
+
"sql": "SELECT foo, bar FROM baz WHERE password='hunter2' # Secret"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"name": "escape_string_constants.postgres",
|
99
|
+
"obfuscated": [
|
100
|
+
"SELECT \"col1\", \"col2\" from \"table\" WHERE \"col3\"=E? AND country=e?"
|
101
|
+
],
|
102
|
+
"dialects": [
|
103
|
+
"postgres"
|
104
|
+
],
|
105
|
+
"sql": "SELECT \"col1\", \"col2\" from \"table\" WHERE \"col3\"=E'foo\\'bar\\\\baz' AND country=e'foo\\'bar\\\\baz'",
|
106
|
+
"comments": [
|
107
|
+
"PostgreSQL supports an alternate string quoting mode where backslash escape",
|
108
|
+
"sequences are interpreted.",
|
109
|
+
"See: http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE"
|
110
|
+
]
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"name": "multiple_literal_types.mysql",
|
114
|
+
"obfuscated": [
|
115
|
+
"INSERT INTO `X` values(?,?, ? , ?, ?)"
|
116
|
+
],
|
117
|
+
"dialects": [
|
118
|
+
"mysql"
|
119
|
+
],
|
120
|
+
"sql": "INSERT INTO `X` values(\"test\",0, 1 , 2, 'test')"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"name": "numbers_in_identifiers",
|
124
|
+
"obfuscated": [
|
125
|
+
"SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value=?"
|
126
|
+
],
|
127
|
+
"dialects": [
|
128
|
+
"mysql",
|
129
|
+
"postgres"
|
130
|
+
],
|
131
|
+
"sql": "SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value='nothing'"
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"name": "numeric_literals",
|
135
|
+
"obfuscated": [
|
136
|
+
"INSERT INTO X VALUES(?, ?, ?.?, ?+?)"
|
137
|
+
],
|
138
|
+
"dialects": [
|
139
|
+
"mysql",
|
140
|
+
"postgres"
|
141
|
+
],
|
142
|
+
"sql": "INSERT INTO X VALUES(1, 23456, 123.456, 99+100)"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"name": "string_double_quoted.mysql",
|
146
|
+
"obfuscated": [
|
147
|
+
"SELECT * FROM table WHERE name=? AND value=?"
|
148
|
+
],
|
149
|
+
"dialects": [
|
150
|
+
"mysql"
|
151
|
+
],
|
152
|
+
"sql": "SELECT * FROM table WHERE name=\"foo\" AND value=\"don't\""
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"name": "string_single_quoted",
|
156
|
+
"obfuscated": [
|
157
|
+
"SELECT * FROM table WHERE name=? AND value = ?"
|
158
|
+
],
|
159
|
+
"dialects": [
|
160
|
+
"mysql",
|
161
|
+
"postgres"
|
162
|
+
],
|
163
|
+
"sql": "SELECT * FROM table WHERE name='foo' AND value = 'bar'"
|
164
|
+
},
|
165
|
+
{
|
166
|
+
"name": "string_with_backslash_and_twin_single_quotes",
|
167
|
+
"obfuscated": [
|
168
|
+
"SELECT * FROM table WHERE col=?"
|
169
|
+
],
|
170
|
+
"dialects": [
|
171
|
+
"mysql",
|
172
|
+
"postgres"
|
173
|
+
],
|
174
|
+
"sql": "SELECT * FROM table WHERE col='foo\\''bar'",
|
175
|
+
"comments": [
|
176
|
+
"If backslashes are being ignored in single-quoted strings",
|
177
|
+
"(standard_conforming_strings=on in PostgreSQL, or NO_BACKSLASH_ESCAPES is on",
|
178
|
+
"in MySQL), then this is valid SQL."
|
179
|
+
]
|
180
|
+
},
|
181
|
+
{
|
182
|
+
"name": "string_with_embedded_double_quote",
|
183
|
+
"obfuscated": [
|
184
|
+
"SELECT * FROM table WHERE col1=? AND col2=?"
|
185
|
+
],
|
186
|
+
"dialects": [
|
187
|
+
"mysql",
|
188
|
+
"postgres"
|
189
|
+
],
|
190
|
+
"sql": "SELECT * FROM table WHERE col1='foo\"bar' AND col2='what\"ever'"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"name": "string_with_embedded_newline",
|
194
|
+
"obfuscated": [
|
195
|
+
"select * from accounts where accounts.name != ? order by accounts.name"
|
196
|
+
],
|
197
|
+
"dialects": [
|
198
|
+
"mysql",
|
199
|
+
"postgres"
|
200
|
+
],
|
201
|
+
"sql": "select * from accounts where accounts.name != 'dude \n newline' order by accounts.name"
|
202
|
+
},
|
203
|
+
{
|
204
|
+
"name": "string_with_embedded_single_quote.mysql",
|
205
|
+
"obfuscated": [
|
206
|
+
"SELECT * FROM table WHERE col1=? AND col2=?"
|
207
|
+
],
|
208
|
+
"dialects": [
|
209
|
+
"mysql"
|
210
|
+
],
|
211
|
+
"sql": "SELECT * FROM table WHERE col1=\"don't\" AND col2=\"won't\""
|
212
|
+
},
|
213
|
+
{
|
214
|
+
"name": "string_with_escaped_quotes.mysql",
|
215
|
+
"obfuscated": [
|
216
|
+
"INSERT INTO X values(?, ?,?, ? , ?, ?, ?)"
|
217
|
+
],
|
218
|
+
"dialects": [
|
219
|
+
"mysql"
|
220
|
+
],
|
221
|
+
"sql": "INSERT INTO X values('', 'jim''s ssn',0, 1 , 'jim''s son''s son', \"\"\"jim''s\"\" hat\", \"\\\"jim''s secret\\\"\")"
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"name": "string_with_trailing_backslash",
|
225
|
+
"obfuscated": [
|
226
|
+
"SELECT * FROM table WHERE name=? AND color=?"
|
227
|
+
],
|
228
|
+
"dialects": [
|
229
|
+
"mysql",
|
230
|
+
"postgres"
|
231
|
+
],
|
232
|
+
"sql": "SELECT * FROM table WHERE name='foo\\' AND color='blue'",
|
233
|
+
"comments": [
|
234
|
+
"If backslashes are being ignored in single-quoted strings",
|
235
|
+
"(standard_conforming_strings=on in PostgreSQL, or NO_BACKSLASH_ESCAPES is on",
|
236
|
+
"in MySQL), then this is valid SQL."
|
237
|
+
]
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"name": "string_with_trailing_escaped_backslash.mysql",
|
241
|
+
"obfuscated": [
|
242
|
+
"SELECT * FROM table WHERE foo=?"
|
243
|
+
],
|
244
|
+
"dialects": [
|
245
|
+
"mysql"
|
246
|
+
],
|
247
|
+
"sql": "SELECT * FROM table WHERE foo=\"this string ends with a backslash\\\\\""
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"name": "string_with_trailing_escaped_backslash_single_quoted",
|
251
|
+
"obfuscated": [
|
252
|
+
"SELECT * FROM table WHERE foo=?"
|
253
|
+
],
|
254
|
+
"dialects": [
|
255
|
+
"mysql",
|
256
|
+
"postgres"
|
257
|
+
],
|
258
|
+
"sql": "SELECT * FROM table WHERE foo='this string ends with a backslash\\\\'"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
"name": "string_with_trailing_escaped_quote",
|
262
|
+
"obfuscated": [
|
263
|
+
"SELECT * FROM table WHERE name=? AND color=?"
|
264
|
+
],
|
265
|
+
"dialects": [
|
266
|
+
"mysql",
|
267
|
+
"postgres"
|
268
|
+
],
|
269
|
+
"sql": "SELECT * FROM table WHERE name='foo\\'' AND color='blue'"
|
270
|
+
},
|
271
|
+
{
|
272
|
+
"name": "string_with_twin_single_quotes",
|
273
|
+
"obfuscated": [
|
274
|
+
"INSERT INTO X values(?, ?,?, ? , ?)"
|
275
|
+
],
|
276
|
+
"dialects": [
|
277
|
+
"mysql",
|
278
|
+
"postgres"
|
279
|
+
],
|
280
|
+
"sql": "INSERT INTO X values('', 'a''b c',0, 1 , 'd''e f''s h')"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"name": "pathological/end_of_line_comments_with_quotes",
|
284
|
+
"obfuscated": [
|
285
|
+
"SELECT * FROM t WHERE ?"
|
286
|
+
],
|
287
|
+
"dialects": [
|
288
|
+
"mysql",
|
289
|
+
"postgres"
|
290
|
+
],
|
291
|
+
"sql": "SELECT * FROM t WHERE -- '\n bar='baz' -- '",
|
292
|
+
"pathological": true
|
293
|
+
},
|
294
|
+
{
|
295
|
+
"name": "pathological/mixed_comments_and_quotes",
|
296
|
+
"obfuscated": [
|
297
|
+
"SELECT * FROM t WHERE ?"
|
298
|
+
],
|
299
|
+
"dialects": [
|
300
|
+
"mysql",
|
301
|
+
"postgres"
|
302
|
+
],
|
303
|
+
"sql": "SELECT * FROM t WHERE /* ' */ \n bar='baz' -- '",
|
304
|
+
"pathological": true
|
305
|
+
},
|
306
|
+
{
|
307
|
+
"name": "pathological/mixed_quotes_comments_and_newlines",
|
308
|
+
"obfuscated": [
|
309
|
+
"SELECT * FROM t WHERE ?"
|
310
|
+
],
|
311
|
+
"dialects": [
|
312
|
+
"mysql",
|
313
|
+
"postgres"
|
314
|
+
],
|
315
|
+
"sql": "SELECT * FROM t WHERE -- '\n /* ' */ c2='xxx' /* ' */\n c='x\n xx' -- '",
|
316
|
+
"pathological": true
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"name": "pathological/mixed_quotes_end_of_line_comments",
|
320
|
+
"obfuscated": [
|
321
|
+
"SELECT * FROM t WHERE ?"
|
322
|
+
],
|
323
|
+
"dialects": [
|
324
|
+
"mysql",
|
325
|
+
"postgres"
|
326
|
+
],
|
327
|
+
"sql": "SELECT * FROM t WHERE -- '\n c='x\n xx' -- '",
|
328
|
+
"pathological": true
|
329
|
+
},
|
330
|
+
{
|
331
|
+
"name": "pathological/quote_delimiters_in_comments",
|
332
|
+
"obfuscated": [
|
333
|
+
"SELECT * FROM foo WHERE col=? AND ?"
|
334
|
+
],
|
335
|
+
"dialects": [
|
336
|
+
"mysql",
|
337
|
+
"postgres"
|
338
|
+
],
|
339
|
+
"sql": "SELECT * FROM foo WHERE col='value1' AND /* don't */ col2='value1' /* won't */",
|
340
|
+
"pathological": true
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"name": "malformed/unterminated_double_quoted_string.mysql",
|
344
|
+
"sql": "SELECT * FROM table WHERE foo='bar' AND baz=\"nothing to see here'",
|
345
|
+
"dialects": [
|
346
|
+
"mysql"
|
347
|
+
],
|
348
|
+
"obfuscated": [
|
349
|
+
"?"
|
350
|
+
],
|
351
|
+
"malformed": true
|
352
|
+
},
|
353
|
+
{
|
354
|
+
"name": "malformed/unterminated_single_quoted_string",
|
355
|
+
"sql": "SELECT * FROM table WHERE foo='bar' AND baz='nothing to see here",
|
356
|
+
"dialects": [
|
357
|
+
"mysql",
|
358
|
+
"postgres"
|
359
|
+
],
|
360
|
+
"obfuscated": [
|
361
|
+
"?"
|
362
|
+
],
|
363
|
+
"malformed": true
|
364
|
+
}
|
365
|
+
]
|