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.
@shagital/adonisjs-phone-validator
Advanced tools
Adds phone number validation functionality to Adonisjs on the JS port of Google's libphonenumber API by catamphetamine
adonis install @shagital/adonisjs-phone-validator
// via npm
npm require @shagital/adonisjs-phone-validator
// via yarn
yarn add @shagital/adonisjs-phone-validator
Open start/app.js
and add @shagital/adonisjs-phone-validator/providers/PhoneValidatorProvider
to the providers
array
You use the phone
validation syntax just like you'd normally do validation in Adonisjs. Examples below:
NOTE: The country 2-character ISO code is required. You can find all supported codes here
//app/Controllers/Http/UserController
const { validate } = use('Validator')
class UserController {
async store ({ request, session, response }) {
const rules = {
phone: 'required|phone:NG', // validate Nigerian phone number
}
const validation = await validate(request.all(), rules)
if (validation.fails()) {
session
.withErrors(validation.messages())
return response.redirect('back')
}
return 'Validation passed'
}
}
//app/Validators/StoreUser.js
'use strict'
class StoreUser {
get rules () {
return {
phone: 'required|phone:US', // validate a US phone number
}
}
}
Free for all, if you find an issue with the package or think of an improvement, please send in a PR.
FAQs
Phone number validator for Adonisjs
The npm package @shagital/adonisjs-phone-validator receives a total of 0 weekly downloads. As such, @shagital/adonisjs-phone-validator popularity was classified as not popular.
We found that @shagital/adonisjs-phone-validator 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.