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.
accountdown-parser
Advanced tools
Facilitates account creation and user input validation using accountdown and json-schema
Account creation and user input validation for accountdown using json-schema. Primary usage is on the server.
var validator = require('is-my-json-valid');
var validate = validator({
required: true,
type: 'object',
properties: {
login: {
required: false,
type: 'object',
properties: {
basic: {
required: true,
type: 'object',
properties: {
uuid: {
required: true,
type: 'string'
},
password: {
required: true,
type: 'string'
}
}
}
},
value: {
required: true,
type: 'object',
properties: {
key: {
required: true,
type: 'string'
},
admin: {
required: false,
type: 'boolean'
},
color: {
required: false,
type: 'string'
},
username: {
required: false,
type: 'string'
},
email: {
required: false,
type: 'string'
}
}
}
}
}
}, {
verbose: true
});
opts = {
validate: validate,
format: function (body) {
body.value.admin = !!(body.value.admin);
if (body.value.key && body.login) {
body.login.basic.uuid = body.value.key;
}
return body;
},
updateLoginCreds: function (account) {
return account.hasOwnProperty('login');
}
Return a parser instance p
given an accountdown instance a
.
Set opts.validate
as an instance of is-my-json-valid to define the schema that will be validated for each user instance.
Set an optional opts.format
to define how client-side requests should be parsed.
Another optional, but useful, opts.updateLoginCreds
function defines whether the client's input is updating the login creds, which will require deletion and re-creation of the account when it returns true. Otherwise, only the account's value will be updated.
req
, res
: Parses the req
and res
objects using the body's body/any
module, along with a querystring, and creates an account
Internally, all accounts are created with the key generated from uuid, version 1.
callback(err, account)
fires with any errors or an account
containing the account values.
The same as p.create
except the function opts.updateLoginCreds
is checked to determine whether to delete and recreate the accounts (when opts.updateLoginCreds
exists and returns true), otherwise the new accounts values are put
into the new account.
With npm do:
npm install accountdown-parser
FAQs
Facilitates account creation and user input validation using accountdown and json-schema
The npm package accountdown-parser receives a total of 1 weekly downloads. As such, accountdown-parser popularity was classified as not popular.
We found that accountdown-parser 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.