Socket
Socket
Sign inDemoInstall

eslint-plugin-no-unsanitized

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-unsanitized

ESLint rule to disallow unsanitized code


Version published
Weekly downloads
287K
increased by6.85%
Maintainers
1
Weekly downloads
 
Created

What is eslint-plugin-no-unsanitized?

eslint-plugin-no-unsanitized is an ESLint plugin that helps developers identify and prevent the use of unsanitized data in potentially dangerous contexts, such as when assigning to innerHTML or other DOM properties that can lead to cross-site scripting (XSS) vulnerabilities.

What are eslint-plugin-no-unsanitized's main functionalities?

Detecting unsanitized assignments to innerHTML

This feature detects when unsanitized data is assigned to the innerHTML property, which can lead to XSS vulnerabilities. The plugin will flag this line of code as an error.

/* eslint no-unsanitized/method: 'error' */
document.body.innerHTML = userInput;

Detecting unsanitized assignments to outerHTML

This feature flags unsanitized data assignments to the outerHTML property, helping to prevent XSS attacks by ensuring that data is properly sanitized before being used in this context.

/* eslint no-unsanitized/method: 'error' */
element.outerHTML = userInput;

Detecting unsanitized assignments to insertAdjacentHTML

This feature identifies when unsanitized data is passed to the insertAdjacentHTML method, which can introduce XSS vulnerabilities. The plugin will flag this usage as an error.

/* eslint no-unsanitized/method: 'error' */
element.insertAdjacentHTML('beforeend', userInput);

Other packages similar to eslint-plugin-no-unsanitized

Keywords

FAQs

Package last updated on 24 Nov 2022

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