[CONJS-139] createConnection(string)` does not support URL-encoded credentials Created: 2020-06-30  Updated: 2020-07-01  Resolved: 2020-07-01

Status: Closed
Project: MariaDB Connector/node.js
Component/s: configuration
Affects Version/s: None
Fix Version/s: 2.4.1

Type: Bug Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

reported from PR-115

In a URL, user/password must be URL-encoded if they contain special characters.
Let's say the password is foo@bar: the corresponding string is foo%40bar.

So if we use a connection string to open a connection, the user/password must be URL-decoded otherwise an error occurs:

mariadb.createConnection("mariadb://user:foo%40bar@localhost:3306/db");
# Error: (conn=9, no: 1045, SQLState: 28000) Access denied for user 'user'@'localhost' (using password: YES)

See: https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/lib/config/connection-options.js#L210
Credentials are passed as-is.



 Comments   
Comment by Diego Dupin [ 2020-07-01 ]

corrected with https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/1fd343a00580b0df45f071ea6377b82b8b0a1be3

Generated at Thu Feb 08 03:23:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.