Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>dom-protectionNew to Visual Studio Code? Get it now.
dom-protection

dom-protection

dev

|
6 installs
| (0) | Free
Auto-sanitizes innerHTML assignments
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

DOM Protection 🔒

Features

  • 🛡️ Auto-sanitizes innerHTML and dangerouslySetInnerHTML
  • ⚡ Works with JS/TS/JSX/TSX files
  • 🔄 Automatic scanning on file save

Installation

  1. Install via VS Code extensions tab
  2. Search for "DOM Protection"
  3. Click Install

Usage

// Before (vulnerable)
element.innerHTML = userContent;

// After (protected)
element.innerHTML = DOMPurify.sanitize(userContent);

Configuration

Add to settings.json:

"domProtection.enabled": true,
"domProtection.allowedTags": ["b", "i", "a"]

Changelog

Version Changes
1.0.0 Initial release
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft