eslint-plugin-postgresql-security 1.5.0

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 (95) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/LICENSE +23 -0
  3. package/README.md +169 -0
  4. package/dist/AGENTS.md +118 -0
  5. package/dist/CHANGELOG.md +150 -0
  6. package/dist/LICENSE +23 -0
  7. package/dist/README.md +169 -0
  8. package/dist/package.json +99 -0
  9. package/dist/src/constants.d.ts +6 -0
  10. package/dist/src/constants.js +13 -0
  11. package/dist/src/index.d.ts +26 -0
  12. package/dist/src/index.js +116 -0
  13. package/dist/src/oxlint.d.ts +20 -0
  14. package/dist/src/oxlint.js +21 -0
  15. package/dist/src/rules/check-query-params/index.d.ts +8 -0
  16. package/dist/src/rules/check-query-params/index.js +90 -0
  17. package/dist/src/rules/no-batch-insert-loop/index.d.ts +8 -0
  18. package/dist/src/rules/no-batch-insert-loop/index.js +90 -0
  19. package/dist/src/rules/no-floating-query/index.d.ts +8 -0
  20. package/dist/src/rules/no-floating-query/index.js +74 -0
  21. package/dist/src/rules/no-hardcoded-credentials/index.d.ts +8 -0
  22. package/dist/src/rules/no-hardcoded-credentials/index.js +86 -0
  23. package/dist/src/rules/no-insecure-ssl/index.d.ts +8 -0
  24. package/dist/src/rules/no-insecure-ssl/index.js +66 -0
  25. package/dist/src/rules/no-missing-client-release/index.d.ts +8 -0
  26. package/dist/src/rules/no-missing-client-release/index.js +85 -0
  27. package/dist/src/rules/no-select-all/index.d.ts +8 -0
  28. package/dist/src/rules/no-select-all/index.js +79 -0
  29. package/dist/src/rules/no-transaction-on-pool/index.d.ts +8 -0
  30. package/dist/src/rules/no-transaction-on-pool/index.js +71 -0
  31. package/dist/src/rules/no-unsafe-copy-from/index.d.ts +10 -0
  32. package/dist/src/rules/no-unsafe-copy-from/index.js +205 -0
  33. package/dist/src/rules/no-unsafe-query/index.d.ts +8 -0
  34. package/dist/src/rules/no-unsafe-query/index.js +132 -0
  35. package/dist/src/rules/no-unsafe-search-path/index.d.ts +8 -0
  36. package/dist/src/rules/no-unsafe-search-path/index.js +144 -0
  37. package/dist/src/rules/prefer-pool-query/index.d.ts +8 -0
  38. package/dist/src/rules/prefer-pool-query/index.js +104 -0
  39. package/dist/src/rules/prevent-double-release/index.d.ts +8 -0
  40. package/dist/src/rules/prevent-double-release/index.js +456 -0
  41. package/dist/src/types/index.d.ts +54 -0
  42. package/dist/src/types/index.js +7 -0
  43. package/package.json +99 -0
  44. package/src/__compatibility__/pg-interface.spec.ts +495 -0
  45. package/src/constants.ts +11 -0
  46. package/src/index.spec.ts +14 -0
  47. package/src/index.test.ts +59 -0
  48. package/src/index.ts +130 -0
  49. package/src/oxlint.spec.ts +70 -0
  50. package/src/oxlint.ts +23 -0
  51. package/src/rules/check-query-params/check-query-params.test.ts +68 -0
  52. package/src/rules/check-query-params/index.spec.ts +117 -0
  53. package/src/rules/check-query-params/index.ts +106 -0
  54. package/src/rules/no-batch-insert-loop/index.spec.ts +105 -0
  55. package/src/rules/no-batch-insert-loop/index.ts +105 -0
  56. package/src/rules/no-batch-insert-loop/no-batch-insert-loop.test.ts +68 -0
  57. package/src/rules/no-floating-query/index.spec.ts +112 -0
  58. package/src/rules/no-floating-query/index.ts +81 -0
  59. package/src/rules/no-floating-query/no-floating-query.test.ts +68 -0
  60. package/src/rules/no-hardcoded-credentials/index.spec.ts +38 -0
  61. package/src/rules/no-hardcoded-credentials/index.ts +93 -0
  62. package/src/rules/no-hardcoded-credentials/no-hardcoded-credentials.test.ts +68 -0
  63. package/src/rules/no-insecure-ssl/index.spec.ts +40 -0
  64. package/src/rules/no-insecure-ssl/index.ts +81 -0
  65. package/src/rules/no-insecure-ssl/no-insecure-ssl.test.ts +68 -0
  66. package/src/rules/no-missing-client-release/coverage-gaps.spec.ts +42 -0
  67. package/src/rules/no-missing-client-release/index.spec.ts +52 -0
  68. package/src/rules/no-missing-client-release/index.ts +100 -0
  69. package/src/rules/no-missing-client-release/no-missing-client-release.test.ts +68 -0
  70. package/src/rules/no-select-all/index.spec.ts +44 -0
  71. package/src/rules/no-select-all/index.ts +92 -0
  72. package/src/rules/no-select-all/no-select-all.test.ts +68 -0
  73. package/src/rules/no-transaction-on-pool/index.spec.ts +36 -0
  74. package/src/rules/no-transaction-on-pool/index.ts +85 -0
  75. package/src/rules/no-transaction-on-pool/no-transaction-on-pool.test.ts +68 -0
  76. package/src/rules/no-unsafe-copy-from/coverage-gaps.spec.ts +76 -0
  77. package/src/rules/no-unsafe-copy-from/index.spec.ts +274 -0
  78. package/src/rules/no-unsafe-copy-from/index.ts +226 -0
  79. package/src/rules/no-unsafe-copy-from/no-unsafe-copy-from.test.ts +78 -0
  80. package/src/rules/no-unsafe-query/coverage-gaps.spec.ts +61 -0
  81. package/src/rules/no-unsafe-query/index.spec.ts +103 -0
  82. package/src/rules/no-unsafe-query/index.ts +149 -0
  83. package/src/rules/no-unsafe-query/no-unsafe-query.test.ts +73 -0
  84. package/src/rules/no-unsafe-search-path/index.spec.ts +46 -0
  85. package/src/rules/no-unsafe-search-path/index.ts +164 -0
  86. package/src/rules/no-unsafe-search-path/no-unsafe-search-path.test.ts +68 -0
  87. package/src/rules/prefer-pool-query/coverage-gaps.spec.ts +76 -0
  88. package/src/rules/prefer-pool-query/index.spec.ts +97 -0
  89. package/src/rules/prefer-pool-query/index.ts +118 -0
  90. package/src/rules/prefer-pool-query/prefer-pool-query.test.ts +68 -0
  91. package/src/rules/prevent-double-release/coverage-gaps.spec.ts +538 -0
  92. package/src/rules/prevent-double-release/index.spec.ts +824 -0
  93. package/src/rules/prevent-double-release/index.ts +534 -0
  94. package/src/rules/prevent-double-release/prevent-double-release.test.ts +70 -0
  95. package/src/types/index.ts +58 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,150 @@
