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.
Rules (19)
Browse all Vercel AI security rules with OWASP LLM mapping
Changelog
View version history and updates
Security rules for Vercel AI SDK usage (prompt injection, data handling).
Description
This plugin provides Security rules for Vercel AI SDK usage (prompt injection, data handling). By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
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
- To check out the guide, visit eslint.interlace.tools. ๐
- ่ฆๆฅ็ไธญๆ ๆๅ, ่ฏท่ฎฟ้ฎ eslint.interlace.tools. ๐
- ๊ฐ์ด๋ ๋ฌธ์๋ eslint.interlace.tools์์ ํ์ธํ์ค ์ ์์ต๋๋ค. ๐
- ใฌใคใใฏ eslint.interlace.toolsใงใ็ขบ่ชใใ ใใใ ๐
- Para ver la guรญa, visita eslint.interlace.tools. ๐
- ููุงุทูุงุน ุนูู ุงูุฏูููุ ูู ุจุฒูุงุฑุฉ eslint.interlace.tools. ๐
npm install eslint-plugin-vercel-ai-security --save-dev๐ง Supported AI SDK Functions
| Function | Full 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 |
โ๏ธ Configuration Presets
| Preset | Description |
|---|---|
recommended | Balanced security (7 errors, 7 warnings) |
strict | Maximum security (17 errors, 2 warnings) |
minimal | Minimal config |
๐ Test Coverage
| Metric | Coverage |
|---|---|
| Rules | 19 |
| Tests | 200 |
| Lines | 98%+ |
| Functions | 100% |
๐ค 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.
๐ฆ Compatibility
| Package | Version |
|---|---|
ai (Vercel AI SDK) | |
| ESLint | |
| Node.js |
๐ 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.
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.
๐ Supported Libraries
| Library | npm | Downloads | Detection |
|---|---|---|---|
ai (Vercel AI SDK) | Prompt Injection, Data Leakage |
Rules
Legend
| Icon | Description |
|---|---|
| ๐ผ | Recommended: Included in the recommended preset. |
| โ ๏ธ | Warns: Set towarn in recommended preset. |
| ๐ง | Auto-fixable: Automatically fixable by the --fix CLI option. |
| ๐ก | Suggestions: Providing code suggestions in IDE. |
| ๐ซ | Deprecated: This rule is deprecated. |
| Rule | CWE | OWASP | CVSS | Description | ๐ผ | โ ๏ธ | ๐ง | ๐ก | ๐ซ |
|---|---|---|---|---|---|---|---|---|---|
| no-dynamic-system-prompt | CWE-74 | 8.0 | ESLint rule documentation for no-dynamic-system-prompt | ๐ผ | |||||
| no-hardcoded-api-keys | CWE-798 | 8.5 | ESLint rule documentation for no-hardcoded-api-keys | ๐ผ | |||||
| no-sensitive-in-prompt | CWE-200 | 8.0 | ESLint rule documentation for no-sensitive-in-prompt | ๐ผ | |||||
| no-system-prompt-leak | CWE-200 | 7.5 | ESLint rule documentation for no-system-prompt-leak | ๐ผ | |||||
| no-training-data-exposure | CWE-359 | 7.0 | ESLint rule documentation for no-training-data-exposure | ๐ผ | โ ๏ธ | ||||
| no-unsafe-output-handling | CWE-94 | 9.8 | ESLint rule documentation for no-unsafe-output-handling | ๐ผ | |||||
| require-abort-signal | CWE-404 | 4.0 | ESLint rule documentation for require-abort-signal | ๐ก | |||||
| require-audit-logging | CWE-778 | 4.0 | ESLint rule documentation for require-audit-logging | ๐ก | |||||
| require-embedding-validation | CWE-20 | 5.5 | ESLint rule documentation for require-embedding-validation | ๐ก | |||||
| require-error-handling | CWE-755 | 5.0 | ESLint rule documentation for require-error-handling | ๐ก | |||||
| require-max-steps | CWE-834 | 6.5 | ESLint rule documentation for require-max-steps | ๐ผ | โ ๏ธ | ||||
| require-max-tokens | CWE-770 | 6.5 | ESLint rule documentation for require-max-tokens | ๐ผ | โ ๏ธ | ||||
| require-output-filtering | CWE-200 | 6.5 | ESLint rule documentation for require-output-filtering | ๐ผ | โ ๏ธ | ||||
| require-output-validation | CWE-707 | 5.0 | ESLint rule documentation for require-output-validation | ๐ก | |||||
| require-rag-content-validation | CWE-74 | 6.0 | ESLint rule documentation for require-rag-content-validation | ๐ผ | โ ๏ธ | ||||
| require-request-timeout | CWE-400 | 5.0 | ESLint rule documentation for require-request-timeout | ๐ผ | โ ๏ธ | ||||
| require-tool-confirmation | CWE-862 | 7.0 | ESLint rule documentation for require-tool-confirmation | ๐ผ | |||||
| require-tool-schema | CWE-20 | 7.5 | ESLint rule documentation for require-tool-schema | ๐ผ | โ ๏ธ | ||||
| require-validated-prompt | CWE-74 | 9.0 | ESLint rule documentation for require-validated-prompt | ๐ผ |
๐ Related ESLint Plugins
Part of the Interlace ESLint Ecosystem โ AI-native security plugins with LLM-optimized error messages:
| Plugin | Downloads | Description |
|---|---|---|
eslint-plugin-secure-coding | General security rules & OWASP guidelines. | |
eslint-plugin-pg | PostgreSQL security & best practices. | |
eslint-plugin-crypto | NodeJS Cryptography security rules. | |
eslint-plugin-jwt | JWT security & best practices. | |
eslint-plugin-browser-security | Browser-specific security & XSS prevention. | |
eslint-plugin-express-security | Express.js security hardening rules. | |
eslint-plugin-lambda-security | AWS Lambda security best practices. | |
eslint-plugin-nestjs-security | NestJS security rules & patterns. | |
eslint-plugin-mongodb-security | MongoDB security best practices. | |
eslint-plugin-vercel-ai-security | Vercel AI SDK security hardening. | |
eslint-plugin-import-next | Next-gen import sorting & architecture. |
๐ License
MIT ยฉ Ofri Peretz
View README.md on GitHub โ
