Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "xss-mini", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A lightweight library for sanitizing HTML input to prevent XSS attacks.", | ||
@@ -5,0 +5,0 @@ "main": "dist/sanitizeHtml.min.js", |
@@ -9,3 +9,3 @@ # xss-mini | ||
`xss-mini` is a lightweight TypeScript library for sanitizing HTML input to prevent XSS (Cross-Site Scripting) attacks. It allows configurable tags and attributes to be whitelisted. | ||
`xss-mini` is a lightweight Javascript library for sanitizing HTML input to prevent XSS (Cross-Site Scripting) attacks. It allows configurable tags and attributes to be whitelisted. | ||
@@ -18,21 +18,4 @@ ## Installation | ||
Or with yarn | ||
## Usage | ||
```bash | ||
yarn add xss-mini | ||
``` | ||
## Usage | ||
### In TypeScript | ||
```typescript | ||
import xss from 'xss-mini'; | ||
const userInput: string = '<h1>Title</h1> <b>Hello</b> <script>alert("XSS Attack!");</script> <a href="http://example.com" onclick="maliciousFunction()">link</a>'; | ||
const safeHtml: string = xss(userInput); | ||
console.log(safeHtml); // Outputs: <h1>Title</h1> <b>Hello</b> <a href="http://example.com">link</a> | ||
``` | ||
### In JavaScript | ||
@@ -62,4 +45,4 @@ | ||
const userInput: string = '<h1>Title</h1> <b>Hello</b> <script>alert("XSS Attack!");</script> <a href="http://example.com" onclick="maliciousFunction()">link</a>'; | ||
const safeHtml: string = xss(userInput, customAllowedTags, customAllowedAttributes); | ||
const userInput = '<h1>Title</h1> <b>Hello</b> <script>alert("XSS Attack!");</script> <a href="http://example.com" onclick="maliciousFunction()">link</a>'; | ||
const safeHtml = xss(userInput, customAllowedTags, customAllowedAttributes); | ||
@@ -66,0 +49,0 @@ console.log(safeHtml); // Outputs: <h1>Title</h1> <b>Hello</b> <a href="http://example.com">link</a> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4628
2
52