newrelic_rpm 9.14.0 → 9.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +101 -5
  3. data/CONTRIBUTING.md +2 -2
  4. data/lib/boot/strap.rb +4 -3
  5. data/lib/new_relic/agent/agent.rb +4 -0
  6. data/lib/new_relic/agent/agent_helpers/connect.rb +3 -0
  7. data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -0
  8. data/lib/new_relic/agent/agent_helpers/shutdown.rb +3 -0
  9. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +1 -0
  10. data/lib/new_relic/agent/agent_helpers/startup.rb +7 -0
  11. data/lib/new_relic/agent/aws.rb +6 -0
  12. data/lib/new_relic/agent/configuration/default_source.rb +258 -35
  13. data/lib/new_relic/agent/configuration/manager.rb +1 -1
  14. data/lib/new_relic/agent/configuration/yaml_source.rb +6 -1
  15. data/lib/new_relic/agent/database.rb +41 -1
  16. data/lib/new_relic/agent/distributed_tracing.rb +2 -2
  17. data/lib/new_relic/agent/health_check.rb +136 -0
  18. data/lib/new_relic/agent/instrumentation/active_record.rb +1 -8
  19. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +5 -1
  20. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +9 -16
  21. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +0 -2
  22. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +0 -2
  23. data/lib/new_relic/agent/instrumentation/async_http.rb +1 -2
  24. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/chain.rb +21 -0
  25. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/instrumentation.rb +66 -0
  26. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/prepend.rb +15 -0
  27. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose.rb +22 -0
  28. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/chain.rb +21 -0
  29. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +91 -0
  30. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/prepend.rb +15 -0
  31. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis.rb +22 -0
  32. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
  33. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +93 -0
  34. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb +23 -0
  35. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb +23 -0
  36. data/lib/new_relic/agent/instrumentation/aws_sqs.rb +0 -2
  37. data/lib/new_relic/agent/instrumentation/bunny.rb +3 -4
  38. data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +0 -2
  39. data/lib/new_relic/agent/instrumentation/curb.rb +3 -4
  40. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -4
  41. data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +3 -4
  42. data/lib/new_relic/agent/instrumentation/dynamodb.rb +0 -2
  43. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +0 -2
  44. data/lib/new_relic/agent/instrumentation/ethon.rb +0 -4
  45. data/lib/new_relic/agent/instrumentation/fiber.rb +0 -2
  46. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +0 -3
  47. data/lib/new_relic/agent/instrumentation/grape.rb +1 -3
  48. data/lib/new_relic/agent/instrumentation/httpclient.rb +0 -1
  49. data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
  50. data/lib/new_relic/agent/instrumentation/httpx.rb +0 -4
  51. data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
  52. data/lib/new_relic/agent/instrumentation/logstasher.rb +0 -2
  53. data/lib/new_relic/agent/instrumentation/memcache.rb +0 -1
  54. data/lib/new_relic/agent/instrumentation/opensearch.rb +0 -2
  55. data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
  56. data/lib/new_relic/agent/instrumentation/rake.rb +0 -1
  57. data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +2 -1
  58. data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +2 -1
  59. data/lib/new_relic/agent/instrumentation/rdkafka.rb +0 -2
  60. data/lib/new_relic/agent/instrumentation/redis.rb +0 -1
  61. data/lib/new_relic/agent/instrumentation/resque.rb +7 -5
  62. data/lib/new_relic/agent/instrumentation/roda.rb +4 -4
  63. data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +14 -4
  64. data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +0 -2
  65. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  66. data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -6
  67. data/lib/new_relic/agent/instrumentation/thread.rb +0 -2
  68. data/lib/new_relic/agent/instrumentation/tilt.rb +0 -4
  69. data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
  70. data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +11 -8
  71. data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
  72. data/lib/new_relic/agent/local_log_decorator.rb +12 -2
  73. data/lib/new_relic/agent/log_event_aggregator.rb +28 -2
  74. data/lib/new_relic/agent/new_relic_service.rb +8 -2
  75. data/lib/new_relic/agent/span_event_primitive.rb +4 -2
  76. data/lib/new_relic/agent/threading/backtrace_node.rb +10 -1
  77. data/lib/new_relic/agent/transaction/message_broker_segment.rb +3 -0
  78. data/lib/new_relic/agent.rb +2 -2
  79. data/lib/new_relic/control/frameworks/rails4.rb +1 -5
  80. data/lib/new_relic/dependency_detection.rb +11 -13
  81. data/lib/new_relic/environment_report.rb +1 -5
  82. data/lib/new_relic/helper.rb +15 -0
  83. data/lib/new_relic/language_support.rb +1 -5
  84. data/lib/new_relic/version.rb +1 -1
  85. data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
  86. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +9 -6
  87. data/newrelic.yml +135 -54
  88. data/test/agent_helper.rb +8 -1
  89. metadata +16 -6
