diff --git a/core/dbt/context/base.py b/core/dbt/context/base.py index 5ee266f8b6a..fdd0bf52257 100644 --- a/core/dbt/context/base.py +++ b/core/dbt/context/base.py @@ -23,6 +23,7 @@ from dbt_common.context import get_invocation_context from dbt_common.exceptions.macros import MacroReturn from dbt_common.events.functions import fire_event, get_invocation_id +from dbt.context.secret import SECRET_PLACEHOLDER from dbt.events.types import JinjaLogInfo, JinjaLogDebug from dbt_common.events.contextvars import get_node_info from dbt.version import __version__ as dbt_version @@ -561,12 +562,10 @@ def log(msg: str, info: bool = False) -> str: {{ log("Running some_macro: " ~ arg1 ~ ", " ~ arg2) }} {% endmacro %}" """ - # Now, detect instances of the placeholder value ($$$DBT_SECRET_START...DBT_SECRET_END$$$) - # and replace them with the standard mask '*****' + # Detect instances of the placeholder value ($$$DBT_SECRET_START...DBT_SECRET_END$$$) + # and replace it with the standard mask '*****' if "DBT_SECRET_START" in str(msg): search_group = f"({SECRET_ENV_PREFIX}(.*))" - from dbt.context.secret import SECRET_PLACEHOLDER - pattern = SECRET_PLACEHOLDER.format(search_group).replace("$", r"\$") m = re.search( pattern, diff --git a/tests/functional/dependencies/test_dependency_secrets.py b/tests/functional/dependencies/test_dependency_secrets.py index f1ac92e0b98..7e0b592409b 100644 --- a/tests/functional/dependencies/test_dependency_secrets.py +++ b/tests/functional/dependencies/test_dependency_secrets.py @@ -25,7 +25,7 @@ def packages(self): def test_allow_secrets(self, project): _, log_output = run_dbt_and_capture(["deps"]) - # this will not be written to logs or lock file + # this will not be written to logs assert not ("super secret" in log_output) assert "*****" in log_output assert not ("DBT_ENV_SECRET_FOR_LOGGING" in log_output)