Socket
Socket
Sign inDemoInstall

express-sanitized

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0 to 0.5.1

36

lib/express-sanitized.js

@@ -30,6 +30,14 @@ /*!

if (_.size(val)) {
_.each(val, function (val, ichild) {
if(val && _.isString(val)){
var sanitized = sanitizer.sanitize(val);
request[ipar][ichild] = sanitized;
_.each(val, function (val, ichild) {
if (val) {
//strings
if (_.isString(val)) {
request[ipar][ichild] = sanitizeString(val);
}
//arrays and objects
if (_.isArray(val) || _.isObject(val)) {
request[ipar][ichild] = sanitizeObject(val);
}
}

@@ -43,2 +51,22 @@ });

}
function sanitizeString(val) {
var sanitized = sanitizer.sanitize(val);
return sanitized;
}
function sanitizeObject(val) {
var restore;
try {
var teardown = JSON.stringify(val);
var clean = sanitizer.sanitize(teardown);
restore = JSON.parse(clean);
} catch (e) {
console.log(e);
restore = val;
}
return restore;
}

2

package.json
{
"name": "express-sanitized",
"description": "Express middleware for the sanitizer module using Caja's HTML Sanitizer.",
"version": "0.5.0",
"version": "0.5.1",
"author": "Patrick Hogan <patrick@callinize.com>",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/askhogan/express-sanitized",

@@ -47,3 +47,3 @@ # express-sanitized

### v0.5.0
### v0.5.1
- Initial release

@@ -50,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc