Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

Password not redacted in case of a URL that isn't fully valid #51

@dominicbarnes

Description

@dominicbarnes

Within parseConfigError, it attempts to redact any user password. Unfortunately, if url.Parse fails for any reason, it simple proceeds with the DSN parsing logic, which causes a password to be leaked if it is part of the connection string.

I hit this by fuzz-testing some input on connection strings. In my case, I set port as "abc" and then got back the full DSN (including the password) back in the error message.

My hunch is if the string begins with postgres:// or postgresql:// and the URL cannot be parsed, it would be more safe to be cautious and not return the original connection string in the error message. It might be valuable to have redactPW return an error and perhaps adjust the behavior accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions