[GH-ISSUE #3] Special character "@" interpretation within the database connection string #1

Closed
opened 2026-02-26 21:33:57 +03:00 by kerem · 1 comment
Owner

Originally created by @GhaithKhmili on GitHub (Jul 26, 2024).
Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/3

As my first issue report in this repo, I would like to congratulate you for the handy tool @eduardolat .
I've been playing with the tool in the last day in which I was able to integrate MinIO (latest) with container volumes mapped to my local storage and a custom bucket region.

Issue :

So far so good up to this moments yet I came across an issue with database passwords that contain the special character "@" within.

How to reproduce :

Use a database password containing an "@" character. Example : postgresql://username:p@ssword@hostname/database

Workaround :

A colleague of mine @scratchskinned succeeded to overcome the issue by implementing URL percent encoding and passing the character @ as %40.

Originally created by @GhaithKhmili on GitHub (Jul 26, 2024). Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/3 As my first issue report in this repo, I would like to congratulate you for the handy tool @eduardolat . I've been playing with the tool in the last day in which I was able to integrate MinIO (latest) with container volumes mapped to my local storage and a custom bucket region. Issue : So far so good up to this moments yet I came across an issue with database passwords that contain the special character "@" within. How to reproduce : Use a database password containing an "@" character. Example : postgresql://username:p@ssword@hostname/database Workaround : A colleague of mine @scratchskinned succeeded to overcome the issue by implementing[ URL percent encoding](https://en.wikipedia.org/wiki/Percent-encoding) and passing the character @ as %40.
kerem closed this issue 2026-02-26 21:33:57 +03:00
Author
Owner

@eduardolat commented on GitHub (Jul 26, 2024):

@GhaithKhmili Thanks a lot for your comment, I hope you are enjoying the tool as much as I am.

Regarding your problem you are totally correct, according to the PostgreSQL documentation it works like this:

The connection URI needs to be encoded with percent-encoding if it includes symbols with special meaning in any of its parts.

This is how PostgreSQL works, I think it is outside the scope of PG Back Web, so it would be a bit irresponsible to alter the connection strings provided by the people who use the tool.

Rather, it is the user's responsibility to provide a valid connection string to the tool, which you can encode as you are already doing. You can also change your database password.

References:

<!-- gh-comment-id:2253610931 --> @eduardolat commented on GitHub (Jul 26, 2024): @GhaithKhmili Thanks a lot for your comment, I hope you are enjoying the tool as much as I am. Regarding your problem you are totally correct, according to the PostgreSQL documentation it works like this: > The connection URI needs to be encoded with percent-encoding if it includes symbols with special meaning in any of its parts. This is how PostgreSQL works, I think it is outside the scope of PG Back Web, so it would be a bit irresponsible to alter the connection strings provided by the people who use the tool. Rather, it is the user's responsibility to provide a valid connection string to the tool, which you can encode as you are already doing. You can also change your database password. References: - PostgreSQLconn string docs: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS - Percent encoding: https://datatracker.ietf.org/doc/html/rfc3986#section-2.1
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#1
No description provided.