VettCode Testing Instructions

This guide shows you how to test VettCode to verify everything is working correctly.


๐Ÿงช Quick Test

Test Single File

# Build VettCode first npm run build # Test scanning the sample file node dist/index.js scan test-sample.js

Expected Results:

  • โœ… Should detect 8+ secrets (API keys, passwords, tokens)
  • โœ… Should detect 10+ code vulnerabilities (SQL injection, XSS, etc.)
  • โœ… Should show VettCode branding (not tool names)

๐Ÿ“ฆ Test With Dependencies

Create Test Project

# Create test directory mkdir test-project cd test-project # Copy test files copy ..\test-sample.js app.js copy ..\test-package.json package.json # Create package-lock.json npm install --package-lock-only # Go back and scan cd .. node dist/index.js scan test-project

Expected Results:

  • โœ… Should detect 8+ secrets
  • โœ… Should detect 10+ code vulnerabilities
  • โœ… Should detect 4+ vulnerable dependencies (lodash, minimist, axios)
  • โœ… Total findings: 20+ issues

๐ŸŽฏ What Should Be Detected

Secrets (VettCode Secrets Engine)

  • Stripe API key (sk_live_...)
  • OpenAI API key (sk-proj-...)
  • AWS Access Key (AKIA...)
  • AWS Secret Key
  • Database password
  • MongoDB connection string
  • GitHub token (ghp_...)
  • SSH private key
  • Slack webhook URL

Code Vulnerabilities (VettCode Code Analysis)

  • SQL injection (string concatenation)
  • Command injection (exec with user input)
  • Code injection (eval)
  • Path traversal (no sanitization)
  • XSS (unescaped output)
  • Insecure random (Math.random)
  • Weak hashing (MD5)
  • Insecure CORS (allow *)
  • Template injection
  • No input validation

Vulnerable Dependencies (VettCode Dependency Analyzer)

  • lodash 4.17.19 - CVE-2020-8203 (Prototype Pollution)
  • minimist 1.2.5 - CVE-2021-44906 (Prototype Pollution)
  • axios 0.21.1 - CVE-2021-3749 (SSRF)
  • validator 10.8.0 - Multiple vulnerabilities

๐Ÿ” Verify Features

1. Branding Check

Output should show:

โœ“ VettCode Security Analysis:
  โœ“ Secret Detection - 222+ patterns (powered by VettCode secrets engine)
  โœ“ Dependency Vulnerabilities - 40+ formats (powered by VettCode dependency analyzer)
  โœ“ Code Security Analysis - 35+ languages (powered by VettCode SAST engine)

Should NOT show: "Semgrep", "Gitleaks", "OSV-Scanner" in main output

2. Sensors Working

  • โœ… Secrets engine finds API keys and passwords
  • โœ… Dependency analyzer checks package.json/package-lock.json
  • โœ… Code analysis detects SQL injection, XSS, etc. (requires Python)

3. Python Detection

If Python not installed:

โš ๏ธ  Python not found - required for VettCode's advanced code analysis
   You will still get comprehensive scanning (secrets + dependencies)

If Python installed:

โœ… Python is now available!
Full VettCode security analysis enabled.

๐Ÿ Python Requirements

For full functionality (all 3 engines), Python 3.8+ is required.

Check Python

python --version # or python3 --version

Install Python (if needed)

# Auto-install node dist/index.js scan test-sample.js # VettCode will offer to auto-install Python # OR manual setup node dist/index.js setup

๐Ÿ“Š Expected Output Format

  ____          _   _    ____          _
 \ \   / /__| |_| |_ / ___|___   __| | ___
  \ \ / / _ \ __| __| |   / _ \ / _` |/ _ \
   \ V /  __/ |_| |_| |__| (_) | (_| |  __/
    \_/ \___|\__|\__|\____\___/ \__,_|\___|
Security Coach for Developers

โœ“ Found 3 sensor(s)

  VettCode Security Analysis:
    โœ“ Secret Detection - 222+ patterns
    โœ“ Dependency Vulnerabilities - 40+ formats
    โœ“ Code Security Analysis - 35+ languages

โœ“ Project mapped
โœ“ Secret detection complete (8 findings)
โœ“ Dependency analysis complete (4 findings)
โœ“ Code analysis complete (10 findings)
โœ“ Normalized 22 findings
โœ“ Deduplicated (removed 0)
โœ“ Context added
โœ“ Risk assessment complete

Analysis complete

Findings by severity:
  ๐Ÿ”ด 5 Critical
  ๐ŸŸ  8 High
  ๐ŸŸก 7 Medium
  โšช 2 Low

๐Ÿ”ด Critical Issues (showing top 3):

1. Hardcoded Secret - Stripe API Key
   File: test-sample.js:15
   Secret: sk_live_REDACTED_EXAMPLE

2. SQL Injection Vulnerability
   File: test-sample.js:42
   User input directly in SQL query

3. AWS Credentials Exposed
   File: test-sample.js:18
   Access Key: AKIAIOSFODNN7EXAMPLE

๐Ÿ’ก 25 more issues found. Fix these top ones first!

Scanned with: VettCode security analysis

โœ… Success Criteria

Your VettCode installation is working correctly if:

  1. Build succeeds - npm run build completes without errors
  2. Scan runs - node dist/index.js scan test-sample.js executes
  3. Secrets detected - Finds API keys, passwords, tokens
  4. Dependencies scanned - Checks package.json for vulnerabilities
  5. Code analyzed - Detects SQL injection, XSS (if Python available)
  6. Branding correct - Shows "VettCode" not "Semgrep/Gitleaks/OSV"
  7. Results formatted - Clear severity levels, file locations, descriptions

๐Ÿšจ Troubleshooting

No findings detected

# Check if files are being read node dist/index.js scan test-sample.js --verbose # Verify test file exists type test-sample.js

Python not detected

# Check Python manually python --version # Run setup node dist/index.js setup # Try auto-install node dist/index.js scan test-sample.js # (Follow prompts to auto-install)

Scan hangs or freezes

# Use a smaller test echo "const API_KEY = 'sk_live_test123';" > simple-test.js node dist/index.js scan simple-test.js

๐Ÿงน Cleanup

After testing:

# Remove test files del test-sample.js del test-package.json # Remove test project rmdir /s test-project

๐Ÿ“ Quick Commands Summary

# Build npm run build # Test single file (fastest) node dist/index.js scan test-sample.js # Test with dependencies mkdir test-project copy test-sample.js test-project\app.js copy test-package.json test-project\package.json cd test-project && npm install --package-lock-only && cd .. node dist/index.js scan test-project # Check setup node dist/index.js setup # View help node dist/index.js help

๐ŸŽ‰ Success!

If you see VettCode detecting secrets, dependencies, and code vulnerabilities with proper branding, everything is working perfectly!

You now have a self-contained security analysis platform ready to scan real projects.