postgresql-interfaces / psqlodbc

Other
16 stars 15 forks source link

Why does the ODBC driver expect the password in a connection string to be URL-encoded? #42

Open omeuid opened 2 months ago

omeuid commented 2 months ago

ODBC driver expects the password in a connection string to be URL-encoded but I don't find any reason to do that.

This requirement could lead to connection issues when client applications (like Microsoft PowerBI) request the credentials from the user and create a connection string in the following way:

If the password contains characters that need to be encoded and the application does not perform any of the following changes the connection will fail:

Currently, to avoid this issue there are two alternatives:

The first option does not seem feasible many users are using the application. Also, the second option cannot be achieved by generic ODBC clients (for example, Microsoft PowerBI with the generic ODBC connector), as the client could not know this requirement.

I would suggest removing the encode and decode methods included in dlg_specific.c file.

Notes:

Please, feel free to ask anything which is not clear with my description.

davecramer commented 2 months ago

Sorry for the late response.

How else would you put special characters in the password ?

omeuid commented 2 months ago

You could use passwords with special characters like '+', '%' or '$' without requiring to URL-encode those values.

Why do you assume that using one of those characters in the password is a problem?

A generic ODBC client(for any ODBC driver) does not know this kind of requirements for this specific driver. It will use the ODBC api requirerments (See comments section).

So, when a client asks for user credentials, the following connection strings could be created.

The first scenario fails with the current implementation of the driver (the '+' symbol should be URL-escaped).

Please, feel free to ask me anything which is not clear enough.