Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/newrelic-public-fork/devel…
Browse files Browse the repository at this point in the history
…op-k2-integration' into develop-k2-integration
  • Loading branch information
AnupamJuniwal committed Nov 14, 2023
2 parents 7041783 + 0c2cbbc commit 5cba84e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 29 deletions.
3 changes: 2 additions & 1 deletion newrelic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,9 +3184,10 @@ def _setup_security_module():
if not _settings.security.agent.enabled:
return
from newrelic_security.api.agent import Agent as SecurityAgent

# initialize security agent
security_agent = SecurityAgent()
# create a callback to reinitialise the security module
# create a callback to reinitialise the security module
newrelic.core.agent.Agent.run_on_startup(security_agent.refresh_agent)
except Exception as csec_error:
_logger.error("Security Agent Startup failed with error %s", csec_error)
Expand Down
40 changes: 13 additions & 27 deletions newrelic/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,26 +278,31 @@ class ApplicationLoggingMetricsSettings(Settings):
class ApplicationLoggingLocalDecoratingSettings(Settings):
pass


class SecuritySettings(Settings):
pass


class SecurityDetectionSettings(Settings):
pass


class SecurityAgentSettings(Settings):
pass


class SecurityDetectionRCISettings(Settings):
pass


class SecurityDetectionRXSSSettings(Settings):
pass


class SecurityDetectionDeserializationSettings(Settings):
pass



class InfiniteTracingSettings(Settings):
_trace_observer_host = None

Expand Down Expand Up @@ -864,33 +869,14 @@ def default_host(license_key):
"NEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED", default=False
)

_settings.security.agent.enabled = _environ_as_bool(
"NEW_RELIC_SECURITY_AGENT_ENABLED",
False
)
_settings.security.enabled = _environ_as_bool(
"NEW_RELIC_SECURITY_ENABLED",
False
)
_settings.security.mode = os.environ.get(
"NEW_RELIC_SECURITY_MODE",
"IAST"
)
_settings.security.validator_service_url = os.environ.get(
"NEW_RELIC_SECURITY_VALIDATOR_SERVICE_URL",
None
)
_settings.security.detection.rci.enabled = _environ_as_bool(
"NEW_RELIC_SECURITY_DETECTION_RCI_ENABLED",
True
)
_settings.security.detection.rxss.enabled = _environ_as_bool(
"NEW_RELIC_SECURITY_DETECTION_RXSS_ENABLED",
True
)
_settings.security.agent.enabled = _environ_as_bool("NEW_RELIC_SECURITY_AGENT_ENABLED", False)
_settings.security.enabled = _environ_as_bool("NEW_RELIC_SECURITY_ENABLED", False)
_settings.security.mode = os.environ.get("NEW_RELIC_SECURITY_MODE", "IAST")
_settings.security.validator_service_url = os.environ.get("NEW_RELIC_SECURITY_VALIDATOR_SERVICE_URL", None)
_settings.security.detection.rci.enabled = _environ_as_bool("NEW_RELIC_SECURITY_DETECTION_RCI_ENABLED", True)
_settings.security.detection.rxss.enabled = _environ_as_bool("NEW_RELIC_SECURITY_DETECTION_RXSS_ENABLED", True)
_settings.security.detection.deserialization.enabled = _environ_as_bool(
"NEW_RELIC_SECURITY_DETECTION_DESERIALIZATION_ENABLED",
True
"NEW_RELIC_SECURITY_DETECTION_DESERIALIZATION_ENABLED", True
)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def build_extension(self, ext):
"newrelic": ["newrelic.ini", "version.txt", "packages/urllib3/LICENSE.txt", "common/cacert.pem"],
},
extras_require={"infinite-tracing": ["grpcio", "protobuf"]},
install_requires=["newrelic_security @ git+https://github.com/newrelic/csec-python-agent.git@develop#egg=newrelic_security"]
install_requires=["newrelic_security @ git+https://github.com/newrelic/csec-python-agent.git@develop"]
)

if with_setuptools:
Expand Down

0 comments on commit 5cba84e

Please sign in to comment.