eslint-plugin-postgresql-security 3.0.5 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +32 -40
  2. package/package.json +3 -7
  3. package/src/index.js +1 -1
package/README.md CHANGED
@@ -22,7 +22,28 @@
22
22
  <a href="https://scorecard.dev/viewer/?uri=github.com/ofri-peretz/eslint" target="_blank"><img src="https://api.securityscorecards.dev/projects/github.com/ofri-peretz/eslint/badge" alt="OpenSSF Scorecard" /></a>
23
23
  </p>
24
24
 
25
- > ⭐ If this plugin caught a real bug for you, [**star the repo**](https://github.com/ofri-peretz/eslint) — it's the signal that keeps these rules maintained.
25
+ ## Getting Started
26
+
27
+ - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-postgresql-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security). 📚
28
+
29
+ <!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
30
+
31
+ ```bash
32
+ npm install --save-dev eslint eslint-plugin-postgresql-security
33
+ ```
34
+
35
+ ```js
36
+ // eslint.config.mjs
37
+ import { configs } from 'eslint-plugin-postgresql-security';
38
+
39
+ export default [configs.recommended];
40
+ ```
41
+
42
+ `recommended` is the preset to start with. The others are listed under Configuration Presets below.
43
+
44
+ Using oxlint or Vite+? Install `oxlint-plugin-postgresql-security`: the same rules under the same `postgresql-security/<rule>` IDs, without ESLint. Its [page](https://www.npmjs.com/package/oxlint-plugin-postgresql-security) has the setup.
45
+
46
+ <!-- AUTO-GENERATED:INSTALL:END -->
26
47
 
27
48
  ## Description
28
49
 
@@ -48,40 +69,6 @@ That trade costs recall, and we measure it:
48
69
 
49
70
  <!-- AUTO-GENERATED:DOCTRINE:END -->
50
71
 
51
- ## Getting Started
52
-
53
- - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-postgresql-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security). 📚
54
-
55
- <!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
56
-
57
- **oxlint / Vite+** — the same rules under the same `postgresql-security/<rule>` IDs, without ESLint:
58
-
59
- ```bash
60
- npm install oxlint-plugin-postgresql-security --save-dev
61
- ```
62
-
63
- ```jsonc
64
- // .oxlintrc.json
65
- { "jsPlugins": ["oxlint-plugin-postgresql-security"] }
66
- ```
67
-
68
- ```ts
69
- // vite.config.ts
70
- import { defineConfig } from 'vite-plus';
71
-
72
- export default defineConfig({
73
- lint: { jsPlugins: ['oxlint-plugin-postgresql-security'] },
74
- });
75
- ```
76
-
77
- **ESLint:**
78
-
79
- ```bash
80
- npm install eslint-plugin-postgresql-security --save-dev
81
- ```
82
-
83
- <!-- AUTO-GENERATED:INSTALL:END -->
84
-
85
72
  ## ⚙️ Configuration Presets
86
73
  | Preset | Description |
87
74
  | :------------ | :------------------------------------------------------- |
@@ -132,6 +119,12 @@ src/db.ts
132
119
 
133
120
  See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md) — current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.
134
121
 
122
+ ### Supported library versions
123
+
124
+ The library ranges the rules were written against, as previously declared in `peerDependencies`. They are documentation only: this package installs and requires none of these libraries, and npm no longer warns on a mismatch.
125
+
126
+ - `pg`: `^6.0.0 || ^7.0.0 || ^8.0.0`
127
+
135
128
  ## Rules
136
129
 
137
130
  **Legend**
