Skip to content

Leaking mongodb password in connection registration log #294

@formorter

Description

@formorter

Hello there!
I encountered an issue where, when creating a connection to MongoDB, the logs display the entire MongoDB connection string including the password.
At this line, you are masking the password in the logs:

log.info(f"Using override mongodb password ******")

However, shortly after, the full connection string including the password is logged at:
"Registering connection to %(alias)s (%(host)s)" % entry.to_struct()

Could you please mask the sensitive information in this log output as well?
Example:

[2025-07-22 15:35:30,777] [9] [INFO] [clearml.database] Using override mongodb password ******
[2025-07-22 15:35:30,779] [9] [INFO] [clearml.database] Registering connection to auth-db (mongodb://myuser:[email protected]:27017/auth)

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