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

@squiz/xaccel-xss-safe-content

Package Overview
Dependencies
Maintainers
52
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@squiz/xaccel-xss-safe-content

React component that wraps dangerously set inner html to allow for displaying HTML content without xss issues being introduced

  • 1.15.1-beta.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
106
decreased by-32.05%
Maintainers
52
Weekly downloads
 
Created
Source

xss-safe-content

This package provides a React component that will escape dangerous HTML allowing WYSIWYG content to be safely used without possible XSS vulnerability injection vectors being added.

The component takes two defined props and spreads the others as HTML Attributes.

The remaining props are expected to be HTML Elements properties or Class Attributes.

Component Properties

Property NameProperty descriptionProperty TypeIsRequired
contentThe HTML content to be sanitized and rendered inside the component.string[x]
elementTypeThe type of element to render the sanitized content in. Defaults to 'div'.string or React component

Props Example:

<XssSafeContent
  content='<script>alert("This is a test");</script>'
  elementType="section"
  className="customClass"
>
</XssSafeContent>

Usage:

Install the package by running: npm i @squiz/xaccel-xss-safe-content

import { XssSafeContent } from '@squiz/xaccel-xss-safe-content';

function SomeReactComponent({ content }) {
    return <XSSSafeContent content={content} elementType={'div'} />;
}

FAQs

Package last updated on 10 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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