Skip to content

Commit 3615baf

Browse files
bcantoniCopilot
andauthored
Refactor password logging for UserItem
Update password logging to mask sensitive data correctly. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 9d3e9f9 commit 3615baf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎tableauserverclient/models/user_item.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,9 @@ def _validate_import_line_or_throw(incoming, logger) -> None:
625625
skip_validation = True
626626
else:
627627
value = value.lower()
628-
# Mask the password column so it never reaches log handlers.
629-
safe_value = "***" if column == UserItem.CSVImport.ColumnType.PASS else value
628+
# A malformed row can shift password fragments into later columns;
629+
# keep every field after the username out of the logs.
630+
safe_value = value if column.value < UserItem.CSVImport.ColumnType.PASS.value else "***"
630631
logger.debug(f"column {column.name}: {safe_value}")
631632
# Never call _validate_attribute_value for PASS: its ValueError
632633
# embeds the raw value, and a future PR that adds password-format

0 commit comments

Comments
 (0)