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.
Simple data validation for JavaScript
const rules = {
firstName: r.withMessage(r.string, 'should be a string'),
middleName: r.opt(r.string),
lastName: r.string,
age: r.xor(
r.undefined,
r.and(
r.withMessage(r.integer, 'should be an integer'),
r.withMessage(r.range(10, 99), 'should be between 10 and 99'),
),
),
pokedex: r.validate({
serialNumber: r.pattern(/\d\d\d\d-\d\d\d\d/),
pokemonIds: r.array(
withMessage(
r.and(
r.integer,
r.range(1, 151)
), 'should be an integer between 1 and 151')
),
}),
}
const props = {
firstName: 42,
// middleName is optional
lastName: [],
age: '100',
pokedex: {
serialNumber: '1234-5678',
pokemonIds: [23, 1, 56, '11'],
},
}
r
.validate(rules, props)
.then(() => {
// validation successful
})
.catch(err => {
// err {
// firstName: ['should be a string'],
// lastName: [],
// age: ['should be an integer', 'should be between 10 and 99'],
// pokedex: {
// 'pokemonIds[i]': ['should be an integer between 1 and 151'],
// }
// }
})
FAQs
Simple data validation for JavaScript
We found that rattata 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.