@@ -156,12 +149,12 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
156
149
  | [no-hardcoded-credentials](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-hardcoded-credentials?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-798 | | | Prevents hardcoded passwords and connection strings in PostgreSQL client initialization. | 🟢 | 💼 | | | | |
157
150
  | [no-insecure-ssl](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-insecure-ssl?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-295 | | | Prevents disabling SSL certificate validation in PostgreSQL connections. | 🟢 | 💼 | | | | |
158
151
  | [no-missing-client-release](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-missing-client-release?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-772 | | | Ensures acquired pool clients are released back to the pool. | 🟢 | 💼 | | | | |
159
- | [no-select-all](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-select-all?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-693 | | | Discourages SELECT in favor of explicit column lists. | 🟢 | | ⚠️ | | | |
152
+ | [no-select-all](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-select-all?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-1049 | | | Discourages SELECT in favor of explicit column lists. | 🟢 | | ⚠️ | | | |
160
153
  | [no-transaction-on-pool](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-transaction-on-pool?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-362 | | | Prevents running transaction commands directly on pool (must use dedicated client). | 🟢 | 💼 | | | | |
161
154
  | [no-unsafe-copy-from](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-unsafe-copy-from?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-73 | A03:2021 | | Prevents COPY FROM with file paths (should use STDIN for safe client-side data loading). | 🟢 | 💼 | | | | |
162
155
  | [no-unsafe-query](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-unsafe-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-89 | | | SQL injection is one of the most critical security vulnerabilities | 🟢 | 💼 | | | | |
163
156
  | [no-unsafe-search-path](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/no-unsafe-search-path?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-426 | | | Prevents dynamic SET searchpath queries that could enable schema hijacking. | 🟢 | 💼 | | | | |
164
- | [prefer-pool-query](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/prefer-pool-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-693 | | | Suggests using pool.query() for single-shot queries instead of manual connect/release. | 🟢 | | ⚠️ | | | |
157
+ | [prefer-pool-query](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/prefer-pool-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-400 | | | Suggests using pool.query() for single-shot queries instead of manual connect/release. | 🟢 | | ⚠️ | | | |
165
158
  | [prevent-double-release](https://eslint.interlace.tools/docs/security/plugin-postgresql-security/rules/prevent-double-release?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-415 | | | Prevents calling client.release() multiple times on the same client. | 🟢 | | ⚠️ | | | |
166
159
  <!-- AUTO-GENERATED:RULES_TABLE:END -->
167
160
  <!-- AUTO-GENERATED:ECOSYSTEM_TABLE:START - Do not edit manually -->
@@ -213,11 +206,10 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
213
206
  <!-- AUTO-GENERATED:ECOSYSTEM_TABLE:END -->
214
207
 
215
208
  <!-- INTERLACE:STAR_CTA:START -->
216
- ## ⭐ Support & follow
217
209
 
218
- If this plugin caught a real bug for you, **[star the repo](https://github.com/ofri-peretz/eslint)** — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and **[follow the writeups on Dev.to](https://dev.to/ofri-peretz)** for the benchmarks and security research behind these rules.
210
+ ## Support
219
211
 
220
- [![GitHub stars](https://img.shields.io/github/stars/ofri-peretz/eslint?style=social)](https://github.com/ofri-peretz/eslint)
212
+ Found a false positive? [Open an issue](https://github.com/ofri-peretz/eslint/issues): that is a bug. If the plugin helped, a star on [ofri-peretz/eslint](https://github.com/ofri-peretz/eslint) helps others find it.
221
213
 
222
214
  <!-- INTERLACE:STAR_CTA:END -->
223
215
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-postgresql-security",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "description": "ESLint Postgres security rules for the pg PostgreSQL driver — detects SQL injection, unreleased clients, floating queries, unsafe search_path, and insecure SSL.",
5
5
  "type": "commonjs",
6
6
  "sideEffects": false,
@@ -69,19 +69,15 @@
69
69
  "node": ">=22.13.0"
70
70
  },
71
71
  "peerDependencies": {
72
- "eslint": "^8.40.0 || ^9.0.0 || ^10.0.0",
73
- "pg": "^6.0.0 || ^7.0.0 || ^8.0.0"
72
+ "eslint": "^8.40.0 || ^9.0.0 || ^10.0.0"
74
73
  },
75
74
  "peerDependenciesMeta": {
76
75
  "eslint": {
77
76
  "optional": true
78
- },
79
- "pg": {
80
- "optional": true
81
77
  }
82
78
  },
83
79
  "dependencies": {
84
- "@interlace/eslint-devkit": "^2.0.4"
80
+ "@interlace/eslint-devkit": "^2.5.0"
85
81
  },
86
82
  "interlace": {
87
83
  "surface": {
package/src/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-unsafe-query"(){return require("./rules/no-unsafe-query").noUnsafeQuery},get"no-insecure-ssl"(){return require("./rules/no-insecure-ssl").noInsecureSsl},get"no-hardcoded-credentials"(){return require("./rules/no-hardcoded-credentials").noHardcodedCredentials},get"check-query-params"(){return require("./rules/check-query-params").checkQueryParams},get"no-missing-client-release"(){return require("./rules/no-missing-client-release").noMissingClientRelease},get"no-transaction-on-pool"(){return require("./rules/no-transaction-on-pool").noTransactionOnPool},get"no-floating-query"(){return require("./rules/no-floating-query").noFloatingQuery},get"no-select-all"(){return require("./rules/no-select-all").noSelectAll},get"prefer-pool-query"(){return require("./rules/prefer-pool-query").preferPoolQuery},get"no-batch-insert-loop"(){return require("./rules/no-batch-insert-loop").noBatchInsertLoop},get"no-unsafe-search-path"(){return require("./rules/no-unsafe-search-path").noUnsafeSearchPath},get"no-unsafe-copy-from"(){return require("./rules/no-unsafe-copy-from").noUnsafeCopyFrom},get"prevent-double-release"(){return require("./rules/prevent-double-release").preventDoubleRelease}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-postgresql-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-postgresql-security",version:"3.0.5"},rules:exports.rules};exports.configs={flagship:{plugins:{"postgresql-security":exports.plugin,"pg":exports.plugin},rules:{"postgresql-security/no-unsafe-query":"error"}},recommended:{plugins:{"postgresql-security":exports.plugin,"pg":exports.plugin},rules:{"postgresql-security/no-unsafe-query":"error","postgresql-security/no-insecure-ssl":"error","postgresql-security/no-hardcoded-credentials":"error","postgresql-security/no-unsafe-search-path":"error","postgresql-security/no-unsafe-copy-from":"error","postgresql-security/no-transaction-on-pool":"error","postgresql-security/no-missing-client-release":"error","postgresql-security/prevent-double-release":"warn","postgresql-security/no-floating-query":"warn","postgresql-security/check-query-params":"warn","postgresql-security/no-select-all":"warn","postgresql-security/prefer-pool-query":"warn","postgresql-security/no-batch-insert-loop":"warn"}},strict:{plugins:{"postgresql-security":exports.plugin,"pg":exports.plugin},rules:{"postgresql-security/no-unsafe-query":"error","postgresql-security/no-insecure-ssl":"error","postgresql-security/no-hardcoded-credentials":"error","postgresql-security/no-unsafe-search-path":"error","postgresql-security/no-unsafe-copy-from":"error","postgresql-security/no-transaction-on-pool":"error","postgresql-security/no-missing-client-release":"error","postgresql-security/prevent-double-release":"error","postgresql-security/no-floating-query":"error","postgresql-security/check-query-params":"error","postgresql-security/no-select-all":"error","postgresql-security/prefer-pool-query":"error","postgresql-security/no-batch-insert-loop":"error"}}};exports.default=exports.plugin;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-unsafe-query"(){return require("./rules/no-unsafe-query").noUnsafeQuery},get"no-insecure-ssl"(){return require("./rules/no-insecure-ssl").noInsecureSsl},get"no-hardcoded-credentials"(){return require("./rules/no-hardcoded-credentials").noHardcodedCredentials},get"check-query-params"(){return require("./rules/check-query-params").checkQueryParams},get"no-missing-client-release"(){return require("./rules/no-missing-client-release").noMissingClientRelease},get"no-transaction-on-pool"(){return require("./rules/no-transaction-on-pool").noTransactionOnPool},get"no-floating-query"(){return require("./rules/no-floating-query").noFloatingQuery},get"no-select-all"(){return require("./rules/no-select-all").noSelectAll},get"prefer-pool-query"(){return require("./rules/prefer-pool-query").preferPoolQuery},get"no-batch-insert-loop"(){return require("./rules/no-batch-insert-loop").noBatchInsertLoop},get"no-unsafe-search-path"(){return require("./rules/no-unsafe-search-path").noUnsafeSearchPath},get"no-unsafe-copy-from"(){return require("./rules/no-unsafe-copy-from").noUnsafeCopyFrom},get"prevent-double-release"(){return require("./rules/prevent-double-release").preventDoubleRelease}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-postgresql-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-postgresql-security",version:"3.0.7"},rules:exports.rules};exports.configs={flagship:{plugins:{"postgresql-security":exports.plugin,"pg":exports.plugin},rules:{"postgresql-security/no-unsafe-query":"error"}},recommended:{plugins:{"postgresql-security":exports.plugin,"pg":exports.plugin},rules:{"postgresql-security/no-unsafe-query":"error","postgresql-security/no-insecure-ssl":"error","postgresql-security/no-hardcoded-credentials":"error","postgresql-security/no-unsafe-search-path":"error","postgresql-security/no-unsafe-copy-from":"error","postgresql-security/no-transaction-on-pool":"error","postgresql-security/no-missing-client-release":"error","postgresql-security/prevent-double-release":"warn","postgresql-security/no-floating-query":"warn","postgresql-security/check-query-params":"warn","postgresql-security/no-select-all":"warn","postgresql-security/prefer-pool-query":"warn","postgresql-security/no-batch-insert-loop":"warn"}},strict:{plugins:{"postgresql-security":exports.plugin,"pg":exports.plugin},rules:{"postgresql-security/no-unsafe-query":"error","postgresql-security/no-insecure-ssl":"error","postgresql-security/no-hardcoded-credentials":"error","postgresql-security/no-unsafe-search-path":"error","postgresql-security/no-unsafe-copy-from":"error","postgresql-security/no-transaction-on-pool":"error","postgresql-security/no-missing-client-release":"error","postgresql-security/prevent-double-release":"error","postgresql-security/no-floating-query":"error","postgresql-security/check-query-params":"error","postgresql-security/no-select-all":"error","postgresql-security/prefer-pool-query":"error","postgresql-security/no-batch-insert-loop":"error"}}};exports.default=exports.plugin;