Skip to main content
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
Interlace

  

Vercel AI SDK

  

oxlint

  

ESLint

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

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025OpenSSF Scorecard

⭐ 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).

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.

Why these rules are quiet

Noise creates apathy, and apathy is not a security posture. A linter that reports a thousand things a week gets switched off in a month, and the real finding goes with it. So every rule here is built to be worth reading: we would rather miss a finding than spend your attention on one that was never real.

That is a trade, and it is made deliberately. It costs recall, and we measure what it costs rather than assuming it is free.

How the rules decide

Evidence, not names. A rule fires on what the code does, resolved through the AST and ESLint's own scope analysis — not on an identifier that happens to contain query, a method called setItem, or a file whose path contains key. Every one of those was a real false positive in this ecosystem, found by reading our own output on open-source projects and fixed with a test that fails on the unfixed rule.

Where a rule has known false-positive shapes, its page carries a Not a finding section: what it deliberately stays quiet on, and what to check first when it fires and you disagree.

What you get

The rules below. Security rules carry a CWE mapping and, where one is assigned, a CVSS score; every rule carries a fix on its message — in prose for a human and as structured JSON for an agent. Install it, enable recommended, and read the findings. If one of them is wrong, open an issue — a false positive is a bug here, not a tuning exercise for you.

How that is measured, on which projects, and where it falls short: benchmark methodology and results.

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 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.

⭐ 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

ESLint Interlace Plugin

Interlace

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.