Skip to main content
ESLint Interlace
Plugin: vercel-ai-security

Overview

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

Live from GitHub

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

AI-Optimized Security

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


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

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

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025

Description

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

Philosophy

Interlace fosters strength through integration. Instead of stacking isolated rules, we interlace security directly into your workflow to create a resilient fabric of code. We believe tools should guide rather than gatekeep, providing educational feedback that strengthens the developer with every interaction.

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 maxSteps limit๐ŸŸข
require-max-tokensCWE-770This rule identifies AI SDK calls that don't specify a maxTokens limit๐ŸŸข
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 security plugins with LLM-optimized error messages:

PluginDownloadsDescription
eslint-plugin-secure-codingdownloadsGeneral security rules & OWASP guidelines.
eslint-plugin-pgdownloadsPostgreSQL security & best practices.
eslint-plugin-node-securitydownloadsNode.js core-module security (fs, child_process, vm, crypto, Buffer).
eslint-plugin-jwtdownloadsJWT security & best practices.
eslint-plugin-browser-securitydownloadsBrowser-specific security & XSS prevention.
eslint-plugin-express-securitydownloadsExpress.js security hardening rules.
eslint-plugin-lambda-securitydownloadsAWS Lambda security best practices.
eslint-plugin-nestjs-securitydownloadsNestJS security rules & patterns.
eslint-plugin-mongodb-securitydownloadsMongoDB security best practices.
eslint-plugin-vercel-ai-securitydownloadsVercel AI SDK security hardening.
eslint-plugin-import-nextdownloadsNext-gen import sorting & architecture.

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin

View README.md on GitHub โ†’

On this page

No Headings