Skip to main content
interlace
Plugin: vercel-ai-security

eslint-plugin-vercel-ai-security

Vercel AI SDK security rules for generateText, streamText, and LLM tools

AI-Optimized Security

Every rule includes CWE, OWASP LLM Top 10, and CVSS metadata for AI assistants to provide precise, context-aware fixes.

Install

npm install -D eslint-plugin-vercel-ai-security

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

Live README from GitHubfrom eslint-plugin-vercel-ai-security/README.md, cached for 1 hour.Edit on GitHub

⭐ If this plugin caught a real bug for you, star the repo β€” it's the signal that keeps these rules maintained.

Description

This plugin provides Security rules for Vercel AI SDK usage (prompt injection, data handling).

  • Why β€” a linter nobody reads protects nothing. We would rather miss a finding than spend your attention on one that was never real.
  • How β€” evidence, not names. A rule fires on what the code does, resolved through the AST and ESLint's own scope analysis.
  • What β€” every finding carries its fix, in prose for a human and as structured JSON for an agent. Security rules add a CWE mapping and, where assigned, a CVSS score.

That trade costs recall, and we measure it: methodology Β· results Β· a false positive is a bug.

Getting Started

npm install eslint-plugin-vercel-ai-security --save-dev

βš™οΈ Configuration Presets

PresetDescription
recommendedBalanced security (7 errors, 7 warnings)
strictMaximum security (17 errors, 2 warnings)
minimalMinimal config

πŸ“š Supported Libraries

LibrarynpmDownloadsDetection
ai (Vercel AI SDK)npmdownloadsPrompt Injection, Data Leakage

πŸ€– AI-Agent Optimized Messages

All rule messages follow a structured format optimized for AI coding assistants:

πŸ”’ CWE-74 OWASP:A03-Injection CVSS:9 | Unsafe Prompt | CRITICAL [SOC2,GDPR]
   Fix: Validate input before use | https://owasp.org/...

By providing this structured context (CWE, OWASP, Fix), we enable AI tools to reason about the security flaw rather than hallucinating. This allows Copilot/Cursor to suggest the exact correct fix immediately.

πŸ”§ Supported AI SDK Functions

FunctionFull Coverage
generateTextβœ… All 19 rules
streamTextβœ… All 19 rules + abort signal
generateObjectβœ… All 19 rules
streamObjectβœ… All 19 rules + abort signal
tool() helperβœ… Schema validation
embed() / embeddingsβœ… Embedding validation

πŸ“Š Test Coverage

MetricCoverage
Rules19
Tests200
Lines98%+
Functions100%

πŸ™‹ FAQ

What's the difference between this and generic AI security linters?

Generic linters guess at patterns. This plugin knows the exact Vercel AI SDK API.

Does this work with ESLint 9 Flat Config?

Yes! Designed specifically for ESLint Flat Config β€” works on ESLint 8 (with flat config), 9, and 10. See the ESLint Version Support Policy for the full matrix.

How do I suppress a rule for a specific line?

// eslint-disable-next-line vercel-ai-security/require-validated-prompt
await generateText({ prompt: internalPrompt });

Why is ASI06 (Memory Corruption) not covered?

TypeScript/JavaScript are memory-safe languages. Memory corruption vulnerabilities (buffer overflows, use-after-free, etc.) are not possible in these environments.

πŸ“¦ Compatibility

PackageVersion
ai (Vercel AI SDK)npm
ESLintnpm
Node.jsnode

See the ESLint Version Support Policy for the full matrix.

Rules

Legend

