Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Vulnerability ScannerNew to Visual Studio Code? Get it now.
Vulnerability Scanner

Vulnerability Scanner

Durga Gairhe

|
229 installs
| (1) | Free
A VS Code extension to scan code for vulnerabilities
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Vulnerability Scanner

Overview

The Vulnerability Scanner extension for Visual Studio Code helps developers identify security vulnerabilities in JavaScript code. It automatically scans for common security risks, such as the use of unsafe functions, insecure practices, and potential injection attacks, to improve the security of your codebase.

Features

  • Comprehensive Code Scanning: Scans your JavaScript codebase for vulnerabilities such as the use of eval(), innerHTML, localStorage, and other potentially insecure functions or patterns.
  • Security Alerts: Displays warnings, errors, and suggestions to address potential vulnerabilities.
  • Customizable Security Rules: Extend the built-in rules with your own to tailor the scan to your project’s security requirements.
  • Detailed Diagnostic Information: Highlights specific lines of code where security issues are detected, with explanations and recommended actions.

Installation

Via VS Code Marketplace

  1. Open VS Code Marketplace.
  2. Search for Vulnerability Scanner.
  3. Click Install.

Manual Installation

  1. Download the .vsix file: Download here.
  2. Open VS Code.
  3. Go to the Extensions view by clicking the Extensions icon in the Activity Bar or pressing Ctrl+Shift+X.
  4. Click the three-dot menu icon in the top right corner and select Install from VSIX....
  5. Select the .vsix file you downloaded.

Usage

Scanning Code

  1. Open the Command Palette (Ctrl+Shift+P).
  2. Type and select Scan Code for Vulnerabilities.
  3. The extension will analyze the currently open file or the selected code block, highlighting any vulnerabilities in the Problems panel.

Example Warnings

Here are a few examples of vulnerabilities detected by the extension:

  • Unsafe usage of eval():

    eval("console.log('Dangerous code')"); // Warning: avoid using eval().
    
  • Usage of innerHTML:

    document.getElementById("content").innerHTML = "<p>Content</p>"; // Warning: avoid using innerHTML due to XSS risk.
    
  • Potential SQL Injection:

    const query = `SELECT * FROM users WHERE name = '${userInput}'`; // Error: possible SQL injection.
    

Customizing Rules

You can customize the set of rules by editing your workspace's settings.json file:

{
  "vulnerabilityScanner.rules": ["no-eval", "no-innerHTML", "no-sql-injection"]
}
  • no-eval: Detects the use of eval().
  • no-innerHTML: Flags the usage of innerHTML for potential XSS attacks.
  • no-sql-injection: Warns about unsanitized SQL queries prone to injection.

Supported Vulnerability Rules

Here are some of the built-in rules:

  • Avoid using eval(): Flags usage of eval().
  • Avoid innerHTML: Detects potential XSS risks with innerHTML.
  • SQL Injection: Detects unsanitized SQL queries.
  • Insecure Hashing Algorithms: Flags the usage of weak hashing algorithms (e.g., MD5, SHA-1).
  • Hardcoded Secrets: Detects hardcoded API keys and passwords in the code.
  • Insecure Random Numbers: Warns about the use of Math.random() in cryptographic contexts.
  • Potential Command Injection: Detects unsanitized exec() function calls.
  • Weak JWT Secret: Warns about using short JWT secrets.

Contributing

We welcome contributions from the community! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Create a new Pull Request.

Issues

If you encounter any issues, have questions, or want to request a feature, please file an issue on the Issues page.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

  • Visual Studio Code API Documentation
  • TypeScript
  • OWASP Top 10 for security vulnerabilities

This README update enhances your extension's description with specific examples, supported rules, and contribution guidelines.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft