New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lettersanitizer

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lettersanitizer - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

1

lib/index.d.ts

@@ -20,2 +20,3 @@ export interface SanitizerOptions {

* Allowed schemas, default: ['http', 'https', 'mailto'].
* Does not apply if rewriteExternalResources and/or rewriteExternalLinks are enabled.
*/

@@ -22,0 +23,0 @@ allowedSchemas?: string[];

25

lib/index.js

@@ -29,17 +29,8 @@ "use strict";

.replace(/url\(["']?(.*?)["']?\)/g, (match, url) => {
let quote = '';
if (match.startsWith('url("')) {
quote = '"';
if (rewriteExternalResources) {
return `url("${encodeURI(rewriteExternalResources(decodeURI(url)))}")`;
}
else if (match.startsWith("url('")) {
quote = "'";
else if (allowedSchemas.includes(url.toLowerCase().split(':')[0])) {
return match;
}
if (allowedSchemas.includes(url.toLowerCase().split(':')[0])) {
if (rewriteExternalResources) {
return 'url(' + quote + rewriteExternalResources(url) + quote + ')';
}
else {
return match;
}
}
else {

@@ -142,6 +133,3 @@ return '';

const value = (_g = element.getAttribute(attribute)) !== null && _g !== void 0 ? _g : '';
if (!allowedSchemas.includes(value.toLowerCase().split(':')[0])) {
element.removeAttribute(attribute);
}
else if (attribute === 'href' && rewriteExternalLinks) {
if (attribute === 'href' && rewriteExternalLinks) {
element.setAttribute(attribute, rewriteExternalLinks(value));

@@ -152,2 +140,5 @@ }

}
else if (!allowedSchemas.includes(value.toLowerCase().split(':')[0])) {
element.removeAttribute(attribute);
}
}

@@ -154,0 +145,0 @@ }

{
"name": "lettersanitizer",
"version": "1.0.2",
"version": "1.0.3",
"description": "DOM-based HTML email sanitizer for in-browser email rendering.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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