IconDescription
πŸ’ΌRecommended: Included in the recommended preset.
⚠️Warns: Set to warn in recommended preset.
πŸ”§Auto-fixable: Automatically fixable by the --fix CLI option.
πŸ’‘Suggestions: Providing code suggestions in IDE.
🚫Deprecated: This rule is deprecated.
🟒Type-unaware: AST-only, runs in oxlint JS-plugin tier.
🟑Type-aware (refining): pure-AST primary path; types refine precision.
🟠Type-aware (graceful): requires TS program; silent without it.
RuleCWEOWASPCVSSDescriptionπŸ§ πŸ’Όβš οΈπŸ”§πŸ’‘πŸš«
no-dynamic-system-promptCWE-74This rule identifies code patterns where system prompts contain dynamic or user-controlled content🟒
no-hardcoded-api-keysCWE-798This rule identifies hardcoded API keys, tokens, and secrets in your codebase that are used with AI SDK proβ€¦πŸŸ’
no-sensitive-in-promptCWE-200This rule identifies code patterns where sensitive data like passwords, API keys, tokens, or personally ideβ€¦πŸŸ’
no-system-prompt-leakCWE-200This rule identifies code patterns where system prompts or AI instructions are returned in API responses, lβ€¦πŸŸ’
no-training-data-exposureCWE-359This rule identifies code patterns where user data might be sent to LLM training endpoints or when trainingβ€¦πŸŸ’
no-unsafe-output-handlingCWE-94This rule identifies code patterns where AI-generated output is passed directly to dangerous functions thatβ€¦πŸŸ’
require-abort-signalCWE-404This rule identifies streaming AI SDK calls (streamText, streamObject) that don't include an AbortSignal foβ€¦πŸŸ’
require-audit-loggingCWE-778This rule identifies AI SDK calls that aren't preceded by logging statements🟒
require-embedding-validationCWE-20This rule identifies code patterns where embeddings are stored in vector databases without validation.🟒
require-error-handlingCWE-755This rule identifies AI SDK calls that aren't wrapped in try-catch blocks🟒
require-max-stepsCWE-834This rule identifies AI SDK calls that use tools but don't specify a step limit (maxSteps or stopWhen)🟒
require-max-tokensCWE-770This rule identifies AI SDK calls that don't specify a token limit (maxTokens or maxOutputTokens)🟒
require-output-filteringCWE-200This rule identifies tool execute functions that return raw data from data sources (databases, APIs, file sβ€¦πŸŸ’
require-output-validationCWE-707This rule identifies code patterns where AI-generated output is displayed to users without validation or faβ€¦πŸŸ’
require-rag-content-validationCWE-74This rule identifies code patterns where content retrieved from vector stores or document retrieval systemsβ€¦πŸŸ’
require-request-timeoutCWE-400This rule identifies AI SDK calls that don't have timeout or abort signal configuration.🟒
require-tool-confirmationCWE-862This rule identifies destructive tools (delete, transfer, execute, etc.) that don't require human confirmatβ€¦πŸŸ’
require-tool-schemaCWE-20Get weather🟒
require-validated-promptCWE-74This rule identifies code patterns where user-controlled input is passed directly to AI prompts without valβ€¦πŸŸ’

Part of the Interlace ESLint ecosystem β€” AI-native rules with LLM-optimized error messages:

Security

PluginDownloadsDescription
eslint-plugin-anthropic-securitydownloadsAnthropic SDK security.
eslint-plugin-browser-securitydownloadsXSS, DOM security.
eslint-plugin-drizzle-securitydownloadsDrizzle security.
eslint-plugin-express-securitydownloadsExpress middleware hardening.
eslint-plugin-gemini-securitydownloadsGoogle Gemini SDK security.
eslint-plugin-jwt-securitydownloadsToken security.
eslint-plugin-knex-securitydownloadsKnex security.
eslint-plugin-lambda-securitydownloadsAWS Lambda hardening.
eslint-plugin-mcp-sdk-securitydownloadsMCP SDK security.
eslint-plugin-mongodb-securitydownloadsMongoDB injection.
eslint-plugin-mysql-securitydownloadsMySQL security.
eslint-plugin-nestjs-securitydownloadsNestJS framework hardening.
eslint-plugin-node-securitydownloadsServer-side patterns.
eslint-plugin-openai-securitydownloadsOpenAI SDK security.
eslint-plugin-postgresql-securitydownloadsPostgreSQL security.
eslint-plugin-prisma-securitydownloadsPrisma security.
eslint-plugin-secure-codingdownloadsInjection prevention.
eslint-plugin-sequelize-securitydownloadsSequelize ORM security.
eslint-plugin-sqlite-securitydownloadsSQLite security.
eslint-plugin-supabase-securitydownloadsSupabase security.
eslint-plugin-typeorm-securitydownloadsTypeORM security.

Code quality

PluginDownloadsDescription
eslint-plugin-conventionsdownloadsTeam-specific habits and styles.
eslint-plugin-import-nextdownloadsFast cycle + import-graph analysis.
eslint-plugin-maintainabilitydownloadsCognitive load and clean-code patterns.
eslint-plugin-modernizationdownloadsESNext migration + syntax evolution.
eslint-plugin-modularitydownloadsStructural integrity and DDD patterns.
eslint-plugin-operabilitydownloadsProduction readiness and resource health.
eslint-plugin-react-a11ydownloadsReact accessibility / WCAG.
eslint-plugin-react-featuresdownloadsReact best practices and optimization.
eslint-plugin-reliabilitydownloadsRuntime stability and error safety.

⭐ Support & follow

If this plugin caught a real bug for you, star the repo β€” stars are the signal that keeps the Interlace ESLint ecosystem maintained β€” and follow the writeups on Dev.to for the benchmarks and security research behind these rules.

GitHub stars

πŸ“„ License

MIT Β© Ofri Peretz

View README.md on GitHub β†’

Building secure JavaScript with Interlace? Star the repo to get new rules and CWE coverage as we ship them β€” or follow the AI-code-security benchmarks behind them.