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.
knex-cleaner
Advanced tools
Helper library to clean a PostgreSQL, MySQL or SQLite3 database tables using Knex. Great for integration tests.
npm install knex-cleaner
var knexCleaner = require('knex-cleaner');
var knex = require('knex')({
client: 'mysql',
connection: {
host : '127.0.0.1',
user : 'your_database_user',
password : 'your_database_password',
database : 'myapp_test'
}
});
knexCleaner.clean(knex).then(function() {
// your database is now clean
});
// You can also use this in BookshelfJS
var bookshelf = require('bookshelf')(knex);
knexCleaner.clean(bookshelf.knex).then(function() {
});
// You can also pass if it deletes the tables with delete instead of truncate
// as well as a list of tables to ignore.
var options = {
mode: 'delete', // Valid options 'truncate', 'delete'
restartIdentity: true, // Used to tell PostgresSQL to reset the ID counter
ignoreTables: ['Dont_Del_1', 'Dont_Del_2']
}
knexCleaner.clean(knex, options).then(function() {
// your database is now clean
});
The example above used MySQL but it has been tested on PostgreSQL and SQLite3.
FAQs
Database cleaner for Knex.js and bookshelf.js
The npm package knex-cleaner receives a total of 32,504 weekly downloads. As such, knex-cleaner popularity was classified as popular.
We found that knex-cleaner 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.
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.