Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequelize CLI Fails to Authenticate with Postgres DB Containing a ':' in Password #1388

Closed
hrabizadeh-sa opened this issue Oct 3, 2023 · 4 comments · Fixed by #1390
Closed

Comments

@hrabizadeh-sa
Copy link

hrabizadeh-sa commented Oct 3, 2023

When attempting to use Sequelize CLI to connect to a PostgreSQL database, an issue arises if the database password contains a colon (':') symbol. The CLI does not handle this special character correctly, causing authentication failures.

I'm using the Sequelize db:migration with and without --url and in both scenarios, Sequelize could authenticate to the database with the same password but sequelize-cli can not connect to run migrations and seeds.

In the file config-helper.js at line 174, we've identified that the
const urlParts = url.parse(urlString);
statement is responsible for decoding encoded URL symbols, including the colon (':').
Due to the following code at line 186, which is
password: urlParts.auth.split(':')[1],
characters in the password field after the colon (':') will be ignored.

@WikiRik
Copy link
Member

WikiRik commented Oct 11, 2023

This was fixed before (see #334) but for some reason reverted. I copied the code from the core repo, can you check if that works? We have minimal test coverage and with the upcoming rewrite I'm not sure if I want to invest the time into it now. Only main thing we changed is that I'm not using _.assign anymore

@hrabizadeh-sa
Copy link
Author

Hi,
I've just reviewed the code and even tested it on the Node console and it seems it is working properly.

Thanks,

Copy link

github-actions bot commented Nov 3, 2023

🎉 This issue has been resolved in version 6.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tejasautkar
Copy link

I am still facing the same issue. my password has |{:]r*+) these special characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants