Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resanitize

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resanitize - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

2

package.json
{ "name" : "resanitize"
, "author" : "Dan MacTough <danmactough@gmail.com>"
, "description" : "Regular expression-based HTML sanitizer and ad remover, geared toward RSS feed descriptions"
, "version" : "0.1.8"
, "version" : "0.1.9"
, "keywords" : ["sanitize", "html", "regexp", "security"]

@@ -6,0 +6,0 @@ , "homepage" : "http://github.com/danmactough/node-resanitize"

@@ -16,2 +16,7 @@ /*!

*
* References:
* - http://en.wikipedia.org/wiki/C0_and_C1_control_codes
* - http://en.wikipedia.org/wiki/Unicode_control_characters
* - http://www.utf8-chartable.de/unicode-utf8-table.pl
*
* @param {String|Buffer} HTML string to sanitize

@@ -31,2 +36,3 @@ * @return {String} sanitized HTML

str = stripAsciiCtrlChars(str);
str = stripExtendedCtrlChars(str);
str = fixSpace(str);

@@ -48,3 +54,4 @@ str = stripComments(str);

function fixSpace (str) {
return str.replace(/\xc2\xa0/g, ' ')
return str.replace(/\u00A0/g, ' ') // Unicode non-breaking space
.replace(/\u2028\u2029/g, '') // UCS newline characters
.replace(/\0/g, '');

@@ -72,2 +79,10 @@ }

/**
* Strip ISO 6429 control characters
*/
function stripExtendedCtrlChars (str) {
return str.replace(/[\u0080-\u009F]+/g, '');
}
module.exports.stripExtendedCtrlChars = stripExtendedCtrlChars;
/**
* Strip HTML comments

@@ -246,8 +261,8 @@ */

/*
/**
* Dumbly strip angle brackets
*/
function stripHtml (str) {
// @TODO
return str;
return str.replace(/<.*?>/g, '');
}
module.exports.stripHtml = stripHtml;
*/
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc