UNPKG

ubon

Version:

Security scanner for AI-generated apps (Cursor, Lovable, Windsurf, v0). Catches hardcoded secrets, prompt injection, hallucinated imports, Server Actions / Edge runtime mistakes, and the vibe-coded vulnerabilities traditional linters miss.

45 lines 1.85 kB
import { ScanOptions, ScanResult } from '../types'; import { BaseScanner } from './base-scanner'; /** * AIScanner — contextual detections for the AI001–AI008 rule pack. * * Pattern-only checks (AI001, AI004) live in the generic SecurityScanner * pattern runner. This scanner handles the rules that need light AST/JSON * awareness: * * AI002 prompt injection sinks (user input → LLM prompt) * AI003 system prompt / model config leaked into client bundle * AI005 MCP server config with hardcoded secret * AI006 LLM tool/function handler missing auth or allowlist * AI007 streaming LLM endpoint without auth + rate limit * AI008 unbounded LLM call (no max_tokens / no input length guard) * * Heuristics, not a full type system — every finding ships with a * `confidenceReason` so the user can decide. Tuned to surface real risk * without spamming demos and tutorials. */ export declare class AIScanner extends BaseScanner { name: string; private readonly llmCallRegex; private readonly toolBlockRegex; private readonly authMarkerRegex; private readonly rateLimitRegex; private readonly streamingRegex; scan(options: ScanOptions): Promise<ScanResult[]>; /** * Heuristic: a template literal feeding a `system:` / `prompt:` / first * `messages` entry includes an interpolation that names a request input * (`req.body`, `params.`, `searchParams`, `formData`, `input`, `query`). */ private detectPromptInjection; private detectClientSidePrompt; /** * Targets MCP config files: `.cursor/mcp.json`, `mcp.json`, * `claude_desktop_config.json`, `windsurf/mcp.json`. */ private detectMcpSecrets; private detectUnsafeTools; private detectUnauthedStreaming; private detectUnboundedCalls; } //# sourceMappingURL=ai-scanner.d.ts.map