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.
Files changed (269) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/.yardopts +2 -0
  4. data/CHANGELOG +39 -4
  5. data/README.md +4 -2
  6. data/lib/new_relic/agent.rb +229 -214
  7. data/lib/new_relic/agent/agent.rb +23 -12
  8. data/lib/new_relic/agent/attribute_filter.rb +242 -0
  9. data/lib/new_relic/agent/attribute_processing.rb +62 -0
  10. data/lib/new_relic/agent/commands/xray_session_collection.rb +4 -1
  11. data/lib/new_relic/agent/configuration/default_source.rb +284 -30
  12. data/lib/new_relic/agent/configuration/high_security_source.rb +0 -8
  13. data/lib/new_relic/agent/configuration/manager.rb +1 -1
  14. data/lib/new_relic/agent/configuration/server_source.rb +86 -31
  15. data/lib/new_relic/agent/configuration/yaml_source.rb +1 -1
  16. data/lib/new_relic/agent/cross_app_monitor.rb +8 -13
  17. data/lib/new_relic/agent/cross_app_tracing.rb +15 -15
  18. data/lib/new_relic/agent/custom_event_aggregator.rb +6 -2
  19. data/lib/new_relic/agent/database.rb +15 -2
  20. data/lib/new_relic/agent/datastores.rb +52 -38
  21. data/lib/new_relic/agent/datastores/metric_helper.rb +2 -1
  22. data/lib/new_relic/agent/encoding_normalizer.rb +82 -0
  23. data/lib/new_relic/agent/error_collector.rb +125 -169
  24. data/lib/new_relic/agent/hash_extensions.rb +26 -0
  25. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +13 -11
  26. data/lib/new_relic/agent/http_clients/uri_util.rb +9 -0
  27. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -3
  28. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
  29. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -1
  30. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +12 -5
  31. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +6 -7
  32. data/lib/new_relic/agent/instrumentation/curb.rb +6 -6
  33. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +4 -4
  34. data/lib/new_relic/agent/instrumentation/grape.rb +4 -3
  35. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +6 -3
  36. data/lib/new_relic/agent/instrumentation/rails/errors.rb +9 -3
  37. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -1
  38. data/lib/new_relic/agent/instrumentation/rails3/errors.rb +9 -7
  39. data/lib/new_relic/agent/instrumentation/rails4/errors.rb +8 -6
  40. data/lib/new_relic/agent/instrumentation/resque.rb +2 -3
  41. data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -3
  42. data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
  43. data/lib/new_relic/agent/javascript_instrumentor.rb +24 -16
  44. data/lib/new_relic/agent/parameter_filtering.rb +8 -1
  45. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +2 -2
  46. data/lib/new_relic/agent/sql_sampler.rb +1 -0
  47. data/lib/new_relic/agent/stats.rb +0 -4
  48. data/lib/new_relic/agent/stats_engine/metric_stats.rb +5 -3
  49. data/lib/new_relic/agent/stats_engine/stats_hash.rb +4 -0
  50. data/lib/new_relic/agent/supported_versions.rb +2 -2
  51. data/lib/new_relic/agent/traced_method_stack.rb +3 -3
  52. data/lib/new_relic/agent/transaction.rb +141 -118
  53. data/lib/new_relic/agent/transaction/attributes.rb +161 -0
  54. data/lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb +4 -4
  55. data/lib/new_relic/agent/transaction/trace.rb +150 -0
  56. data/lib/new_relic/agent/transaction/trace_node.rb +190 -0
  57. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +2 -2
  58. data/lib/new_relic/agent/transaction_event_aggregator.rb +23 -7
  59. data/lib/new_relic/agent/transaction_sample_builder.rb +37 -62
  60. data/lib/new_relic/agent/transaction_sampler.rb +29 -66
  61. data/lib/new_relic/cli/commands/install.rb +2 -2
  62. data/lib/new_relic/coerce.rb +15 -28
  63. data/lib/new_relic/json_wrapper.rb +14 -73
  64. data/lib/new_relic/noticed_error.rb +81 -5
  65. data/lib/new_relic/rack/browser_monitoring.rb +14 -19
  66. data/lib/new_relic/rack/developer_mode.rb +68 -14
  67. data/lib/new_relic/rack/developer_mode/segment_summary.rb +56 -0
  68. data/lib/new_relic/version.rb +2 -2
  69. data/newrelic.yml +19 -196
  70. data/test/agent_helper.rb +42 -36
  71. data/test/config/newrelic.yml +0 -1
  72. data/test/environments/rails40/Gemfile +1 -1
  73. data/test/environments/rails41/Gemfile +1 -1
  74. data/test/environments/rails42/Gemfile +1 -1
  75. data/test/fixtures/cross_agent_tests/attribute_configuration.json +35 -0
  76. data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +19 -12
  77. data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +365 -0
  78. data/test/multiverse/lib/multiverse/suite.rb +5 -1
  79. data/test/multiverse/suites/active_record/active_record_test.rb +8 -8
  80. data/test/multiverse/suites/agent_only/agent_attributes_test.rb +145 -0
  81. data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +8 -0
  82. data/test/multiverse/suites/agent_only/custom_queue_time_test.rb +5 -1
  83. data/test/multiverse/suites/agent_only/encoding_handling_test.rb +6 -6
  84. data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -1
  85. data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +2 -3
  86. data/test/multiverse/suites/agent_only/synthetics_test.rb +3 -3
  87. data/test/multiverse/suites/agent_only/testing_app.rb +4 -0
  88. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +1 -1
  89. data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +9 -7
  90. data/test/multiverse/suites/curb/Envfile +5 -6
  91. data/test/multiverse/suites/curb/curb_test.rb +4 -5
  92. data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -2
  93. data/test/multiverse/suites/excon/Envfile +11 -4
  94. data/test/multiverse/suites/excon/excon_test.rb +5 -5
  95. data/test/multiverse/suites/grape/config/newrelic.yml +1 -0
  96. data/test/multiverse/suites/grape/grape_test.rb +76 -12
  97. data/test/multiverse/suites/grape/grape_test_api.rb +16 -0
  98. data/test/multiverse/suites/high_security/config/newrelic.yml +43 -3
  99. data/test/multiverse/suites/high_security/high_security_test.rb +165 -9
  100. data/test/multiverse/suites/httpclient/Envfile +5 -1
  101. data/test/multiverse/suites/httpclient/httpclient_test.rb +2 -2
  102. data/test/multiverse/suites/memcached/Envfile +1 -1
  103. data/test/multiverse/suites/mongo/Envfile +8 -1
  104. data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +29 -29
  105. data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +43 -8
  106. data/test/multiverse/suites/rack/rack_parameter_filtering_test.rb +13 -3
  107. data/test/multiverse/suites/rails/Envfile +3 -3
  108. data/test/multiverse/suites/rails/error_tracing_test.rb +52 -31
  109. data/test/multiverse/suites/rails/gc_instrumentation_test.rb +1 -1
  110. data/test/multiverse/suites/rails/ignore_test.rb +1 -1
  111. data/test/multiverse/suites/rails/parameter_capture_test.rb +108 -40
  112. data/test/multiverse/suites/rails/request_statistics_test.rb +10 -4
  113. data/test/multiverse/suites/rails/view_instrumentation_test.rb +24 -24
  114. data/test/multiverse/suites/resque/instrumentation_test.rb +46 -12
  115. data/test/multiverse/suites/sequel/sequel_extension_test.rb +8 -8
  116. data/test/multiverse/suites/sequel/sequel_helpers.rb +11 -11
  117. data/test/multiverse/suites/sequel/sequel_plugin_test.rb +11 -11
  118. data/test/multiverse/suites/sidekiq/Envfile +1 -4
  119. data/test/multiverse/suites/sidekiq/after_suite.rb +9 -0
  120. data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +49 -16
  121. data/test/multiverse/suites/sidekiq/test_worker.rb +1 -2
  122. data/test/multiverse/suites/sinatra/Envfile +1 -1
  123. data/test/multiverse/suites/sinatra/config/newrelic.yml +1 -0
  124. data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +0 -4
  125. data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +0 -4
  126. data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +65 -0
  127. data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +0 -11
  128. data/test/multiverse/suites/typhoeus/Envfile +8 -2
  129. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +4 -4
  130. data/test/new_relic/agent/agent/connect_test.rb +13 -9
  131. data/test/new_relic/agent/agent_test.rb +34 -24
  132. data/test/new_relic/agent/attribute_filter_test.rb +218 -0
  133. data/test/new_relic/agent/attribute_processing_test.rb +160 -0
  134. data/test/new_relic/agent/configuration/default_source_test.rb +88 -0
  135. data/test/new_relic/agent/configuration/manager_test.rb +3 -4
  136. data/test/new_relic/agent/configuration/orphan_configuration_test.rb +3 -1
  137. data/test/new_relic/agent/configuration/server_source_test.rb +39 -0
  138. data/test/new_relic/agent/cross_app_monitor_test.rb +6 -30
  139. data/test/new_relic/agent/cross_app_tracing_test.rb +12 -12
  140. data/test/new_relic/agent/database/sql_obfuscation_test.rb +39 -65
  141. data/test/new_relic/agent/datastores/metric_helper_test.rb +36 -0
  142. data/test/new_relic/agent/encoding_normalizer_test.rb +66 -0
  143. data/test/new_relic/agent/error_collector_test.rb +181 -34
  144. data/test/new_relic/agent/hash_extensions_test.rb +34 -0
  145. data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +20 -23
  146. data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +12 -12
  147. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +5 -5
  148. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +4 -4
  149. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +21 -11
  150. data/test/new_relic/agent/javascript_instrumentor_test.rb +69 -45
  151. data/test/new_relic/agent/pipe_service_test.rb +2 -2
  152. data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -1
  153. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +8 -7
  154. data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
  155. data/test/new_relic/agent/threading/backtrace_node_test.rb +2 -2
  156. data/test/new_relic/agent/transaction/attributes_test.rb +276 -0
  157. data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +10 -10
  158. data/test/new_relic/agent/transaction/trace_node_test.rb +361 -0
  159. data/test/new_relic/agent/transaction/trace_test.rb +394 -0
  160. data/test/new_relic/agent/transaction/xray_sample_buffer_test.rb +1 -1
  161. data/test/new_relic/agent/transaction_event_aggregator_test.rb +127 -57
  162. data/test/new_relic/agent/transaction_sample_builder_test.rb +70 -78
  163. data/test/new_relic/agent/transaction_sampler_test.rb +76 -185
  164. data/test/new_relic/agent/transaction_test.rb +283 -135
  165. data/test/new_relic/agent_test.rb +27 -12
  166. data/test/new_relic/cli/commands/install_test.rb +27 -0
  167. data/test/new_relic/coerce_test.rb +0 -59
  168. data/test/new_relic/data_container_tests.rb +5 -5
  169. data/test/new_relic/fake_collector.rb +27 -9
  170. data/test/new_relic/filtering_test_app.rb +2 -1
  171. data/test/new_relic/http_client_test_cases.rb +16 -16
  172. data/test/new_relic/json_wrapper_test.rb +0 -54
  173. data/test/new_relic/marshalling_test_cases.rb +1 -0
  174. data/test/new_relic/multiverse_helpers.rb +144 -0
  175. data/test/new_relic/noticed_error_test.rb +112 -9
  176. data/test/new_relic/rack/browser_monitoring_test.rb +12 -7
  177. data/test/new_relic/{transaction_analysis → rack/developer_mode}/segment_summary_test.rb +5 -4
  178. data/test/new_relic/rack/developer_mode_test.rb +17 -3
  179. data/test/new_relic/rack/error_collector_test.rb +1 -1
  180. data/test/performance/lib/performance/instrumentation/stackprof.rb +1 -1
  181. data/test/performance/script/runner +2 -2
  182. data/test/performance/suites/active_record.rb +3 -3
  183. data/test/performance/suites/agent_attributes.rb +62 -0
  184. data/test/performance/suites/rack_middleware.rb +78 -28
  185. data/test/performance/suites/transaction_tracing.rb +35 -0
  186. data/test/test_helper.rb +9 -1
  187. data/ui/helpers/developer_mode_helper.rb +16 -23
  188. data/ui/views/newrelic/_sample.rhtml +3 -3
  189. data/ui/views/newrelic/_segment.rhtml +1 -1
  190. data/ui/views/newrelic/_show_sample_summary.rhtml +1 -1
  191. data/ui/views/newrelic/show_sample.rhtml +5 -4
  192. metadata +23 -80
  193. data/lib/new_relic/agent/transaction/force_persist_sample_buffer.rb +0 -25
  194. data/lib/new_relic/transaction_analysis.rb +0 -80
  195. data/lib/new_relic/transaction_analysis/segment_summary.rb +0 -53
  196. data/lib/new_relic/transaction_sample.rb +0 -207
  197. data/lib/new_relic/transaction_sample/composite_segment.rb +0 -31
  198. data/lib/new_relic/transaction_sample/fake_segment.rb +0 -13
  199. data/lib/new_relic/transaction_sample/segment.rb +0 -197
  200. data/lib/new_relic/transaction_sample/summary_segment.rb +0 -25
  201. data/lib/new_relic/url_rule.rb +0 -18
  202. data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.obfuscated +0 -1
  203. data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.sql +0 -1
  204. data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.obfuscated +0 -1
  205. data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.sql +0 -1
  206. data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.obfuscated +0 -1
  207. data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.sql +0 -1
  208. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.obfuscated +0 -2
  209. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.sql +0 -2
  210. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.obfuscated +0 -1
  211. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.sql +0 -1
  212. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.obfuscated +0 -2
  213. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.sql +0 -2
  214. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.obfuscated +0 -1
  215. data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.sql +0 -1
  216. data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.obfuscated +0 -1
  217. data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.sql +0 -4
  218. data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_double_quoted_string.mysql.sql +0 -1
  219. data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql +0 -1
  220. data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.obfuscated +0 -1
  221. data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.sql +0 -1
  222. data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.obfuscated +0 -1
  223. data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.sql +0 -1
  224. data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.obfuscated +0 -1
  225. data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.sql +0 -1
  226. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/README.md +0 -4
  227. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.obfuscated +0 -1
  228. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.sql +0 -2
  229. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.obfuscated +0 -1
  230. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.sql +0 -2
  231. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.obfuscated +0 -1
  232. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.sql +0 -4
  233. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.obfuscated +0 -1
  234. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.sql +0 -3
  235. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.obfuscated +0 -1
  236. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.sql +0 -1
  237. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.obfuscated +0 -1
  238. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.sql +0 -1
  239. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.obfuscated +0 -1
  240. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.sql +0 -1
  241. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.obfuscated +0 -1
  242. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.sql +0 -4
  243. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.obfuscated +0 -1
  244. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.sql +0 -1
  245. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.obfuscated +0 -1
  246. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.sql +0 -2
  247. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.obfuscated +0 -1
  248. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.sql +0 -1
  249. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.obfuscated +0 -1
  250. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.sql +0 -1
  251. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.obfuscated +0 -1
  252. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.sql +0 -4
  253. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.obfuscated +0 -1
  254. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.sql +0 -1
  255. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.obfuscated +0 -1
  256. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.sql +0 -1
  257. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.obfuscated +0 -1
  258. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.sql +0 -1
  259. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated +0 -1
  260. data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.sql +0 -1
  261. data/test/new_relic/agent/error_collector/notice_error_test.rb +0 -261
  262. data/test/new_relic/agent/transaction/force_persist_sample_buffer_test.rb +0 -52
  263. data/test/new_relic/transaction_analysis_test.rb +0 -125
  264. data/test/new_relic/transaction_sample/composite_segment_test.rb +0 -38
  265. data/test/new_relic/transaction_sample/fake_segment_test.rb +0 -18
  266. data/test/new_relic/transaction_sample/segment_test.rb +0 -361
  267. data/test/new_relic/transaction_sample/summary_segment_test.rb +0 -34
  268. data/test/new_relic/transaction_sample_subtest_test.rb +0 -41
  269. data/test/new_relic/transaction_sample_test.rb +0 -361
@@ -9,7 +9,6 @@ test:
9
9
  host: localhost
10
10
  port: 3000
11
11
  log_level: info
12
- capture_params: true
13
12
  agent_enabled: false
14
13
  monitor_mode: false
15
14
  developer_mode: true
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
 
5
- gem 'rails', '~>4.0.11'
5
+ gem 'rails', '~>4.0.13'
6
6
 
7
7
  # Do not automatically require minitest, since this will break with rbx-2.2.5.
8
8
  # rbx-2.2.5 helpfully bundles minitest-5.3.0.
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
 
5
- gem 'rails', '~>4.1.7'
5
+ gem 'rails', '~>4.1.10'
6
6
 
7
7
  gem 'minitest', '5.2.3'
8
8
  gem 'mocha', :require => false
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
 
5
- gem 'rails', '~>4.2.0'
5
+ gem 'rails', '~>4.2.1'
6
6
 
7
7
  gem 'minitest', '5.2.3'
8
8
  gem 'mocha', :require => false
@@ -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
- 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.
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 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).
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
- 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.
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
+ ]