
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
objection-password
Advanced tools
This plugin automatically adds automatic password hashing to your Objection.js models. This makes it super-easy to secure passwords and other sensitive data.
Under the hood, the plugin uses bcrypt for hashing.
npm i objection-password
yarn add objection-password
Node Version | Plugin Version |
---|---|
< 12 | 2.x |
>= 12 | >= 3.x |
If you're using Node 12 or greater, use version 3.x
of the plugin as it contains bcrypt 5.x
, which contains important security updates but is only compatible with Node 12+. It's also tested against Objection 2.x.
// import the plugin
const Password = require('objection-password')();
const Model = require('objection').Model;
// mixin the plugin
class Person extends Password(Model) {
static get tableName() {
return 'person';
}
}
const person = await Person.query().insert({
email: 'matt@damon.com',
password: 'q1w2e3r4'
});
console.log(person.password);
// $2a$12$sWSdI13BJ5ipPca/f8KTF.k4eFKsUtobfWdTBoQdj9g9I8JfLmZty
// the password to verify
const password = 'q1w2e3r4';
// fetch the person by email
const person =
await Person.query().first().where({ email: 'matt@damon.com'});
// verify the password is correct
const passwordValid = await person.verifyPassword(password);
There are a few options you can pass to customize the way the plugin works.
These options can be added when instantiating the plugin. For example:
// import the plugin
const Password = require('objection-password')({
passwordField: 'hash'
});
allowEmptyPassword
(defaults to false
)Allows an empty password to be set.
passwordField
(defaults to password
)Allows you to override the name of the field to be hashed.
rounds
(defaults to 12
)The number of number of bcrypt rounds to use when hashing the data.
FAQs
Automatic bcrypt hashing for Objection.js
The npm package objection-password receives a total of 730 weekly downloads. As such, objection-password popularity was classified as not popular.
We found that objection-password 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
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.