From 4d9108e34d72977cf2b01247c10fd650edb57c20 Mon Sep 17 00:00:00 2001 From: Juan Calderon Date: Sat, 10 Dec 2022 22:14:35 -0800 Subject: [PATCH] Url Escape the password provided to postgres --- .github/workflows/test-postgres.yml | 4 ++-- postgres/postgres.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-postgres.yml b/.github/workflows/test-postgres.yml index a5d58218..400e459f 100644 --- a/.github/workflows/test-postgres.yml +++ b/.github/workflows/test-postgres.yml @@ -16,7 +16,7 @@ jobs: env: POSTGRES_DB: fiber POSTGRES_USER: username - POSTGRES_PASSWORD: password + POSTGRES_PASSWORD: "pass#w%rd" options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 @@ -57,4 +57,4 @@ jobs: env: POSTGRES_DATABASE: fiber POSTGRES_USERNAME: username - POSTGRES_PASSWORD: password + POSTGRES_PASSWORD: "pass#w%rd" diff --git a/postgres/postgres.go b/postgres/postgres.go index 2e2dc816..b08d8576 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -55,7 +55,7 @@ func New(config ...Config) *Storage { dsn += url.QueryEscape(cfg.Username) } if cfg.Password != "" { - dsn += ":" + cfg.Password + dsn += ":" + url.QueryEscape(cfg.Password) } if cfg.Username != "" || cfg.Password != "" { dsn += "@"