
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
npm i kya --save
const usernameValidator = {
required: true,
type: String,
}
const schema = kya(
{
username: usernameValidator,
telephone: Number,
},
{
username: {
required: 'username is required',
type: 'Type error!'
},
telephone: {
type: 'Type error!'
},
}
)
schema
.validate({ username: 'kya', age: 19 })
.then(result => {
console.log('result', result) // { username: { valid: true }, telephone: { valid: true } }
})
function kya(schema?: Schema, messages?: Messages): {
validate: (target?: Object) => Promise<Object>;
validateOn: (target?: Object, ...onfields: string[]) => Promise<Object>;
};
interface Schema {
[field: string]: FieldSchema;
}
type SupportType = String | Number | Boolean | Array<any> | Date | Object;
type Type = { type: string; } | SupportType;
type FieldSchema =
(Type & {required?: boolean; }) &
{
[customrule: string]: any
};
export interface Messages {
[field: string]: Object;
}
There are two arguments, schema and message, in kya. Schema is an object that specify fields you want to check, and in each field you wanna specify field schema, where your validation rule goes here. Message is the error message it gonna show whenever your field validation is not valid.
0.2.0 (17/Jan/2019)
Support Javascript native types including:
If there's only type checking in schema, schema can omit "type" key. Before:
const schema = kya({
nested: {
type: {
position: {type: [Number]},
team: {
apple: {type: String},
banana: {type: String},
},
}
},
});
After:
const schema = kya({
nested: {
position: [Number],
team: {
apple: String,
banana: String,
},
}
})
FAQs
Javascript Object Validation
The npm package kya receives a total of 0 weekly downloads. As such, kya popularity was classified as not popular.
We found that kya 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.