@@ -139,7 +139,7 @@ module NewRelic
139
139
  case Rails::VERSION::MAJOR
140
140
  when 3
141
141
  :rails3
142
- when 4..7
142
+ when 4..8
143
143
  :rails_notifications
144
144
  else
145
145
  ::NewRelic::Agent.logger.warn("Detected untested Rails version #{Rails::VERSION::STRING}")
@@ -427,6 +427,7 @@ module NewRelic
427
427
  :public => true,
428
428
  :type => String,
429
429
  :allowed_from_server => false,
430
+ :exclude_from_reported_settings => true,
430
431
  :description => 'Your New Relic <InlinePopover type="userKey" />. Required when using the New Relic REST API v2 to record deployments using the `newrelic deployments` command.'
431
432
  },
432
433
  :backport_fast_active_record_connection_lookup => {
@@ -442,7 +443,7 @@ module NewRelic
442
443
  :public => true,
443
444
  :type => String,
444
445
  :allowed_from_server => false,
445
- :description => "Manual override for the path to your local CA bundle. This CA bundle will be used to validate the SSL certificate presented by New Relic's data collection service."
446
+ :description => "Manual override for the path to your local CA bundle. This CA bundle validates the SSL certificate presented by New Relic's data collection service."
446
447
  },
447
448
  :capture_memcache_keys => {
448
449
  :default => false,
@@ -471,6 +472,14 @@ module NewRelic
471
472
  :allowed_from_server => false,
472
473
  :description => 'If `true`, the agent will clear `Tracer::State` in `Agent.drop_buffered_data`.'
473
474
  },
475
+ :'cloud.aws.account_id' => {
476
+ :default => nil,
477
+ :public => true,
478
+ :type => String,
479
+ :allow_nil => true,
480
+ :allowed_from_server => false,
481
+ :description => 'The AWS account ID for the AWS account associated with this app'
482
+ },
474
483
  :config_path => {
475
484
  :default => DefaultSource.config_path,
476
485
  :public => true,
@@ -637,7 +646,7 @@ module NewRelic
637
646
  :public => true,
638
647
  :type => Boolean,
639
648
  :allowed_from_server => true,
640
- :description => 'If `true`, enables the collection of explain plans in transaction traces. This setting will also apply to explain plans in slow SQL traces if [`slow_sql.explain_enabled`](#slow_sql-explain_enabled) is not set separately.'
649
+ :description => "If `true`, enables the collection of explain plans in transaction traces. This setting will also apply to explain plans in slow SQL traces if [`slow_sql.explain_enabled`](#slow_sql-explain_enabled) isn't set separately."
641
650
  },
642
651
  :'transaction_tracer.explain_threshold' => {
643
652
  :default => 0.5,
@@ -849,7 +858,7 @@ module NewRelic
849
858
  :description => <<~DESCRIPTION
850
859
  Sets the minimum level a log event must have to be forwarded to New Relic.
851
860
 
852
- This is based on the integer values of Ruby's `Logger::Severity` constants: https://github.com/ruby/ruby/blob/master/lib/logger/severity.rb
861
+ This is based on the integer values of [Ruby's `Logger::Severity` constants](https://github.com/ruby/logger/blob/113b82a06b3076b93a71cd467e1605b23afb3088/lib/logger/severity.rb).
853
862
 
854
863
  The intention is to forward logs with the level given to the configuration, as well as any logs with a higher level of severity.
855
864
 
@@ -872,6 +881,21 @@ module NewRelic
872
881
  :allowed_from_server => false,
873
882
  :description => 'A hash with key/value pairs to add as custom attributes to all log events forwarded to New Relic. If sending using an environment variable, the value must be formatted like: "key1=value1,key2=value2"'
874
883
  },
884
+ :'application_logging.forwarding.labels.enabled' => {
885
+ :default => false,
886
+ :public => true,
887
+ :type => Boolean,
888
+ :allowed_from_server => false,
889
+ :description => 'If `true`, the agent attaches [labels](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#labels) to log records.'
890
+ },
891
+ :'application_logging.forwarding.labels.exclude' => {
892
+ :default => [],
893
+ :public => true,
894
+ :type => Array,
895
+ :transform => DefaultSource.method(:convert_to_list),
896
+ :allowed_from_server => false,
897
+ :description => 'A case-insensitive array or comma-delimited string containing the labels to exclude from log records.'
898
+ },
875
899
  :'application_logging.forwarding.max_samples_stored' => {
876
900
  :default => 10000,
877
901
  :public => true,
@@ -1159,13 +1183,13 @@ module NewRelic
1159
1183
  :allowed_from_server => false,
1160
1184
  :transform => proc { |arr| NewRelic::Agent.add_automatic_method_tracers(arr) },
1161
1185
  :description => <<~DESCRIPTION
1162
- An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods for the agent to automatically add custom instrumentation to without the need for altering any of the source code that defines the methods.
1186
+ An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods that the agent can automatically add custom instrumentation to. This doesn't require any modifications of the source code that defines the methods.
1163
1187
 
1164
1188
  Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
1165
1189
 
1166
1190
  Here is some Ruby source code that defines a `render_png` instance method for an `Image` class and a `notify` class method for a `User` class, both within a `MyCompany` module namespace:
1167
1191
 
1168
- ```
1192
+ ```rb
1169
1193
  module MyCompany
1170
1194
  class Image
1171
1195
  def render_png
@@ -1183,21 +1207,21 @@ module NewRelic
1183
1207
 
1184
1208
  Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
1185
1209
 
1186
- ```
1210
+ ```yaml
1187
1211
  automatic_custom_instrumentation_method_list:
1188
1212
  - MyCompany::Image#render_png
1189
1213
  - MyCompany::User.notify
1190
1214
  ```
1191
1215
 
1192
- That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string can be used instead:
1216
+ That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
1193
1217
 
1194
- ```
1218
+ ```yaml
1195
1219
  automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
1196
1220
  ```
1197
1221
 
1198
- Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, this comma-delimited string format should be used:
1222
+ Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, use this comma-delimited string format:
1199
1223
 
1200
- ```
1224
+ ```sh
1201
1225
  export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
1202
1226
  ```
1203
1227
  DESCRIPTION
@@ -1286,6 +1310,7 @@ module NewRelic
1286
1310
  :default => false,
1287
1311
  :public => true,
1288
1312
  :type => Boolean,
1313
+ :aliases => %i[disable_active_job],
1289
1314
  :allowed_from_server => false,
1290
1315
  :description => 'If `true`, disables Active Job instrumentation.'
1291
1316
  },
@@ -1528,6 +1553,33 @@ module NewRelic
1528
1553
  :allowed_from_server => false,
1529
1554
  :description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1530
1555
  },
1556
+ :'instrumentation.aws_sdk_firehose' => {
1557
+ :default => 'auto',
1558
+ :documentation_default => 'auto',
1559
+ :public => true,
1560
+ :type => String,
1561
+ :dynamic_name => true,
1562
+ :allowed_from_server => false,
1563
+ :description => 'Controls auto-instrumentation of the aws-sdk-firehose library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
1564
+ },
1565
+ :'instrumentation.aws_sdk_lambda' => {
1566
+ :default => 'auto',
1567
+ :documentation_default => 'auto',
1568
+ :public => true,
1569
+ :type => String,
1570
+ :dynamic_name => true,
1571
+ :allowed_from_server => false,
1572
+ :description => 'Controls auto-instrumentation of the aws_sdk_lambda library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
1573
+ },
1574
+ :'instrumentation.aws_sdk_kinesis' => {
1575
+ :default => 'auto',
1576
+ :documentation_default => 'auto',
1577
+ :public => true,
1578
+ :type => String,
1579
+ :dynamic_name => true,
1580
+ :allowed_from_server => false,
1581
+ :description => 'Controls auto-instrumentation of the aws-sdk-kinesis library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
1582
+ },
1531
1583
  :'instrumentation.ruby_kafka' => {
1532
1584
  :default => 'auto',
1533
1585
  :public => true,
@@ -1878,7 +1930,7 @@ module NewRelic
1878
1930
  :description => <<~DESCRIPTION
1879
1931
  An array of strings to specify which keys inside a Stripe event's `user_data` hash should be reported
1880
1932
  to New Relic. Each string in this array will be turned into a regular expression via `Regexp.new` to
1881
- permit advanced matching. Setting the value to `["."]` will report all `user_data`.
1933
+ enable advanced matching. Setting the value to `["."]` will report all `user_data`.
1882
1934
  DESCRIPTION
1883
1935
  },
1884
1936
  :'stripe.user_data.exclude' => {
@@ -1891,9 +1943,9 @@ module NewRelic
1891
1943
  :description => <<~DESCRIPTION
1892
1944
  An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
1893
1945
  not be reported to New Relic. Each string in this array will be turned into a regular expression via
1894
- `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the
1895
- pair will not be reported. By default, no `user_data` is reported, so this option should only be used if
1896
- the `stripe.user_data.include` option is being used.
1946
+ `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the pair
1947
+ isn't reported. By default, no `user_data` is reported. Use this option only if the
1948
+ `stripe.user_data.include` option is also used.
1897
1949
  DESCRIPTION
1898
1950
  },
1899
1951
  :'instrumentation.thread' => {
@@ -2036,7 +2088,7 @@ module NewRelic
2036
2088
  :transform => proc { |bool| NewRelic::Agent::ServerlessHandler.env_var_set? || bool },
2037
2089
  :description => 'If `true`, the agent will operate in a streamlined mode suitable for use with short-lived ' \
2038
2090
  'serverless functions. NOTE: Only AWS Lambda functions are supported currently and this ' \
2039
- "option is not intended for use without [New Relic's Ruby Lambda layer](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/monitoring-aws-lambda-serverless-monitoring/) offering."
2091
+ "option isn't intended for use without [New Relic's Ruby Lambda layer](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/monitoring-aws-lambda-serverless-monitoring/) offering."
2040
2092
  },
2041
2093
  # Sidekiq
2042
2094
  :'sidekiq.args.include' => {
@@ -2144,7 +2196,7 @@ module NewRelic
2144
2196
  :public => true,
2145
2197
  :type => Boolean,
2146
2198
  :allowed_from_server => false,
2147
- :description => 'If true, the agent strips messages from all exceptions except those in the [allowlist](#strip_exception_messages-allowlist). Enabled automatically in [high security mode](/docs/accounts-partnerships/accounts/security/high-security).'
2199
+ :description => 'If true, the agent strips messages from all exceptions except those in the [allowed classes list](#strip_exception_messages-allowed_classes). Enabled automatically in [high security mode](/docs/accounts-partnerships/accounts/security/high-security).'
2148
2200
  },
2149
2201
  :'strip_exception_messages.allowed_classes' => {
2150
2202
  :default => '',
@@ -2154,6 +2206,28 @@ module NewRelic
2154
2206
  :transform => DefaultSource.method(:convert_to_constant_list),
2155
2207
  :description => 'Specify a list of exceptions you do not want the agent to strip when [strip_exception_messages](#strip_exception_messages-enabled) is `true`. Separate exceptions with a comma. For example, `"ImportantException,PreserveMessageException"`.'
2156
2208
  },
2209
+ # Agent Control
2210
+ :'agent_control.enabled' => {
2211
+ :default => false,
2212
+ :public => false,
2213
+ :type => Boolean,
2214
+ :allowed_from_server => false,
2215
+ :description => 'Boolean value that denotes whether Agent Control functionality should be enabled. At the moment, this functionality is limited to whether agent health should be reported. This configuration will be set using an environment variable by Agent Control, or one of its components, prior to agent startup.'
2216
+ },
2217
+ :'agent_control.health.delivery_location' => {
2218
+ :default => '/newrelic/apm/health',
2219
+ :public => false,
2220
+ :type => String,
2221
+ :allowed_from_server => false,
2222
+ :description => 'A `file:` URI that specifies the fully qualified directory path for health file(s) to be written to. This defaults to: `file:///newrelic/apm/health`. This configuration will be set using an environment variable by Agent Control, or one of its components, prior to agent startup.'
2223
+ },
2224
+ :'agent_control.health.frequency' => {
2225
+ :default => 5,
2226
+ :public => false,
2227
+ :type => Integer,
2228
+ :allowed_from_server => false,
2229
+ :description => 'The interval, in seconds, of how often the health file(s) will be written to. This configuration will be set using an environment variable by Agent Control, or one of its components, prior to agent startup.'
2230
+ },
2157
2231
  # Thread profiler
2158
2232
  :'thread_profiler.enabled' => {
2159
2233
  :default => DefaultSource.thread_profiler_enabled,
@@ -2685,47 +2759,196 @@ module NewRelic
2685
2759
  :description => 'Defines the endpoint URL for posting security-related data',
2686
2760
  :dynamic_name => true
2687
2761
  },
2688
- :'security.detection.rci.enabled' => {
2689
- :default => true,
2762
+ :'security.application_info.port' => {
2763
+ :default => nil,
2764
+ :allow_nil => true,
2765
+ :public => true,
2766
+ :type => Integer,
2767
+ :external => true,
2768
+ :allowed_from_server => false,
2769
+ :description => 'The port the application is listening on. This setting is mandatory for Passenger servers. The agent detects other servers by default.'
2770
+ },
2771
+ :'security.exclude_from_iast_scan.api' => {
2772
+ :default => [],
2773
+ :public => true,
2774
+ :type => Array,
2775
+ :external => true,
2776
+ :allowed_from_server => true,
2777
+ :transform => DefaultSource.method(:convert_to_list),
2778
+ :description => 'Defines API paths the security agent should ignore in IAST scans. Accepts an array of regex patterns matching the URI to ignore. The regex pattern should find a complete match for the URL without the endpoint. For example, `[".*account.*"], [".*/\api\/v1\/.*?\/login"]`'
2779
+ },
2780
+ :'security.exclude_from_iast_scan.http_request_parameters.header' => {
2781
+ :default => [],
2782
+ :public => true,
2783
+ :type => Array,
2784
+ :external => true,
2785
+ :allowed_from_server => true,
2786
+ :transform => DefaultSource.method(:convert_to_list),
2787
+ :description => 'An array of HTTP request headers the security agent should ignore in IAST scans. The array should specify a list of patterns matching the headers to ignore.'
2788
+ },
2789
+ :'security.exclude_from_iast_scan.http_request_parameters.query' => {
2790
+ :default => [],
2791
+ :public => true,
2792
+ :type => Array,
2793
+ :external => true,
2794
+ :allowed_from_server => true,
2795
+ :transform => DefaultSource.method(:convert_to_list),
2796
+ :description => 'An array of HTTP request query parameters the security agent should ignore in IAST scans. The array should specify a list of patterns matching the HTTP request query parameters to ignore.'
2797
+ },
2798
+ :'security.exclude_from_iast_scan.http_request_parameters.body' => {
2799
+ :default => [],
2800
+ :public => true,
2801
+ :type => Array,
2802
+ :external => true,
2803
+ :allowed_from_server => true,
2804
+ :transform => DefaultSource.method(:convert_to_list),
2805
+ :description => 'An array of HTTP request body keys the security agent should ignore in IAST scans.'
2806
+ },
2807
+ :'security.exclude_from_iast_scan.iast_detection_category.insecure_settings' => {
2808
+ :default => false,
2690
2809
  :external => true,
2691
2810
  :public => true,
2692
2811
  :type => Boolean,
2693
2812
  :allowed_from_server => false,
2694
- :description => 'If `true`, enables RCI (remote code injection) detection'
2813
+ :description => 'If `true`, disables the detection of low-severity insecure settings. For example, hash, crypto, cookie, random generators, trust boundary).'
2695
2814
  },
2696
- :'security.detection.rxss.enabled' => {
2697
- :default => true,
2815
+ :'security.exclude_from_iast_scan.iast_detection_category.invalid_file_access' => {
2816
+ :default => false,
2698
2817
  :external => true,
2699
2818
  :public => true,
2700
2819
  :type => Boolean,
2701
2820
  :allowed_from_server => false,
2702
- :description => 'If `true`, enables RXSS (reflected cross-site scripting) detection'
2821
+ :description => 'If `true`, disables file operation-related IAST detections (File Access & Application integrity violation)'
2703
2822
  },
2704
- :'security.detection.deserialization.enabled' => {
2705
- :default => true,
2823
+ :'security.exclude_from_iast_scan.iast_detection_category.sql_injection' => {
2824
+ :default => false,
2706
2825
  :external => true,
2707
2826
  :public => true,
2708
2827
  :type => Boolean,
2709
2828
  :allowed_from_server => false,
2710
- :description => 'If `true`, enables deserialization detection'
2829
+ :description => 'If `true`, disables SQL injection detection in IAST scans.'
2711
2830
  },
2712
- :'security.application_info.port' => {
2713
- :default => nil,
2714
- :allow_nil => true,
2831
+ :'security.exclude_from_iast_scan.iast_detection_category.nosql_injection' => {
2832
+ :default => false,
2833
+ :external => true,
2715
2834
  :public => true,
2716
- :type => Integer,
2835
+ :type => Boolean,
2836
+ :allowed_from_server => false,
2837
+ :description => 'If `true`, disables NOSQL injection detection in IAST scans.'
2838
+ },
2839
+ :'security.exclude_from_iast_scan.iast_detection_category.ldap_injection' => {
2840
+ :default => false,
2717
2841
  :external => true,
2842
+ :public => true,
2843
+ :type => Boolean,
2718
2844
  :allowed_from_server => false,
2719
- :description => 'The port the application is listening on. This setting is mandatory for Passenger servers. Other servers should be detected by default.'
2845
+ :description => 'If `true`, disables LDAP injection detection in IAST scans.'
2720
2846
  },
2721
- :'security.request.body_limit' => {
2722
- :default => 300,
2723
- :allow_nil => true,
2847
+ :'security.exclude_from_iast_scan.iast_detection_category.javascript_injection' => {
2848
+ :default => false,
2849
+ :external => true,
2850
+ :public => true,
2851
+ :type => Boolean,
2852
+ :allowed_from_server => false,
2853
+ :description => 'If `true`, disables Javascript injection detection in IAST scans.'
2854
+ },
2855
+ :'security.exclude_from_iast_scan.iast_detection_category.command_injection' => {
2856
+ :default => false,
2857
+ :external => true,
2858
+ :public => true,
2859
+ :type => Boolean,
2860
+ :allowed_from_server => false,
2861
+ :description => 'If `true`, disables system command injection detection in IAST scans.'
2862
+ },
2863
+ :'security.exclude_from_iast_scan.iast_detection_category.xpath_injection' => {
2864
+ :default => false,
2865
+ :external => true,
2866
+ :public => true,
2867
+ :type => Boolean,
2868
+ :allowed_from_server => false,
2869
+ :description => 'If `true`, disables XPATH injection detection in IAST scans.'
2870
+ },
2871
+ :'security.exclude_from_iast_scan.iast_detection_category.ssrf' => {
2872
+ :default => false,
2873
+ :external => true,
2874
+ :public => true,
2875
+ :type => Boolean,
2876
+ :allowed_from_server => false,
2877
+ :description => 'If `true`, disables Sever-Side Request Forgery (SSRF) detection in IAST scans.'
2878
+ },
2879
+ :'security.exclude_from_iast_scan.iast_detection_category.rxss' => {
2880
+ :default => false,
2881
+ :external => true,
2882
+ :public => true,
2883
+ :type => Boolean,
2884
+ :allowed_from_server => false,
2885
+ :description => 'If `true`, disables Reflected Cross-Site Scripting (RXSS) detection in IAST scans.'
2886
+ },
2887
+ :'security.scan_schedule.delay' => {
2888
+ :default => 0,
2889
+ :public => true,
2890
+ :type => Integer,
2891
+ :external => true,
2892
+ :allowed_from_server => true,
2893
+ :description => 'Specifies the delay time (in minutes) before the IAST scan begins after the application starts.'
2894
+ },
2895
+ :'security.scan_schedule.duration' => {
2896
+ :default => 0,
2724
2897
  :public => true,
2725
2898
  :type => Integer,
2726
2899
  :external => true,
2900
+ :allowed_from_server => true,
2901
+ :description => 'Indicates the duration (in minutes) for which the IAST scan will be performed.'
2902
+ },
2903
+ :'security.scan_schedule.schedule' => {
2904
+ :default => '',
2905
+ :public => true,
2906
+ :type => String,
2907
+ :external => true,
2908
+ :allowed_from_server => true,
2909
+ :description => 'Specifies a cron expression that sets when the IAST scan should run.',
2910
+ :dynamic_name => true
2911
+ },
2912
+ :'security.scan_schedule.always_sample_traces' => {
2913
+ :default => false,
2914
+ :external => true,
2915
+ :public => true,
2916
+ :type => Boolean,
2727
2917
  :allowed_from_server => false,
2728
- :description => 'Defines the request body limit to process in security events (in KB). The default value is 300, for 300KB.'
2918
+ :description => 'If `true`, allows IAST to continuously gather trace data in the background. The security agent uses collected data to perform an IAST scan at the scheduled time.'
2919
+ },
2920
+ :'security.scan_controllers.iast_scan_request_rate_limit' => {
2921
+ :default => 3600,
2922
+ :public => true,
2923
+ :type => Integer,
2924
+ :external => true,
2925
+ :allowed_from_server => true,
2926
+ :description => 'Sets the maximum number of HTTP requests allowed for the IAST scan per minute. Any Integer between 12 and 3600 is valid. The default value is 3600.'
2927
+ },
2928
+ :'security.scan_controllers.scan_instance_count' => {
2929
+ :default => 0,
2930
+ :public => true,
2931
+ :type => Integer,
2932
+ :external => true,
2933
+ :allowed_from_server => true,
2934
+ :description => 'The number of application instances for a specific entity to perform IAST analysis on.'
2935
+ },
2936
+ :'security.scan_controllers.report_http_response_body' => {
2937
+ :default => true,
2938
+ :public => true,
2939
+ :type => Boolean,
2940
+ :external => true,
2941
+ :allowed_from_server => true,
2942
+ :description => 'If `true`, enables the sending of HTTP responses bodies. Disabling this also disables Reflected Cross-Site Scripting (RXSS) vulnerability detection.'
2943
+ },
2944
+ :'security.iast_test_identifier' => {
2945
+ :default => nil,
2946
+ :allow_nil => true,
2947
+ :public => true,
2948
+ :type => String,
2949
+ :external => true,
2950
+ :allowed_from_server => true,
2951
+ :description => 'A unique test identifier when runnning IAST in a CI/CD environment to differentiate between different test runs. For example, a build number.'
2729
2952
  }
2730
2953
  }.freeze
2731
2954
  # rubocop:enable Metrics/CollectionLiteralLength
@@ -143,7 +143,7 @@ module NewRelic
143
143
  return default if default
144
144
 
145
145
  boolean = enforce_boolean(key, value)
146
- return boolean if [true, false].include?(boolean)
146
+ evaluated = boolean if [true, false].include?(boolean)
147
147
 
148
148
  apply_transformations(key, evaluated)
149
149
  end
@@ -36,6 +36,7 @@ module NewRelic
36
36
  erb_file = process_erb(raw_file)
37
37
  config = process_yaml(erb_file, env, config, @file_path)
38
38
  rescue ScriptError, StandardError => e
39
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
39
40
  log_failure("Failed to read or parse configuration file at #{path}", e)
40
41
  end
41
42
 
@@ -99,7 +100,11 @@ module NewRelic
99
100
  file.gsub!(/^\s*#.*$/, '#')
100
101
  ERB.new(file).result(binding)
101
102
  rescue ScriptError, StandardError => e
102
- log_failure('Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.', e)
103
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
104
+ message = 'Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.'
105
+ failure_array = [message, e]
106
+ failure_array << e.backtrace[0] if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.4.0')
107
+ log_failure(*failure_array)
103
108
  nil
104
109
  end
105
110
  end
@@ -90,6 +90,42 @@ module NewRelic
90
90
  ConnectionManager.instance.get_connection(config, &connector)
91
91
  end
92
92
 
93
+ def explain_this(statement, use_execute = false)
94
+ if supports_with_connection?
95
+ explain_this_using_with_connection(statement)
96
+ else
97
+ explain_this_using_adapter_connection(statement, use_execute)
98
+ end
99
+ rescue => e
100
+ NewRelic::Agent.logger.error("Couldn't fetch the explain plan for statement: #{e}")
101
+ end
102
+
103
+ def explain_this_using_with_connection(statement)
104
+ ::ActiveRecord::Base.with_connection do |conn|
105
+ conn.exec_query("EXPLAIN #{statement.sql}", "Explain #{statement.name}", statement.binds)
106
+ end
107
+ end
108
+
109
+ def explain_this_using_adapter_connection(statement, use_execute)
110
+ connection = get_connection(statement.config) do
111
+ ::ActiveRecord::Base.send(:"#{statement.config[:adapter]}_connection", statement.config)
112
+ end
113
+
114
+ if use_execute
115
+ connection.execute("EXPLAIN #{statement.sql}")
116
+ else
117
+ connection.exec_query("EXPLAIN #{statement.sql}", "Explain #{statement.name}", statement.binds)
118
+ end
119
+ end
120
+
121
+ # ActiveRecord v7.2.0 introduced with_connection
122
+ def supports_with_connection?
123
+ return @supports_with_connection if defined?(@supports_with_connection)
124
+
125
+ @supports_with_connection = defined?(::ActiveRecord::VERSION::STRING) &&
126
+ Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('7.2.0')
127
+ end
128
+
93
129
  def close_connections
94
130
  ConnectionManager.instance.close_connections
95
131
  end
@@ -241,9 +277,11 @@ module NewRelic
241
277
  MYSQL_PREFIX = 'mysql'.freeze
242
278
  MYSQL2_PREFIX = 'mysql2'.freeze
243
279
  SQLITE_PREFIX = 'sqlite'.freeze
280
+ TRILOGY_PREFIX = 'trilogy'.freeze
281
+ REDSHIFT_PREFIX = 'redshift'.freeze
244
282
 
245
283
  def symbolized_adapter(adapter)
246
- if adapter.start_with?(POSTGRES_PREFIX) || adapter == POSTGIS_PREFIX
284
+ if adapter.start_with?(POSTGRES_PREFIX) || adapter == POSTGIS_PREFIX || adapter == REDSHIFT_PREFIX
247
285
  :postgres
248
286
  elsif adapter == MYSQL_PREFIX
249
287
  :mysql
@@ -253,6 +291,8 @@ module NewRelic
253
291
  :mysql2
254
292
  elsif adapter.start_with?(SQLITE_PREFIX)
255
293
  :sqlite
294
+ elsif adapter == TRILOGY_PREFIX
295
+ :trilogy
256
296
  else
257
297
  adapter.to_sym
258
298
  end
@@ -45,7 +45,7 @@ module NewRelic
45
45
  record_api_supportability_metric(:insert_distributed_trace_headers)
46
46
 
47
47
  unless Agent.config[:'distributed_tracing.enabled']
48
- NewRelic::Agent.logger.warn('Not configured to insert distributed trace headers')
48
+ NewRelic::Agent.logger.debug('Not configured to insert distributed trace headers')
49
49
  return nil
50
50
  end
51
51
 
@@ -99,7 +99,7 @@ module NewRelic
99
99
  record_api_supportability_metric(:accept_distributed_trace_headers)
100
100
 
101
101
  unless Agent.config[:'distributed_tracing.enabled']
102
- NewRelic::Agent.logger.warn('Not configured to accept distributed trace headers')
102
+ NewRelic::Agent.logger.debug('Not configured to accept distributed trace headers')
103
103
  return nil
104
104
  end
105
105