Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

  • 4.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
237K
decreased by-25.53%
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 30 Sep 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