
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
This node module provides a set of methods to interact with PostgreSQL databases.
The module was created as part of KidoZen project, as a connector for its Enterprise API feature.
Use npm to install the module:
> npm install node-pgsql-api
Use npm to run the set of tests
> npm test
Due to the asynchrounous nature of Nodejs, this module uses callbacks in requests. All callbacks have 2 arguments: err and data.
function callback (err, data) {
// err contains an Error class instance, if any
// data contains the resulting data
}
The module exports a class and its constructor requires a configuration object with the following properties
host: Required string. PostgreSQL's host name. By instance: localhostport: Required integer. PostgreSQL's port. By instance: 5432database: Required string. PostgreSQL's database name. By instance: MyAppDBtimeout: Optional integer for the session timeout in milliseconds. Default 15 minutes.username: Optional String. PostgreSQL's username.password: Optional String. User's password.var PgConnector = require("node-pgsql-api");
var pg = new PgConnector({host: 'localhost',
port: 5432,
database: 'TestDB',
username: 'postgres',
password: 'postgres'};
});
If no username and password were provided during the creation (instantiation) of the PostgreSQL connector, they will be required in the authorization method or in the query method.
All public methods have the same signature, their have two arguments: options and callback.
options must be an object instance containig all parameters for the method.callback must be a function.This method should be used for authenticate user's credentials. A successed authentication will return an object intance containing the auth property. The value of this property is the athentication token that could be required by other methods.
Parameters:
credentials: A required object instance containing authentication's parameters:
username: A string with a PostgreSQL's user name.password: A string containing the user's password.callback: A required function for callback.var PgConnector = require('node-pgsql-api');
var con = new PgConnector({host: 'localhost',
port: 5432,
database: 'TestDB'};
con.authenticate({username: 'postgres',
password: 'postgres'},
function(error, authToken){
//error should be null if everything went ok. The error code otherwise.
//authToken is your authorization token.
});
#####Access Token (authorization token)
After the authenticate API call, you get the access token as the 2nd parameter in the callback. This token allows you to reuse the existing connection for the username/password provided.
This method executes the SQL query. It can be any valid SQL (DDL or DML). It can even start a new transaction, commit an active one or rollback it. It should be invoked with an authorization token or with a username/password credential.
Parameters:
data: A required object instance containing the SQL sentence.
sql: A required string with the SQL sentence. It can have placeholders to avoid SQL injection attacks.values: An optional array with the same arity as many placeholders the SQL sentence has.username: An optional string with a PostgreSQL's user name.password: An optional string containing the user's password.auth: An optional string containing the authorization tokencallback: A required function for callback.var data = {sql: "select * from products",
auth: "550e8400-e29b-41d4-a716-446655440000"};
con.query(data, function(error, result){
//error should be null if everything went ok. The error code otherwise.
//result it's an object with the query's result
});
FAQs
KidoZen Node.js PostgreSQL Connector
The npm package pgsql-api receives a total of 6 weekly downloads. As such, pgsql-api popularity was classified as not popular.
We found that pgsql-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.