
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Validation and unit conversion errors in TypeScript at compile-time. Started in 2016.
// Install it with `npm i rulr`
import * as rulr from 'rulr'
// Compile-time error.
const positiveNumber1: rulr.PositiveNumber = -1
// Run-time error.
const positiveNumber2 = rulr.positiveNumber(-1)
// Convenient rules and guards like `object`.
const example = rulr.object({
required: {
price: rulr.positiveNumber,
},
})
// Turn rules into types to avoid duplicating information.
type Example = rulr.Static<typeof example>
// Turn rules into guards to avoid duplicating code.
const isExample = rulr.guard(example)
// Use rules and/or guards to guarantee your data is valid.
const myExample: Example = example({ price: 12.34 })
if (isExample(myExample)) {
console.log(myExample.price)
}
To save you some time, Rulr comes with the following rules.
Since it's quite common to want to restrict the size of strings to avoid UI overflow bugs and DB storage errors, Rulr comes with some convenient rules for doing just that.
Rulr comes with a growing list of convenient rules for constraining strings that are mostly built on Chris O'Hara's extensive and much loved validator package. As with the rules for sized strings above, this can help prevent UI overflow bugs, DB storage errors, and processing errors.
In addition to the constrained strings, Rulr comes with a few convenient rules to help you quickly validate non-string values.
Rulr provides rules that sanitize inputs from HTTP headers and URL params.
Finally, Rulr is starting to provide rule constructors that allow you quickly make your own rules.
Rulr was started in 2016 and first publicised in 2020. It continues to be maintained to save us time writing validation logic and correcting data by returning as many validation errors as possible in one function call.
Rulr has been influenced by Tom Crockett in RunTypes and more recently Colin McDonnell in Zod. It's hoped that if nothing else, publicising Rulr will influence existing and future validation packages for the better.
FAQs
Validation and unit conversion errors in TypeScript at compile-time. Started in 2016.
We found that rulr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.