1
+ ## [1.4.3] - 2026-02-08
2
+
3
+ ## 1.4.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#294](https://github.com/ofri-peretz/eslint/pull/294) [`659f6dc`](https://github.com/ofri-peretz/eslint/commit/659f6dc0181b03b675f72b5949fcf123dd066358) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Rewrite `description` and `keywords` on every published package for npm search discovery. npm ranks on name, description, and keywords, and the registry only picks up these fields at publish — so this is metadata-only and takes effect for each package on its next release.
8
+
9
+ **Descriptions now lead with the search phrase.** Every one starts `ESLint plugin for <the thing you'd search>` instead of a brand-first or category-first framing, and names the concrete vulnerabilities the plugin actually detects. Three were corrected while doing so:
10
+
11
+ - `eslint-plugin-import-next` claimed "100x faster no-cycle detection". No 100x measurement exists: `CLAIMS.md` records **3.1x end-to-end** (8x in pure rule execution) on a 5,483-file React codebase, and the highest number in any benchmark result is 54.9x on the synthetic corpus. The description now states the real-codebase figure.
12
+ - `eslint-plugin-secure-coding` claimed SQL injection, XSS and CSRF coverage — none of which are its rules. It now names what it does detect: LDAP, XPath, XXE, GraphQL and template injection, unsafe deserialization, ReDoS, missing authentication, and PII in logs.
13
+ - `eslint-plugin-secure-coding` ("89 rules") and `eslint-plugin-react-a11y` ("37 rules") hard-coded rule counts that had drifted from reality. Counts are generated into `interlace-numbers.json`; hand-typed copies are removed rather than corrected.
14
+
15
+ **Keywords now match the vocabulary of the plugins that rank.** `eslint-plugin-security`, `eslint-plugin-jsx-a11y`, `eslint-plugin-n` and `eslint-plugin-import` all carry the `eslint` / `eslintplugin` / `eslint-plugin` trio — six of our packages were missing `eslintplugin`, and every one now carries all three plus `static-analysis`, `linting` and `code-quality`. Security plugins add `sast`, `appsec` and `vulnerability`; `node-security` and `secure-coding` also carry `nodesecurity`, the exact keyword `eslint-plugin-security` ranks on. Each plugin gained the CWE identifiers and attack names for what it detects (`cwe-78` command injection, `cwe-22` path traversal, `cwe-89` SQL injection, `cwe-79` XSS, `cwe-347` JWT algorithm confusion, `cwe-352` CSRF, `cwe-943` NoSQL injection), and `node-security` gained the crypto vocabulary it had been missing entirely despite absorbing the crypto rule set (`crypto`, `cryptography`, `weak-hash`, `md5`, `sha1`, `timing-attack`).
16
+
17
+ No rule behavior, exports, or configuration changes.
18
+
19
+ - Updated dependencies [[`e1cdf83`](https://github.com/ofri-peretz/eslint/commit/e1cdf83e3db761907f0ab06f7fc6c1f1da7513a5), [`659f6dc`](https://github.com/ofri-peretz/eslint/commit/659f6dc0181b03b675f72b5949fcf123dd066358)]:
20
+ - @interlace/eslint-devkit@1.4.3
21
+
22
+ ## 1.4.8
23
+
24
+ ### Patch Changes
25
+
26
+ - [#269](https://github.com/ofri-peretz/eslint/pull/269) [`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - docs: dual-logo README header (Interlace mark + ESLint mark side by side) and closing Interlace footer — refreshes the README rendered on npmjs.com. No runtime changes.
27
+
28
+ - Updated dependencies [[`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad)]:
29
+ - @interlace/eslint-devkit@1.4.2
30
+
31
+ ## 1.4.7
32
+
33
+ ### Patch Changes
34
+
35
+ - [#252](https://github.com/ofri-peretz/eslint/pull/252) [`d67e395`](https://github.com/ofri-peretz/eslint/commit/d67e3953c2748ad36e6aebe0f24b1d04e518b4d0) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix Codecov badge showing "unknown" — switch from flag to component URL format
36
+
37
+ ## 1.4.6
38
+
39
+ ### Patch Changes
40
+
41
+ - [#225](https://github.com/ofri-peretz/eslint/pull/225) [`34ff5a8`](https://github.com/ofri-peretz/eslint/commit/34ff5a8e6f5126c5d1c0a524759e0af2b5476b46) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - CI-only: pin all coverage thresholds at 100% (integration target, merges last).
42
+
43
+ ## 1.4.5
44
+
45
+ ### Patch Changes
46
+
47
+ - [#213](https://github.com/ofri-peretz/eslint/pull/213) [`391dbe6`](https://github.com/ofri-peretz/eslint/commit/391dbe6b39f78d549379218567cb959649f8c614) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Align every security rule's `meta.docs.cvss` to the CVSS its finding actually
48
+ emits. The emitted machine-readable message sources its `CVSS:x` from
49
+ `CWE_MAPPING` via `formatLLMMessage` → `enrichFromCWE`, but the static
50
+ `meta.docs.cvss` documentation field had drifted on 45 rules across these 7
51
+ plugins — e.g. `no-hardcoded-credentials` documented `9.5` while emitting
52
+ `CVSS:9.8` (the value the published article and SARIF/LLM consumers already
53
+ read).
54
+
55
+ This corrects the **documentation metadata only** — no emitted finding changes.
56
+ Locked by `security-cvss-docs-consistency.lock.test.ts` (cross-plugin: every
57
+ security rule's `meta.docs.cvss` must equal the CVSS it emits), the
58
+ `no-hardcoded-credentials` rule lock (real ESLint `Linter` emission), and a
59
+ devkit `enrichFromCWE` contract test pinning `CWE-798 → 9.8`.
60
+
61
+ Follow-up (not in scope): 50 security rules document a CVSS that never appears
62
+ in any emitted message (their messages carry no CWE), and several rules emit the
63
+ generic CWE score where a rule-specific score may be warranted — both change
64
+ emitted output and are separate decisions.
65
+
66
+ ## 1.4.4
67
+
68
+ ### Patch Changes
69
+
70
+ - [#143](https://github.com/ofri-peretz/eslint/pull/143) [`213cde1`](https://github.com/ofri-peretz/eslint/commit/213cde190ff2aea49ca7c1b533170940f879d9b4) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix(no-missing-null-checks): eliminate 53 false positives via three new narrowing patterns
71
+
72
+ Rules that were recognized as null guards are now correctly identified as safe:
73
+ 1. **Truthy if guard** — `if (obj) { obj.prop }` — direct truthy check proves non-null. Also covers chains: `if (response)` protects `response.data.items`.
74
+ 2. **Short-circuit AND** — `obj && obj.prop` — right side of `&&` only runs when left is truthy.
75
+ 3. **Ternary consequent** — `obj ? obj.prop : fallback` — truthy test guards the consequent.
76
+
77
+ Also: bumped `beforeAll` timeout to 30 seconds in 7 compatibility test files (`__compatibility__/*.spec.ts`). Native-addon packages routinely exceed the previous 10-second default on a cold ESM load.
78
+
79
+ - Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
80
+ - @interlace/eslint-devkit@1.4.1
81
+
82
+ ### Bug Fixes
83
+
84
+ - align codecov component IDs with full package names ([2831b968](https://github.com/ofri-peretz/eslint/commit/2831b968))
85
+ - resolve all benchmark FN/FP across security rules ([45ffb791](https://github.com/ofri-peretz/eslint/commit/45ffb791))
86
+
87
+ ### Documentation
88
+
89
+ - fix changelog header format across all packages ([c3a15082](https://github.com/ofri-peretz/eslint/commit/c3a15082))
90
+
91
+ ### ❤️ Thank You
92
+
93
+ - Ofri Peretz
94
+
95
+ ## [1.4.2] - 2026-02-06
96
+
97
+ ### Bug Fixes
98
+
99
+ - align codecov component names and update docs components ([0a59a86c](https://github.com/ofri-peretz/eslint/commit/0a59a86c))
100
+
101
+ ### ❤️ Thank You
102
+
103
+ - Ofri Peretz
104
+
105
+ ## [1.4.1] - 2026-02-02
106
+
107
+ This was a version bump only for eslint-plugin-postgresql-security to align it with other projects, there were no code changes.
108
+
109
+ # Changelog
110
+
111
+ All notable changes to `eslint-plugin-postgresql-security` will be documented in this file.
112
+
113
+ ## [0.0.1] - 2024-12-20
114
+
115
+ ### Added
116
+
117
+ - Initial release with 13 rules for PostgreSQL security and best practices
118
+
119
+ #### Security Rules (6)
120
+
121
+ - `no-unsafe-query` - Prevents SQL injection via string interpolation
122
+ - `no-insecure-ssl` - Prevents disabling SSL certificate validation
123
+ - `no-hardcoded-credentials` - Prevents hardcoded passwords in config
124
+ - `no-unsafe-search-path` - Prevents dynamic search_path hijacking
125
+ - `no-unsafe-copy-from` - Prevents COPY FROM file path exposure
126
+ - `no-transaction-on-pool` - Prevents transaction commands on pool
127
+
128
+ #### Resource Management Rules (3)
129
+
130
+ - `no-missing-client-release` - Ensures pool clients are released
131
+ - `prevent-double-release` - Prevents double client.release()
132
+ - `no-floating-query` - Ensures query promises are handled
133
+
134
+ #### Quality & Performance Rules (4)
135
+
136
+ - `check-query-params` - Validates parameter count matches placeholders
137
+ - `no-select-all` - Discourages SELECT \*
138
+ - `prefer-pool-query` - Suggests pool.query() for simple queries
139
+ - `no-batch-insert-loop` - Prevents N+1 mutation queries
140
+
141
+ #### Presets
142
+
143
+ - `recommended` - Balanced security and quality settings
144
+ - `strict` - All rules as errors
145
+
146
+ #### Documentation
147
+
148
+ - Full documentation for all 13 rules
149
+ - AGENTS.md for AI assistant integration
150
+ - Benchmark folder for capability demonstration
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ofri Peretz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ <p align="center">
2
+ <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security" target="blank"><img src="https://eslint.interlace.tools/icon-light.svg" alt="Interlace" height="90" /></a>
3
+ &nbsp;&nbsp;
4
+ <a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/eslint-logo.svg" alt="ESLint" height="90" /></a>
5
+ &nbsp;&nbsp;
6
+ <a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/oxlint-logo.svg" alt="oxlint" height="90" /></a>
7
+ &nbsp;&nbsp;
8
+ <a href="https://www.npmjs.com/package/pg" target="_blank"><img src="https://eslint.interlace.tools/postgresql-logo.svg" alt="PostgreSQL" height="90" /></a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ Security rules for PostgreSQL interaction in Node.js (SQL injection prevention).
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://www.npmjs.com/package/eslint-plugin-postgresql-security" target="_blank"><img src="https://img.shields.io/npm/v/eslint-plugin-postgresql-security.svg" alt="NPM Version" /></a>
17
+ <a href="https://www.npmjs.com/package/eslint-plugin-postgresql-security" target="_blank"><img src="https://img.shields.io/npm/dm/eslint-plugin-postgresql-security.svg" alt="NPM Downloads" /></a>
18
+ <a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Package License" /></a>
19
+ <a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=eslint-plugin-postgresql-security" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=eslint-plugin-postgresql-security" alt="Codecov" /></a>
20
+ <a href="https://github.com/ofri-peretz/eslint" target="_blank"><img src="https://img.shields.io/badge/Since-Dec_2025-blue?logo=rocket&logoColor=white" alt="Since Dec 2025" /></a>
21
+ </p>
22
+
23
+ > ⭐ 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.
24
+
25
+ ## Description
26
+
27
+ This plugin provides Security rules for PostgreSQL interaction in Node.js (SQL injection prevention).
28
+
29
+ ## Why pg-specific?
30
+
31
+ A generic SQL injection linter can flag string concatenation wherever it appears, but it cannot know the parameterization convention for each database client. The `pg` (node-postgres) driver uses `$1, $2, …` positional placeholders with a second-argument array — a pattern no generic rule encodes. `eslint-plugin-postgresql-security` knows this contract: it only fires on `.query()` calls, it stays silent when a second argument (the values array) is present, and it tracks variable taint across assignment statements so that a split-line pattern like `const sql = "SELECT..." + id; client.query(sql)` is flagged even though the concatenation and the query call are on separate lines. The result is a rule with near-zero false positives on legitimate parameterized queries and reliable detection on the patterns that actually lead to SQL injection.
32
+
33
+ ## Philosophy
34
+
35
+ **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.
36
+
37
+ ## Getting Started
38
+
39
+ - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-pg?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). 📚
40
+ - 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-pg?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security). 📚
41
+ - [가이드](https://eslint.interlace.tools/docs/security/plugin-pg?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security)에서 확인하실 수 있습니다. 📚
42
+ - [ガイド](https://eslint.interlace.tools/docs/security/plugin-pg?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security)は [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security)でご確認ください。 📚
43
+ - Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-pg?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security), visita [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security). 📚
44
+ - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-pg?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security). 📚
45
+
46
+ ```bash
47
+ npm install eslint-plugin-postgresql-security --save-dev
48
+ ```
49
+
50
+ ## ⚙️ Configuration Presets
51
+ | Preset | Description |
52
+ | :------------ | :------------------------------------------------------- |
53
+ | `recommended` | Recommended preset - balanced security for most projects |
54
+ | `strict` | Strict preset - all rules as errors |
55
+
56
+ ## 📚 Supported Libraries
57
+ | Library | npm | Downloads | Detection |
58
+ | -------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------- |
59
+ | `pg` (node-postgres) | [![npm](https://img.shields.io/npm/v/pg.svg?style=flat-square)](https://www.npmjs.com/package/pg) | [![downloads](https://img.shields.io/npm/dt/pg.svg?style=flat-square)](https://www.npmjs.com/package/pg) | SQL Injection, Connection Leaks |
60
+
61
+ ### Custom Configuration
62
+
63
+ ```javascript
64
+ import pg from 'eslint-plugin-postgresql-security';
65
+
66
+ export default [
67
+ {
68
+ plugins: { pg },
69
+ rules: {
70
+ 'pg/no-unsafe-query': 'error',
71
+ 'pg/no-select-all': 'off', // Disable if needed
72
+ },
73
+ },
74
+ ];
75
+ ```
76
+
77
+ ## 💡 What You Get
78
+ - **PostgreSQL-specific rules:** Catches pg driver anti-patterns that generic linters miss
79
+ - **LLM-optimized messages:** Structured 2-line errors with CWE + fixes that AI assistants can apply
80
+ - **Connection safety:** Prevents leaks, double releases, and transaction race conditions
81
+ - **SQL security:** SQL injection, search_path hijacking, file access via COPY
82
+ - **Performance patterns:** N+1 queries, SELECT \*, bulk operation suggestions
83
+
84
+ Every rule produces a **structured error message**:
85
+
86
+ ```bash
87
+ src/db.ts
88
+ 42:15 error 🔒 CWE-89 OWASP:A03-Injection CVSS:9.8 | Unsafe query detected | CRITICAL
89
+ Fix: Use parameterized query: client.query('SELECT * FROM users WHERE id = $1', [userId])
90
+ ```
91
+
92
+ ## 📦 Compatibility
93
+ | Package | Version |
94
+ | :--- | :--- |
95
+ | ESLint | `^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0` |
96
+ | Node.js | `>=18.0.0` |
97
+
98
+ 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.
99
+
100
+ ## Rules
101
+
102
+ **Legend**
103
+
104
+ | Icon | Description |
105
+ | :---: | :--- |
106
+ | 💼 | **Recommended**: Included in the recommended preset. |
107
+ | ⚠️ | **Warns**: Set to warn in recommended preset. |
108
+ | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
109
+ | 💡 | **Suggestions**: Providing code suggestions in IDE. |
110
+ | 🚫 | **Deprecated**: This rule is deprecated. |
111
+ | 🟢 | **Type-unaware**: AST-only, runs in oxlint JS-plugin tier. |
112
+ | 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
113
+ | 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
114
+
115
+ <!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
116
+ | Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
117
+ | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
118
+ | [check-query-params](https://eslint.interlace.tools/docs/security/plugin-pg/rules/check-query-params?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-89 | | | Ensures the number of placeholders in SQL queries matches the provided parameters. | 🟢 | | ⚠️ | | | |
119
+ | [no-batch-insert-loop](https://eslint.interlace.tools/docs/security/plugin-pg/rules/no-batch-insert-loop?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-400 | | | Prevents INSERT/UPDATE/DELETE queries inside loops (N+1 query anti-pattern). | 🟢 | | ⚠️ | | | |
120
+ | [no-floating-query](https://eslint.interlace.tools/docs/security/plugin-pg/rules/no-floating-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security) | CWE-252 | | | Ensures query promises are awaited or handled. | 🟢 | 💼 | | | | |
121
+ | [no-hardcoded-credentials](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | 💼 | | | | |
122
+ | [no-insecure-ssl](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | 💼 | | | | |
123
+ | [no-missing-client-release](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | 💼 | | | | |
124
+ | [no-select-all](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | | ⚠️ | | | |
125
+ | [no-transaction-on-pool](https://eslint.interlace.tools/docs/security/plugin-pg/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). | 🟢 | 💼 | | | | |
126
+ | [no-unsafe-copy-from](https://eslint.interlace.tools/docs/security/plugin-pg/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). | 🟢 | 💼 | | | | |
127
+ | [no-unsafe-query](https://eslint.interlace.tools/docs/security/plugin-pg/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 | 🟢 | 💼 | | | | |
128
+ | [no-unsafe-search-path](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | 💼 | | | | |
129
+ | [prefer-pool-query](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | | ⚠️ | | | |
130
+ | [prevent-double-release](https://eslint.interlace.tools/docs/security/plugin-pg/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. | 🟢 | 💼 | | | | |
131
+ <!-- AUTO-GENERATED:RULES_TABLE:END -->
132
+ ## 🔗 Related ESLint Plugins
133
+
134
+ Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
135
+
136
+ | Plugin | Downloads | Description |
137
+ | :--- | :---: | :--- |
138
+ | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
139
+ | [`eslint-plugin-postgresql-security`](https://www.npmjs.com/package/eslint-plugin-postgresql-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-postgresql-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-postgresql-security) | PostgreSQL security & best practices. |
140
+ | [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-node-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-node-security) | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
141
+ | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
142
+ | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-browser-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
143
+ | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
144
+ | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-lambda-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
145
+ | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-nestjs-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
146
+ | [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-mongodb-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
147
+ | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
148
+ | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
149
+
150
+ <!-- INTERLACE:STAR_CTA:START -->
151
+ ## ⭐ Support & follow
152
+
153
+ 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.
154
+
155
+ [![GitHub stars](https://img.shields.io/github/stars/ofri-peretz/eslint?style=social)](https://github.com/ofri-peretz/eslint)
156
+
157
+ <!-- INTERLACE:STAR_CTA:END -->
158
+
159
+ ## 📄 License
160
+
161
+ MIT © [Ofri Peretz](https://github.com/ofri-peretz)
162
+
163
+ <p align="center">
164
+ <a href="https://eslint.interlace.tools/docs/security/plugin-pg?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security"><img src="https://eslint.interlace.tools/images/og-pg.png" alt="ESLint Interlace Plugin" width="100%" /></a>
165
+ </p>
166
+
167
+ <p align="center">
168
+ <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security" target="blank"><img src="https://eslint.interlace.tools/icon-light.svg" alt="Interlace" height="70" /></a>
169
+ </p>
package/dist/AGENTS.md ADDED
@@ -0,0 +1,118 @@
1
+ # AGENTS.md
2
+
3
+ > Context for AI coding agents working on eslint-plugin-postgresql-security
4
+
5
+ ## Setup Commands
6
+
7
+ ```bash
8
+ # Install dependencies (from monorepo root)
9
+ npm install
10
+
11
+ # Build this package
12
+ nx build eslint-plugin-postgresql-security
13
+
14
+ # Run tests
15
+ nx test eslint-plugin-postgresql-security
16
+
17
+ # Run tests with coverage
18
+ nx test eslint-plugin-postgresql-security --coverage
19
+
20
+ # Lint this package
21
+ nx lint eslint-plugin-postgresql-security
22
+ ```
23
+
24
+ ## Code Style
25
+
26
+ - TypeScript strict mode with `@interlace/eslint-devkit` types
27
+ - Use `AST_NODE_TYPES` constants, never string literals for node types
28
+ - Use `formatLLMMessage()` for all rule error messages
29
+ - Include CWE, CVSS in every security message
30
+ - Use `c8 ignore` comments with documented reasons for untestable code
31
+ - Single-pass AST traversal patterns (O(n) complexity)
32
+ - Use `$1, $2` placeholders (pg standard), NOT `?` (MySQL style)
33
+
34
+ ## Testing Instructions
35
+
36
+ - Tests use `@typescript-eslint/rule-tester` with Vitest
37
+ - Each rule has `index.ts` (implementation) and `*.test.ts` (tests) in same directory
38
+ - Run specific rule test: `nx test eslint-plugin-postgresql-security --testPathPattern="no-unsafe-query"`
39
+ - Coverage target: ≥90% lines, ≥95% functions
40
+ - All tests must pass before committing
41
+
42
+ ## Project Structure
43
+
44
+ ```
45
+ src/
46
+ ├── index.ts # Plugin entry, exports rules and configs
47
+ └── rules/ # 13 rule directories
48
+ └── [rule-name]/
49
+ ├── index.ts # Rule implementation
50
+ └── *.test.ts # Rule tests
51
+ docs/rules/ # Markdown documentation per rule
52
+ ```
53
+
54
+ ## Plugin Purpose
55
+
56
+ Security and best practices ESLint plugin for **node-postgres (pg)**. Covers SQL injection, SSL, credentials, transactions, connection management, and query patterns.
57
+
58
+ ## Rule Resolution Strategies
59
+
60
+ ### SQL Injection (`pg/no-unsafe-query`)
61
+
62
+ ```typescript
63
+ // ❌ BAD: client.query(`SELECT * FROM users WHERE id = ${userId}`)
64
+ // ✅ GOOD: client.query('SELECT * FROM users WHERE id = $1', [userId])
65
+ ```
66
+
67
+ ### SSL Issues (`pg/no-insecure-ssl`)
68
+
69
+ ```typescript
70
+ // ❌ BAD: new Client({ ssl: { rejectUnauthorized: false } })
71
+ // ✅ GOOD: new Client({ ssl: true })
72
+ // ✅ GOOD: new Client({ ssl: { ca: process.env.PG_SSL_CA } })
73
+ ```
74
+
75
+ ### Hardcoded Credentials (`pg/no-hardcoded-credentials`)
76
+
77
+ ```typescript
78
+ // ❌ BAD: new Client({ password: 'supersecret' })
79
+ // ✅ GOOD: new Client({ password: process.env.PG_PASSWORD })
80
+ ```
81
+
82
+ ### Transaction on Pool (`pg/no-transaction-on-pool`)
83
+
84
+ ```typescript
85
+ // ❌ BAD: await pool.query('BEGIN'); await pool.query('COMMIT');
86
+ // ✅ GOOD: const client = await pool.connect(); try { await client.query('BEGIN'); ... } finally { client.release(); }
87
+ ```
88
+
89
+ ### Missing Release (`pg/no-missing-client-release`)
90
+
91
+ ```typescript
92
+ // ❌ BAD: const client = await pool.connect(); await client.query('SELECT 1');
93
+ // ✅ GOOD: const client = await pool.connect(); try { ... } finally { client.release(); }
94
+ ```
95
+
96
+ ### N+1 Queries (`pg/no-batch-insert-loop`)
97
+
98
+ ```typescript
99
+ // ❌ BAD: for (const user of users) { await client.query('INSERT...', [user.id]); }
100
+ // ✅ GOOD: await client.query('INSERT INTO users SELECT * FROM unnest($1::int[])', [users.map(u => u.id)])
101
+ ```
102
+
103
+ ## Safe Patterns (Should NOT trigger)
104
+
105
+ 1. **Parameterized queries:** `client.query('SELECT $1', [value])` ✅
106
+ 2. **Static strings:** `client.query('SELECT 1')` ✅
107
+ 3. **Environment variables:** `process.env.DATABASE_URL` ✅
108
+ 4. **COPY FROM STDIN:** `'COPY users FROM STDIN'` ✅
109
+ 5. **SELECT \* FROM UNNEST:** Bulk insert pattern ✅
110
+ 6. **COUNT(\*):** Aggregate function ✅
111
+
112
+ ## Code Style Preferences
113
+
114
+ 1. **Prefer `pool.query()`** for single queries without transactions
115
+ 2. **Always use try/finally** for pool.connect()
116
+ 3. **Use `$1, $2` placeholders** (pg standard) not `?` (MySQL style)
117
+ 4. **Bulk operations** over loops for performance
118
+ 5. **Explicit columns** over SELECT \*
@@ -0,0 +1,150 @@
1
+ ## [1.4.3] - 2026-02-08
2
+
3
+ ## 1.4.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#294](https://github.com/ofri-peretz/eslint/pull/294) [`659f6dc`](https://github.com/ofri-peretz/eslint/commit/659f6dc0181b03b675f72b5949fcf123dd066358) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Rewrite `description` and `keywords` on every published package for npm search discovery. npm ranks on name, description, and keywords, and the registry only picks up these fields at publish — so this is metadata-only and takes effect for each package on its next release.
8
+
9
+ **Descriptions now lead with the search phrase.** Every one starts `ESLint plugin for <the thing you'd search>` instead of a brand-first or category-first framing, and names the concrete vulnerabilities the plugin actually detects. Three were corrected while doing so:
10
+
11
+ - `eslint-plugin-import-next` claimed "100x faster no-cycle detection". No 100x measurement exists: `CLAIMS.md` records **3.1x end-to-end** (8x in pure rule execution) on a 5,483-file React codebase, and the highest number in any benchmark result is 54.9x on the synthetic corpus. The description now states the real-codebase figure.
12
+ - `eslint-plugin-secure-coding` claimed SQL injection, XSS and CSRF coverage — none of which are its rules. It now names what it does detect: LDAP, XPath, XXE, GraphQL and template injection, unsafe deserialization, ReDoS, missing authentication, and PII in logs.
13
+ - `eslint-plugin-secure-coding` ("89 rules") and `eslint-plugin-react-a11y` ("37 rules") hard-coded rule counts that had drifted from reality. Counts are generated into `interlace-numbers.json`; hand-typed copies are removed rather than corrected.
14
+
15
+ **Keywords now match the vocabulary of the plugins that rank.** `eslint-plugin-security`, `eslint-plugin-jsx-a11y`, `eslint-plugin-n` and `eslint-plugin-import` all carry the `eslint` / `eslintplugin` / `eslint-plugin` trio — six of our packages were missing `eslintplugin`, and every one now carries all three plus `static-analysis`, `linting` and `code-quality`. Security plugins add `sast`, `appsec` and `vulnerability`; `node-security` and `secure-coding` also carry `nodesecurity`, the exact keyword `eslint-plugin-security` ranks on. Each plugin gained the CWE identifiers and attack names for what it detects (`cwe-78` command injection, `cwe-22` path traversal, `cwe-89` SQL injection, `cwe-79` XSS, `cwe-347` JWT algorithm confusion, `cwe-352` CSRF, `cwe-943` NoSQL injection), and `node-security` gained the crypto vocabulary it had been missing entirely despite absorbing the crypto rule set (`crypto`, `cryptography`, `weak-hash`, `md5`, `sha1`, `timing-attack`).
16
+
17
+ No rule behavior, exports, or configuration changes.
18
+
19
+ - Updated dependencies [[`e1cdf83`](https://github.com/ofri-peretz/eslint/commit/e1cdf83e3db761907f0ab06f7fc6c1f1da7513a5), [`659f6dc`](https://github.com/ofri-peretz/eslint/commit/659f6dc0181b03b675f72b5949fcf123dd066358)]:
20
+ - @interlace/eslint-devkit@1.4.3
21
+
22
+ ## 1.4.8
23
+
24
+ ### Patch Changes
25
+
26
+ - [#269](https://github.com/ofri-peretz/eslint/pull/269) [`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - docs: dual-logo README header (Interlace mark + ESLint mark side by side) and closing Interlace footer — refreshes the README rendered on npmjs.com. No runtime changes.
27
+
28
+ - Updated dependencies [[`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad)]:
29
+ - @interlace/eslint-devkit@1.4.2
30
+
31
+ ## 1.4.7
32
+
33
+ ### Patch Changes
34
+
35
+ - [#252](https://github.com/ofri-peretz/eslint/pull/252) [`d67e395`](https://github.com/ofri-peretz/eslint/commit/d67e3953c2748ad36e6aebe0f24b1d04e518b4d0) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix Codecov badge showing "unknown" — switch from flag to component URL format
36
+
37
+ ## 1.4.6
38
+
39
+ ### Patch Changes
40
+
41
+ - [#225](https://github.com/ofri-peretz/eslint/pull/225) [`34ff5a8`](https://github.com/ofri-peretz/eslint/commit/34ff5a8e6f5126c5d1c0a524759e0af2b5476b46) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - CI-only: pin all coverage thresholds at 100% (integration target, merges last).
42
+
43
+ ## 1.4.5
44
+
45
+ ### Patch Changes
46
+
47
+ - [#213](https://github.com/ofri-peretz/eslint/pull/213) [`391dbe6`](https://github.com/ofri-peretz/eslint/commit/391dbe6b39f78d549379218567cb959649f8c614) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Align every security rule's `meta.docs.cvss` to the CVSS its finding actually
48
+ emits. The emitted machine-readable message sources its `CVSS:x` from
49
+ `CWE_MAPPING` via `formatLLMMessage` → `enrichFromCWE`, but the static
50
+ `meta.docs.cvss` documentation field had drifted on 45 rules across these 7
51
+ plugins — e.g. `no-hardcoded-credentials` documented `9.5` while emitting
52
+ `CVSS:9.8` (the value the published article and SARIF/LLM consumers already
53
+ read).
54
+
55
+ This corrects the **documentation metadata only** — no emitted finding changes.
56
+ Locked by `security-cvss-docs-consistency.lock.test.ts` (cross-plugin: every
57
+ security rule's `meta.docs.cvss` must equal the CVSS it emits), the
58
+ `no-hardcoded-credentials` rule lock (real ESLint `Linter` emission), and a
59
+ devkit `enrichFromCWE` contract test pinning `CWE-798 → 9.8`.
60
+
61
+ Follow-up (not in scope): 50 security rules document a CVSS that never appears
62
+ in any emitted message (their messages carry no CWE), and several rules emit the
63
+ generic CWE score where a rule-specific score may be warranted — both change
64
+ emitted output and are separate decisions.
65
+
66
+ ## 1.4.4
67
+
68
+ ### Patch Changes
69
+
70
+ - [#143](https://github.com/ofri-peretz/eslint/pull/143) [`213cde1`](https://github.com/ofri-peretz/eslint/commit/213cde190ff2aea49ca7c1b533170940f879d9b4) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix(no-missing-null-checks): eliminate 53 false positives via three new narrowing patterns
71
+
72
+ Rules that were recognized as null guards are now correctly identified as safe:
73
+ 1. **Truthy if guard** — `if (obj) { obj.prop }` — direct truthy check proves non-null. Also covers chains: `if (response)` protects `response.data.items`.
74
+ 2. **Short-circuit AND** — `obj && obj.prop` — right side of `&&` only runs when left is truthy.
75
+ 3. **Ternary consequent** — `obj ? obj.prop : fallback` — truthy test guards the consequent.
76
+
77
+ Also: bumped `beforeAll` timeout to 30 seconds in 7 compatibility test files (`__compatibility__/*.spec.ts`). Native-addon packages routinely exceed the previous 10-second default on a cold ESM load.
78
+
79
+ - Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
80
+ - @interlace/eslint-devkit@1.4.1
81
+
82
+ ### Bug Fixes
83
+
84
+ - align codecov component IDs with full package names ([2831b968](https://github.com/ofri-peretz/eslint/commit/2831b968))
85
+ - resolve all benchmark FN/FP across security rules ([45ffb791](https://github.com/ofri-peretz/eslint/commit/45ffb791))
86
+
87
+ ### Documentation
88
+
89
+ - fix changelog header format across all packages ([c3a15082](https://github.com/ofri-peretz/eslint/commit/c3a15082))
90
+
91
+ ### ❤️ Thank You
92
+
93
+ - Ofri Peretz
94
+
95
+ ## [1.4.2] - 2026-02-06
96
+
97
+ ### Bug Fixes
98
+
99
+ - align codecov component names and update docs components ([0a59a86c](https://github.com/ofri-peretz/eslint/commit/0a59a86c))
100
+
101
+ ### ❤️ Thank You
102
+
103
+ - Ofri Peretz
104
+
105
+ ## [1.4.1] - 2026-02-02
106
+
107
+ This was a version bump only for eslint-plugin-postgresql-security to align it with other projects, there were no code changes.
108
+
109
+ # Changelog
110
+
111
+ All notable changes to `eslint-plugin-postgresql-security` will be documented in this file.
112
+
113
+ ## [0.0.1] - 2024-12-20
114
+
115
+ ### Added
116
+
117
+ - Initial release with 13 rules for PostgreSQL security and best practices
118
+
119
+ #### Security Rules (6)
120
+
121
+ - `no-unsafe-query` - Prevents SQL injection via string interpolation
122
+ - `no-insecure-ssl` - Prevents disabling SSL certificate validation
123
+ - `no-hardcoded-credentials` - Prevents hardcoded passwords in config
124
+ - `no-unsafe-search-path` - Prevents dynamic search_path hijacking
125
+ - `no-unsafe-copy-from` - Prevents COPY FROM file path exposure
126
+ - `no-transaction-on-pool` - Prevents transaction commands on pool
127
+
128
+ #### Resource Management Rules (3)
129
+
130
+ - `no-missing-client-release` - Ensures pool clients are released
131
+ - `prevent-double-release` - Prevents double client.release()
132
+ - `no-floating-query` - Ensures query promises are handled
133
+
134
+ #### Quality & Performance Rules (4)
135
+
136
+ - `check-query-params` - Validates parameter count matches placeholders
137
+ - `no-select-all` - Discourages SELECT \*
138
+ - `prefer-pool-query` - Suggests pool.query() for simple queries
139
+ - `no-batch-insert-loop` - Prevents N+1 mutation queries
140
+
141
+ #### Presets
142
+
143
+ - `recommended` - Balanced security and quality settings
144
+ - `strict` - All rules as errors
145
+
146
+ #### Documentation
147
+
148
+ - Full documentation for all 13 rules
149
+ - AGENTS.md for AI assistant integration
150
+ - Benchmark folder for capability demonstration
package/dist/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ofri Peretz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+