Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask password value while logging #93

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pinotdb/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ def extract_table_name(fqn):
return fqn if len(split) == 1 else split[1]


def mask_value(key, value, sensitive_keys):
if key in sensitive_keys:
return 'xxxxxx'
return value


class PinotDialect(default.DefaultDialect):

name = "pinot"
Expand Down Expand Up @@ -180,7 +186,7 @@ def update_from_kwargs(self, givenkw):
kwargs["verify_ssl"] = self._verify_ssl = (str(kwargs.get("verify_ssl", "true")).lower() in ['true'])
logger.info(
"Updated pinot dialect args from %s: %s and %s",
kwargs,
dict(map(lambda kv: (kv[0], mask_value(kv[0], kv[1], ['password'])), kwargs.items())),
self._controller,
self._debug,
)
Expand Down
Loading