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.
hmpo-form-controller
Advanced tools
Implements a request pipeline for GET and POST of forms, with input cleaning/formatting and validation.
Implements a request pipeline for GET and POST of forms, with input cleaning/formatting and validation.
Basic usage:
var Form = require('hmpo-form-controller');
var form = new Form({
template: 'form',
fields: {
name: {
validate: 'required'
}
}
});
app.use('/', form.requestHandler());
This won't really be very useful though, since all it will do is render the "form" template on /
and respond to GET and POST requests.
For real-world usage you will probably want to extend the Form class to create your own controllers.
var Form = require('hmpo-form-controller'),
util = require('util');
var MyForm = function (options) {
Form.call(this, options);
};
util.inherits(MyForm, Form);
module.exports = MyForm;
The Form class allows for a number of insertion points for extended functionality:
process
Allows for custom formatting and processing of input prior to validationvalidate
Allows for custom input validationgetValues
To define what values the fields are populated with on GETsaveValues
To define what is done with successful form submissionsAll of these methods take three arguments of the request, the response and a callback. In all cases the callback should be called with a first argument representing an error.
getErrors/setErrors
Define how errors are persisted between the POST and subsequent GET of a form step.locals
Define what additional variables a controller exposes to its templateThese methods are synchronous and take only the request and response obejct as arguments.
FAQs
Implements a request pipeline for GET and POST of forms, with input cleaning/formatting and validation.
The npm package hmpo-form-controller receives a total of 135 weekly downloads. As such, hmpo-form-controller popularity was classified as not popular.
We found that hmpo-form-controller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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’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.