Skip to content

Commit

Permalink
Mask password value while logging (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
shounakmk219 authored Mar 26, 2024
1 parent 4d3d304 commit 0c8febd
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 0c8febd

Please sign in to comment.