site/docs/code-scanning/vscode-extension.md
The Promptfoo Security Scanner for VS Code detects LLM security vulnerabilities directly in your editor. It finds prompt injection risks, jailbreak vulnerabilities, PII exposure, and other security issues as you code—before they reach your CI pipeline or production.
:::info Enterprise Feature The VS Code extension is available for Promptfoo Enterprise customers. Contact us to get access for your organization. :::
.vsix file)Automatic scanning: Files are scanned when you save. Findings appear as inline diagnostics in your code and in the Problems panel.
Manual scanning: Use the Command Palette (Cmd+Shift+P):
| Shortcut | Command |
|---|---|
| Ctrl+Shift+P F (Mac: Cmd+Shift+P F) | Scan current file |
Right-click in the editor to access:
Configure the extension in VS Code Settings or in your settings.json:
| Setting | Description | Default |
|---|---|---|
promptfoo.apiHost | Promptfoo API host URL | https://api.promptfoo.app |
promptfoo.minimumSeverity | Minimum severity to display | low |
promptfoo.scanOnSave | Auto-scan files on save | true |
promptfoo.scanOnSaveDebounceMs | Debounce delay for auto-scan | 1500 |
promptfoo.diffsOnly | Only analyze code diffs | true |
promptfoo.showCodeLens | Show inline CodeLens annotations | true |
promptfoo.enabledLanguages | Languages to scan | See below |
{
"promptfoo.minimumSeverity": "medium",
"promptfoo.scanOnSave": true,
"promptfoo.scanOnSaveDebounceMs": 2000,
"promptfoo.showCodeLens": true
}
By default, the extension scans:
Customize with the promptfoo.enabledLanguages setting. An empty array enables scanning for all languages.
Findings are classified by severity:
| Level | Icon | Description |
|---|---|---|
| Critical | 🔴 | Immediate security risk |
| High | 🟠 | Significant vulnerability |
| Medium | 🟡 | Moderate concern |
| Low | 🔵 | Minor issue or best practice |
Use the promptfoo.minimumSeverity setting to filter out lower-severity findings.
Code is sent to Promptfoo's servers for analysis and is not stored after analysis completes. For organizations that need to run scans on their own infrastructure, the extension works with Promptfoo Enterprise On-Prem.