eslint-plugin-openai-security
v0.3.1
Published
ESLint plugin for OpenAI SDK security — catches dangerouslyAllowBrowser, hardcoded API keys, and system prompts assembled from untrusted input.
Downloads
860
Maintainers
Readme
Note on branding: this row omits the OpenAI mark. OpenAI's logo is not available under a permissive licence, so we don't reproduce it.
⭐ If this plugin caught a real bug for you, star the repo — it's the signal that keeps these rules maintained.
Description
Security rules for openai.
Every rule gates on the SDK actually being imported, so the plugin stays silent in files that don't use it.
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-openai-security --save-dev⚙️ Configuration Presets
| Preset | Description |
| :--- | :--- |
| recommended | Enables every rule at error. |
| strict | Same set as recommended; reserved for rules that are not yet safe by default. |
| minimal | Same set as recommended; reserved for a reduced high-signal subset. |
Usage
// eslint.config.js
import openaiSecurity from 'eslint-plugin-openai-security';
export default [
openaiSecurity.configs.recommended,
];oxlint
Every rule runs on oxlint as well as ESLint:
{ "jsPlugins": ["eslint-plugin-openai-security/oxlint"] }📦 Compatibility
| Package | Version |
| :--- | :--- |
| openai | |
|
@openai/agents | |
| ESLint |
|
| Node.js |
|
See the ESLint Version Support Policy for the full matrix.
Rules
Legend
| Icon | Description |
| :---: | :--- |
| 💼 | 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. |
| Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
| :--- | :--- | :--- | :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
| no-browser-api-key-exposure | CWE-522 | A07:2021 | 8.6 | Forbid dangerouslyAllowBrowser, which exposes the OpenAI API key to the client | 🟢 | 💼 | | | | |
⭐ 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.
🔗 Related ESLint Plugins
Part of the Interlace ESLint Ecosystem — AI-native security plugins with LLM-optimized error messages:
| Plugin | Downloads | Description |
| :--- | :---: | :--- |
| eslint-plugin-vercel-ai-security | | Vercel AI SDK security — prompt injection, output handling. |
|
eslint-plugin-openai-security | | OpenAI SDK security. |
|
eslint-plugin-anthropic-security | | Anthropic SDK and Claude Agent SDK security. |
|
eslint-plugin-gemini-security | | Google Gemini SDK security. |
|
eslint-plugin-mcp-sdk-security | | Model Context Protocol SDK security. |
|
eslint-plugin-secure-coding | | General security rules & OWASP guidelines. |
|
eslint-plugin-node-security | | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
📄 License
MIT © Ofri Peretz
