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

Password default change to empty string #134

Merged
merged 4 commits into from
Feb 20, 2024
Merged

Conversation

sitingren
Copy link
Member

Cannot connect to a user with '' as sha512 password. E.g. a dbadmin with following setting

CREATE AUTHENTICATION v_dbadmin_hash METHOD 'hash' HOST '0.0.0.0/0';
ALTER AUTHENTICATION v_dbadmin_hash PRIORITY 10000;
GRANT AUTHENTICATION v_dbadmin_hash TO dbadmin;

The client will overwrite password '' to null and return an error message

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null
    at new NodeError (node:internal/errors:371:5)
    at Function.from (node:buffer:322:9)
    at Object.postgresSha512PasswordHash (/home/sren/node_modules/vertica-nodejs/lib/utils.js:198:44)
    at /home/sren/node_modules/vertica-nodejs/lib/client.js:365:36
    at /home/sren/node_modules/vertica-nodejs/lib/client.js:318:9
    at /home/sren/node_modules/pgpass/lib/index.js:14:20
    at FSReqCallback.oncomplete (node:fs:198:21) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Nodejs driver uses null as password default value. Other vertica drivers use empty string as password default value, it's better to change nodejs driver's default and solve above bug as well.

Copy link
Collaborator

@DMickens DMickens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks for making the changes to align the default behavior with the other drivers

@sitingren sitingren merged commit b61bfb4 into vertica:master Feb 20, 2024
7 checks passed
@sitingren sitingren deleted the empty-pw branch February 20, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants