Skip to content

URL encoding of password wrong/incomplete #4286

@dkrizic

Description

@dkrizic

Hi,

I created a database like this

  users:
    - name: step-ca
      databases:
        - stepca
      options: 'SUPERUSER'

I got this random password here

Lgrd}oKjF287_nUn6,=s<:O|

The URI in the secret looks like this:

postgresql://step-ca:Lgrd%7DoKjF287_nUn6,=s%3C%3AO%7C@master-primary.persistence.svc:5432/stepca

But my client does not like it:

Error opening database of Type postgresql: error parsing PostgreSQL DSN: cannot parse `postgresql://step-ca:Lgrd%7DoKjF287_nUn6`: failed to parse as URL (parse "postgresql://step-ca:Lgrd%7DoKjF287_nUn6": invalid port ":Lgrd%7DoKjF287_nUn6" after host)

I reconstructed the uri by myself by url encoding the password with another implementation and now got this:

postgresql://step-ca:Lgrd%7DoKjF287_nUn6%2C%3Ds%3C%3AO%7C@master-primary.persistence.svc:5432/stepca

Now my client is happy. So the difference is

Lgrd%7DoKjF287_nUn6,=s%3C%3AO%7C
Lgrd%7DoKjF287_nUn6%2C%3Ds%3C%3AO%7C

Obviously the comma (,) and equal sign (=) should be escaped as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions