
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@baethon/adonis-validator-extras
Advanced tools
Package contains some extensions for Adonis Validation extension.
# via adonis
adonis install @baethon/adonis-validator-extras
# or for Yarn users
adonis install --yarn @baethon/adonis-validator-extras
# or via yarn
yarn add @baethon/adonis-validator-extras
# or via npm
npm i @baethon/adonis-validator-extras
@baethon/adonis-validator-extras/providers/ValidationExtenderProvider
to application providersModule provides validated()
macro for request instance. It will return data from request which went through route validators.
Only defined data will be returned.
Route
.post('/test', ({ request }) => {
console.log(request.validated())
})
.validator('Test')
This method will fail with exception if request was not validated with validator()
.
Indicative has support for nested rules.
In many ways they can be inconvienient:
class Test {
get rules () {
return {
name: 'required',
'address.street': 'string',
'address.city': 'string'
}
}
}
It gets even worse with arrays:
class Test {
get rules () {
return {
name: 'required',
'family.*.name': 'string',
'family.*.age': 'integer',
}
}
}
Package provides flattenRules
helper which allows to write nested rules in more natural manner and later flatten them to format accepted by Indicative.
const { flattenRules } = require('@baethon/adonis-validator-extras')
class Test {
get rules () {
return {
name: 'required',
family: [{
name: 'string',
age: 'integer'
}]
}
}
}
module.exports = flattenRules(Test)
flattenRules
will process rules only once. Results are cached which means that rules
getter will be static.
Flattened rules support string interpolation of values from ctx
:
const { flattenRules } = require('@baethon/adonis-validator-extras')
class Test {
get rules () {
return {
email: 'unique:users,email,id,{{params.id}}'
}
}
}
module.exports = flattenRules(Test)
It's also possible to call methods from context (without any arguments):
const { flattenRules } = require('@baethon/adonis-validator-extras')
class Test {
get rules () {
return {
email: 'unique:users,email,id,{{request.all().id}}'
}
}
}
module.exports = flattenRules(Test)
If you're planning to contribute to the package please make sure to adhere to following conventions.
npm run lint
to check if there are any linting errorsFAQs
Validator goodies for Adonis framework
We found that @baethon/adonis-validator-extras demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.