Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Apr 23, 2024
1 parent 83021fc commit acdb427
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions core/dbt/context/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/dependencies/test_dependency_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit acdb427

Please sign in to comment.