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

bleach

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bleach - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

.gitignore

26

lib/bleach.js

@@ -7,3 +7,4 @@ /*

var fs = require('fs');
var fs = require('fs'),
ent = require('ent');

@@ -37,8 +38,10 @@ var bleach = {

attr = attr.split('=');
var attr_name = attr[0],
attr_val = attr.length > 1 ? attr.slice(1).join('=') : null;
// remove quotes from attributes
if (attr[1] && attr[1].charAt(0).match(/'|"/)) attr[1] = attr[1].slice(1);
if (attr[1] && attr[1].charAt(attr[1].length-1).match(/'|"/)) attr[1] = attr[1].slice(0, -1);
if (attr_val && attr_val.charAt(0).match(/'|"/)) attr_val = attr_val.slice(1);
if (attr_val && attr_val.charAt(attr_val.length-1).match(/'|"/)) attr_val = attr_val.slice(0, -1);
attr = {
name: attr[0],
value: attr[1]
name: attr_name,
value: attr_val
};

@@ -70,2 +73,13 @@ if (!attr.value) delete attr.value;

if ((mode == 'white' && list.indexOf('script') == -1)
|| (mode == 'black' && list.indexOf('script') != -1)) {
html = html.replace(/<script(.*?)>(.*?[\r\n])*?(.*?)(.*?[\r\n])*?<\/script>/gim, '');
}
if ((mode == 'white' && list.indexOf('style') == -1)
|| (mode == 'black' && list.indexOf('style') != -1)) {
html = html.replace(/<style(.*?)>(.*?[\r\n])*?(.*?)(.*?[\r\n])*?<\/style>/gim, '');
}
matches.forEach(function(tag){

@@ -85,2 +99,4 @@ if (mode == 'white') {

if ( options.encode_entities ) html = ent.encode( html );
return html;

@@ -87,0 +103,0 @@ },

10

package.json

@@ -5,3 +5,3 @@ {

"description": "A minimalistic HTML sanitizer",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "https://github.com/ecto/bleach/issues",

@@ -16,4 +16,8 @@ "repository": {

},
"dependencies": {},
"devDependencies": {}
"dependencies": {
"ent": "0.0.x"
},
"devDependencies": {
"vows": "0.5.x"
}
}

@@ -136,2 +136,6 @@ # bleach

## disclaimer
This is not a port of the Python **bleach** library - in fact their implementations are very different.
## license

@@ -138,0 +142,0 @@

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