Overview
PostgreSQL security and best practices for the pg driver
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, and CVSS metadata for AI assistants to provide precise, context-aware fixes.
Rules (13)
Browse all PostgreSQL security rules with CWE/OWASP mapping
Changelog
View version history and updates
Security rules for PostgreSQL interaction in Node.js (SQL injection prevention).
Description
This plugin provides Security rules for PostgreSQL interaction in Node.js (SQL injection prevention). 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-pg --save-dev๐ก What You Get
- PostgreSQL-specific rules: Catches pg driver anti-patterns that generic linters miss
- LLM-optimized messages: Structured 2-line errors with CWE + fixes that AI assistants can apply
- Connection safety: Prevents leaks, double releases, and transaction race conditions
- SQL security: SQL injection, search_path hijacking, file access via COPY
- Performance patterns: N+1 queries, SELECT *, bulk operation suggestions
Every rule produces a structured error message:
src/db.ts
42:15 error ๐ CWE-89 OWASP:A03-Injection CVSS:9.8 | Unsafe query detected | CRITICAL
Fix: Use parameterized query: client.query('SELECT * FROM users WHERE id = $1', [userId])โ๏ธ Configuration Presets
| Preset | Description |
|---|---|
recommended | Recommended preset - balanced security for most projects |
strict | Strict preset - all rules as errors |
๐ Supported Libraries
| Library | npm | Downloads | Detection |
|---|---|---|---|
pg (node-postgres) | SQL Injection, Connection Leaks |
Custom Configuration
import pg from 'eslint-plugin-pg';
export default [
{
plugins: { pg },
rules: {
'pg/no-unsafe-query': 'error',
'pg/no-select-all': 'off', // Disable if needed
},
},
];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 | ๐ผ | โ ๏ธ | ๐ง | ๐ก | ๐ซ |
|---|---|---|---|---|---|---|---|---|---|
| check-query-params | CWE-20 | A06:2025 | ESLint rule documentation for check-query-params | ๐ผ | โ ๏ธ | ๐ก | |||
| no-batch-insert-loop | CWE-400 | A04:2025 | ESLint rule documentation for no-batch-insert-loop | ๐ผ | โ ๏ธ | ๐ก | |||
| no-floating-query | CWE-252 | A06:2025 | ESLint rule documentation for no-floating-query | ๐ผ | ๐ก | ||||
| no-hardcoded-credentials | CWE-798 | A05:2025 | ESLint rule documentation for no-hardcoded-credentials | ๐ผ | ๐ก | ||||
| no-insecure-ssl | CWE-295 | A05:2025 | ESLint rule documentation for no-insecure-ssl | ๐ผ | ๐ก | ||||
| no-missing-client-release | CWE-772 | A09:2025 | ESLint rule documentation for no-missing-client-release | ๐ผ | ๐ก | ||||
| no-select-all | CWE-400 | A04:2025 | ESLint rule documentation for no-select-all | ๐ผ | โ ๏ธ | ๐ก | |||
| no-transaction-on-pool | CWE-362 | A04:2025 | ESLint rule documentation for no-transaction-on-pool | ๐ผ | ๐ก | ||||
| no-unsafe-copy-from | CWE-22 | A03:2025 | ESLint rule documentation for no-unsafe-copy-from | ๐ผ | ๐ก | ||||
| no-unsafe-query | CWE-89 | A03:2025 | ESLint rule documentation for no-unsafe-query | ๐ผ | ๐ก | ||||
| no-unsafe-search-path | CWE-426 | A01:2025 | ESLint rule documentation for no-unsafe-search-path | ๐ผ | ๐ก | ||||
| prefer-pool-query | CWE-404 | A04:2025 | ESLint rule documentation for prefer-pool-query | ๐ผ | โ ๏ธ | ๐ก | |||
| prevent-double-release | CWE-415 | A04:2025 | ESLint rule documentation for prevent-double-release | ๐ผ | ๐ก |
๐ 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 โ
