From 98ccfcefde00f4b44956e6f5a66cbe684266022f Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:53:27 -0600 Subject: [PATCH] Do not cast unscrubbed values to a string (#165) * Do not cast unscrubbed values to a string * Changelog entry --- .changes/unreleased/Fixes-20240709-190235.yaml | 6 ++++++ dbt_common/exceptions/base.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixes-20240709-190235.yaml diff --git a/.changes/unreleased/Fixes-20240709-190235.yaml b/.changes/unreleased/Fixes-20240709-190235.yaml new file mode 100644 index 00000000..2d4fa052 --- /dev/null +++ b/.changes/unreleased/Fixes-20240709-190235.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Do not cast unscrubbed values to a string +time: 2024-07-09T19:02:35.755277-06:00 +custom: + Author: dbeatty10 + Issue: "165" diff --git a/dbt_common/exceptions/base.py b/dbt_common/exceptions/base.py index 61bd97a9..22cbb689 100644 --- a/dbt_common/exceptions/base.py +++ b/dbt_common/exceptions/base.py @@ -10,13 +10,13 @@ def env_secrets() -> List[str]: return [v for k, v in os.environ.items() if k.startswith(SECRET_ENV_PREFIX) and v.strip()] -def scrub_secrets(msg: str, secrets: List[str]) -> str: +def scrub_secrets(msg: Any, secrets: List[str]) -> Any: scrubbed = str(msg) for secret in secrets: scrubbed = scrubbed.replace(secret, "*****") - return scrubbed + return msg if str(msg) == scrubbed else scrubbed class DbtBaseException(Exception):