Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <[email protected]>
  • Loading branch information
juanjux committed Aug 21, 2023
1 parent cac41a8 commit b42a8d5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
9 changes: 1 addition & 8 deletions ddtrace/appsec/_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@
from typing import Optional

from ddtrace import Tracer
from ddtrace.constants import APPSEC_ENV
from ddtrace.appsec.utils import _appsec_rc_features_is_enabled
from ddtrace.internal.compat import to_bytes_py2
from ddtrace.internal.utils.formats import asbool


def _appsec_rc_features_is_enabled():
# type: () -> bool
if asbool(os.environ.get("DD_REMOTE_CONFIGURATION_ENABLED", "true")):
return APPSEC_ENV not in os.environ
return False


def _appsec_rc_file_is_not_static():
return "DD_APPSEC_RULES" not in os.environ

Expand Down
2 changes: 1 addition & 1 deletion ddtrace/appsec/_remoteconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING

from ddtrace import config
from ddtrace.appsec._capabilities import _appsec_rc_features_is_enabled
from ddtrace.appsec.utils import _appsec_rc_features_is_enabled
from ddtrace.appsec._capabilities import _appsec_rc_file_is_not_static
from ddtrace.appsec._constants import PRODUCTS
from ddtrace.constants import APPSEC_ENV
Expand Down
8 changes: 8 additions & 0 deletions ddtrace/appsec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ddtrace.appsec import _asm_request_context
from ddtrace.appsec._constants import API_SECURITY
from ddtrace.constants import APPSEC_ENV
from ddtrace.internal.compat import parse
from ddtrace.internal.logger import get_logger
from ddtrace.internal.utils.formats import asbool
Expand Down Expand Up @@ -148,3 +149,10 @@ def __call__(self, *args, **kwargs):
result = self.func(*args, **kwargs)
self.reported_logs[raw_log_hash] = time.time() + self._time_lapse
return result


def _appsec_rc_features_is_enabled():
# type: () -> bool
if asbool(os.environ.get("DD_REMOTE_CONFIGURATION_ENABLED", "true")):
return APPSEC_ENV not in os.environ
return False
2 changes: 1 addition & 1 deletion tests/appsec/test_remoteconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from ddtrace.appsec import _asm_request_context
from ddtrace.appsec._capabilities import _appsec_rc_capabilities
from ddtrace.appsec._capabilities import _appsec_rc_features_is_enabled
from ddtrace.appsec.utils import _appsec_rc_features_is_enabled
from ddtrace.appsec._constants import APPSEC
from ddtrace.appsec._constants import DEFAULT
from ddtrace.appsec._constants import PRODUCTS
Expand Down

0 comments on commit b42a8d5

Please sign in to comment.