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

xss-mini

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

xss-mini - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

LICENSE

4

package.json
{
"name": "xss-mini",
"version": "1.0.2",
"version": "1.0.3",
"description": "A lightweight library for sanitizing HTML input to prevent XSS attacks.",

@@ -21,3 +21,3 @@ "main": "dist/sanitizeHtml.min.js",

],
"author": "Your Name",
"author": "Nathan McBride",
"license": "MIT",

@@ -24,0 +24,0 @@ "devDependencies": {

@@ -5,3 +5,3 @@ # xss-mini

[![Build Status](https://img.shields.io/github/actions/workflow/status/brideo/xss-mini/ci.yml?branch=main)](https://github.com/brideo/xss-mini/actions)
[![Test Coverage](https://img.shields.io/coveralls/github/brideo/xss-mini)](https://coveralls.io/github/brideo/xss-mini)
[![Test Coverage](https://coveralls.io/repos/github/brideo/xss-mini/badge.svg?branch=main)](https://coveralls.io/github/brideo/xss-mini)
[![License](https://img.shields.io/npm/l/xss-mini)](https://github.com/brideo/xss-mini/blob/main/LICENSE)

@@ -18,4 +18,21 @@ [![Dependencies](https://img.shields.io/david/brideo/xss-mini)](https://david-dm.org/brideo/xss-mini)

Or with yarn
```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

@@ -45,4 +62,4 @@

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);
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);

@@ -49,0 +66,0 @@ console.log(safeHtml); // Outputs: <h1>Title</h1> <b>Hello</b> <a href="http://example.com">link</a>

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