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.
prisma-encrypter
Advanced tools
This package allows you to encrypt your models in Prisma
Install the package using npm
npm install prisma-encrypter
If you use ivField on a model, don't forget to include this field in your select/update queries. key argument must be a 32-bits key iv argument must be a 16-bits key
This supports include models, included fields has to include the name of the field, for example accounts -> Account. TODO: analyze prisma.schema to make a correspondance table.
model Item {
id Int @default(autoincrement()) @id
accountId Int?
accounts Account? @relation(fields: [accountId], references: [id])
}
import { PrismaClient } from '@prisma/client';
import { encryptionMiddleware } from 'prisma-encrypter';
const prisma = new PrismaClient();
prisma.$use(
encryptionMiddleware({
global: {
key: 'Xp2r5u8x/A?DcG+KbPeShVmYq3t6v9y$',
},
models: [
{
model: 'User',
fields: ['password'],
},
],
})
);
import { PrismaClient } from '@prisma/client';
import { encryptionMiddleware, encryptModels } from 'prisma-encrypter';
const prisma = new PrismaClient();
prisma.$use(
encryptionMiddleware({
global: {
iv: 'C*F-J@NcRfUjXn2r',
algorithm: 'aes-256-cbc',
},
models: [
{
model: 'User',
fields: ['password', 'secret'],
local: {
key: '2p2r5u8x/A?DcG+KbPeShVmYq3t6v9y1',
ivField: 'hash',
stripIvField: true,
},
},
],
})
);
// In another file, you can add more models (or one using encryptModel).
encryptModels([
{
model: 'Vault',
local: {
key: 'NcRfUjXn2r5u8x!A%D*G-KaPdSgVkYp3',
iv: 'Zq4t7w!z%C*F-J@N',
algorithm: 'aes-256-gcm',
},
},
{
model: 'Entries',
fields: ['code'],
local: {
key: 'w9z$C&F)J@NcRfUjXn2r5u7x!A%D*G-K',
},
},
]);
//
The lib also exposes manualEncrypt() and manualDecrypt()
FAQs
Lightweight encryption solution for Prisma
The npm package prisma-encrypter receives a total of 6 weekly downloads. As such, prisma-encrypter popularity was classified as not popular.
We found that prisma-encrypter 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.