1.15.0-beta.1 • Published 21 days ago

@squiz/xaccel-xss-safe-content v1.15.0-beta.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
21 days ago

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.stringx
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'} />;
}
1.14.0-alpha.1

21 days ago

1.15.0-beta.1

21 days ago

1.13.1

3 months ago

1.13.0-beta.2

3 months ago

1.12.1

4 months ago

1.13.0-beta.1

4 months ago

1.13.0-alpha.4

4 months ago

1.13.0-alpha.5

4 months ago

1.9.1-alpha.0

4 months ago

1.12.1-alpha.0

4 months ago

1.12.1-alpha.1

4 months ago

1.9.1-beta.0

4 months ago

1.12.1-beta.0

4 months ago

1.9.0

4 months ago

1.9.0-beta.36

4 months ago

1.11.0-alpha.15

5 months ago

1.11.0-alpha.9

5 months ago

1.9.0-beta.28

5 months ago

1.10.0-alpha.9

7 months ago

1.9.0-beta.17

7 months ago

1.10.0-alpha.8

7 months ago

1.10.0-alpha.7

7 months ago

1.10.0-alpha.6

7 months ago

1.10.0-alpha.5

7 months ago

1.10.0-alpha.3

7 months ago

1.9.0-beta.10

7 months ago

1.9.0-alpha.13

7 months ago

1.9.0-beta.8

7 months ago

1.9.0-alpha.9

7 months ago

1.9.0-alpha.3

7 months ago

1.9.0-beta.1

7 months ago

1.6.0-alpha.0

7 months ago

1.5.1-beta.0

7 months ago

1.5.0-alpha.3

7 months ago

1.5.0-beta.0

7 months ago

1.2.0

9 months ago

1.1.0

9 months ago