Skip to content

Special Characters in PG_PASSWORD breaks URL encoding #2121

@matthewgreenwaldagility

Description

If you have a password like: hd:,8_zt@}3C>]#=dHYadKb=

The special characters will break URL encoding like so:

sequin ** (Ecto.InvalidURLError) invalid url
  postgres://postgres:hd:,8_zt@}3C>]#=dHYadKb=@postgres-db.abcdefg12345.us-east-1.rds.amazonaws.com

"postgres://#{username}:#{password}@#{hostname}:#{port}/#{database}"

The fix is quite simple and I have tested the code myself.

    encoded_password = URI.encode_www_form(password)
    "postgres://#{username}:#{encoded_password}@#{hostname}:#{port}/#{database}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions