From 4dce5c4553097cefc1e3ce4120fef7b66c60b19b Mon Sep 17 00:00:00 2001 From: Tim Pansino Date: Mon, 4 Nov 2024 10:31:58 -0800 Subject: [PATCH] Remove high security checks --- newrelic/core/data_collector.py | 29 +++++++++++-------------- tests/agent_features/test_log_events.py | 14 ------------ 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/newrelic/core/data_collector.py b/newrelic/core/data_collector.py index 6377fc7a7..ecc117f8a 100644 --- a/newrelic/core/data_collector.py +++ b/newrelic/core/data_collector.py @@ -163,22 +163,19 @@ def get_log_events_common_block(self): try: # Add global custom log attributes to common block if self.configuration.application_logging.forwarding.custom_attributes: - if self.configuration.high_security: - _logger.debug("Cannot add custom attribute in High Security Mode.") - else: - # Retrieve and process attrs - custom_attributes = {} - for attr_name, attr_value in self.configuration.application_logging.forwarding.custom_attributes: - if len(custom_attributes) >= MAX_NUM_USER_ATTRIBUTES: - _logger.debug("Maximum number of custom attributes already added. Dropping attribute: %r=%r", attr_name, value) - break - - key, val = process_user_attribute(attr_name, attr_value) - - if key is not None: - custom_attributes[key] = val - - common.update(custom_attributes) + # Retrieve and process attrs + custom_attributes = {} + for attr_name, attr_value in self.configuration.application_logging.forwarding.custom_attributes: + if len(custom_attributes) >= MAX_NUM_USER_ATTRIBUTES: + _logger.debug("Maximum number of custom attributes already added. Dropping attribute: %r=%r", attr_name, value) + break + + key, val = process_user_attribute(attr_name, attr_value) + + if key is not None: + custom_attributes[key] = val + + common.update(custom_attributes) # Add application labels as tags. prefixed attributes to common block labels = self.configuration.labels diff --git a/tests/agent_features/test_log_events.py b/tests/agent_features/test_log_events.py index 8cb121710..d005484db 100644 --- a/tests/agent_features/test_log_events.py +++ b/tests/agent_features/test_log_events.py @@ -475,17 +475,3 @@ def test_global_custom_attribute_forwarding(): common = session.get_log_events_common_block() # Both attrs should appear, and the 2nd attr should be truncated to the max user attribute length assert common == {"custom_attr_1": "value", "custom_attr_2": "a" * 255} - - -@override_application_settings({ - "high_security": True, - "application_logging.forwarding.custom_attributes": [("custom_attr_1", "value"), ("custom_attr_2", "a" * 256)], -}) -@background_task() -def test_global_custom_attribute_forwarding_high_security_enabled(): - txn = current_transaction() - session = list(txn.application._agent._applications.values())[0]._active_session - - common = session.get_log_events_common_block() - # No custom attrs should be attached with high security enabled - assert common == {}