Skip to content

security: _validate_import_line_or_throw logs credential fields at DEBUG level #1829

Description

@jacalata

Problem

UserItem.CSVImport._validate_import_line_or_throw (and by extension validate_file_for_import) accepts a caller-supplied logger and logs validation details at DEBUG level. The raw CSV values passed in include the password column (column index 1) from user-import files.

If a caller passes a logger with DEBUG enabled — common in development or verbose CI environments — passwords from the import CSV are written to the log output.

Proposed fix

Before any logging in _validate_import_line_or_throw, mask or omit the password field. For example, replace it with "***" in any debug-logged representation of the line:

def _safe_log_line(values):
    masked = list(values)
    if len(masked) > UserItem.CSVImport.ColumnType.PASSWORD:
        masked[UserItem.CSVImport.ColumnType.PASSWORD] = "***"
    return masked

This is a narrow fix — it does not change validation logic, only what gets emitted to the log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions