From 654116ade8b2f9714b6d2066dbfa01c1095fd400 Mon Sep 17 00:00:00 2001 From: Robert Pickering Date: Thu, 21 Mar 2024 17:06:37 +0100 Subject: [PATCH] Fix how security settings are read (#5317) * Fix how security settings are read settings * small change, big difference --- .../src/Datadog.Trace/AppSec/SecuritySettings.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tracer/src/Datadog.Trace/AppSec/SecuritySettings.cs b/tracer/src/Datadog.Trace/AppSec/SecuritySettings.cs index 1f71dcc3101d..94f0e4d66d6a 100644 --- a/tracer/src/Datadog.Trace/AppSec/SecuritySettings.cs +++ b/tracer/src/Datadog.Trace/AppSec/SecuritySettings.cs @@ -87,13 +87,13 @@ bool GetEnabledDefaultValue() ApiSecuritySampling = config .WithKeys(ConfigurationKeys.AppSec.ApiSecurityRequestSampleRate) - .AsDouble(val => val is <= 1 and >= 0) - .GetValueOrDefault(0.1); + .AsDouble(defaultValue: 0.1, validator: val => val is <= 1 and >= 0) + .Value; ApiSecurityMaxConcurrentRequests = config .WithKeys(ConfigurationKeys.AppSec.ApiSecurityMaxConcurrentRequests) - .AsInt32(val => val >= 1) - .GetValueOrDefault(1); + .AsInt32(defaultValue: 1, validator: val => val >= 1) + .Value; ApiSecurityEnabled = config.WithKeys(ConfigurationKeys.AppSec.ApiExperimentalSecurityEnabled) .AsBool(false); @@ -109,13 +109,13 @@ bool GetEnabledDefaultValue() MaxStackTraces = config .WithKeys(ConfigurationKeys.AppSec.MaxStackTraces) - .AsInt32(val => val >= 0) - .GetValueOrDefault(2); + .AsInt32(defaultValue: 2, validator: val => val >= 0) + .Value; MaxStackTraceDepth = config .WithKeys(ConfigurationKeys.AppSec.MaxStackTraceDepth) - .AsInt32(val => val >= 0) - .GetValueOrDefault(32); + .AsInt32(defaultValue: 32, validator: val => val >= 0) + .Value; } public double ApiSecuritySampling { get; }