Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@goodware/mysql
Advanced tools
npm i --save @goodware/mysql
The options provided by the constructor and all other methods accept an optional 'logger' function or object. If an object is provided, it must have the method log().
interface Logger {
/**
* @param tags Typically includes a logging level name, like info or debug.
* @param message An object with at least a message property
*/
log(tags: string[] | string, message: Record<string, unknown>): void;
}
The following program outputs 'success' to the console.
const mysql = require('@goodware/mysql');
const config = {
// host: '0.0.0.0', // This is the default
// port: 3306, // This is the default
// user: 'root', // This is the default
// database: 'mysql', // This is the default
password: 'password',
usePool: true, // Defaults to 10 connections (see connectionLimit in constructor options)
};
async () => {
const connector = new mysql(config, console.log); // The second parameter is a logger function
// Acquire a database connection
const result = await connector.execute( async (connection) => {
// Perform database operations
const [results] = await connection.query(`select 'success' AS status`);
// The Promise resolves to 'success'
return results[0].status;
});
// Close all database connections in the pool
await connector.stop();
// The Promise resolves to 'success'
return result;
}().then(console.info, console.error);
FAQs
A mysql2-based connection helper
We found that @goodware/mysql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.