eslint-plugin-postgresql-security 1.5.0 → 1.5.2
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.
- package/README.md +5 -5
- package/package.json +9 -23
- package/src/constants.js +1 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +1 -0
- package/src/oxlint.d.ts +17 -0
- package/src/oxlint.js +1 -0
- package/src/rules/check-query-params/index.js +1 -0
- package/src/rules/no-batch-insert-loop/index.js +1 -0
- package/src/rules/no-floating-query/index.js +1 -0
- package/src/rules/no-hardcoded-credentials/index.js +1 -0
- package/src/rules/no-insecure-ssl/index.js +1 -0
- package/src/rules/no-missing-client-release/index.js +1 -0
- package/src/rules/no-select-all/index.js +1 -0
- package/src/rules/no-transaction-on-pool/index.js +1 -0
- package/src/rules/no-unsafe-copy-from/index.js +1 -0
- package/src/rules/no-unsafe-query/index.js +1 -0
- package/src/rules/no-unsafe-search-path/index.js +1 -0
- package/src/rules/prefer-pool-query/index.js +1 -0
- package/src/rules/prevent-double-release/index.js +1 -0
- package/src/types/index.js +1 -0
- package/CHANGELOG.md +0 -150
- package/dist/AGENTS.md +0 -118
- package/dist/CHANGELOG.md +0 -150
- package/dist/LICENSE +0 -23
- package/dist/README.md +0 -169
- package/dist/package.json +0 -99
- package/dist/src/constants.d.ts +0 -6
- package/dist/src/constants.js +0 -13
- package/dist/src/index.d.ts +0 -26
- package/dist/src/index.js +0 -116
- package/dist/src/oxlint.d.ts +0 -20
- package/dist/src/oxlint.js +0 -21
- package/dist/src/rules/check-query-params/index.d.ts +0 -8
- package/dist/src/rules/check-query-params/index.js +0 -90
- package/dist/src/rules/no-batch-insert-loop/index.d.ts +0 -8
- package/dist/src/rules/no-batch-insert-loop/index.js +0 -90
- package/dist/src/rules/no-floating-query/index.d.ts +0 -8
- package/dist/src/rules/no-floating-query/index.js +0 -74
- package/dist/src/rules/no-hardcoded-credentials/index.d.ts +0 -8
- package/dist/src/rules/no-hardcoded-credentials/index.js +0 -86
- package/dist/src/rules/no-insecure-ssl/index.d.ts +0 -8
- package/dist/src/rules/no-insecure-ssl/index.js +0 -66
- package/dist/src/rules/no-missing-client-release/index.d.ts +0 -8
- package/dist/src/rules/no-missing-client-release/index.js +0 -85
- package/dist/src/rules/no-select-all/index.d.ts +0 -8
- package/dist/src/rules/no-select-all/index.js +0 -79
- package/dist/src/rules/no-transaction-on-pool/index.d.ts +0 -8
- package/dist/src/rules/no-transaction-on-pool/index.js +0 -71
- package/dist/src/rules/no-unsafe-copy-from/index.d.ts +0 -10
- package/dist/src/rules/no-unsafe-copy-from/index.js +0 -205
- package/dist/src/rules/no-unsafe-query/index.d.ts +0 -8
- package/dist/src/rules/no-unsafe-query/index.js +0 -132
- package/dist/src/rules/no-unsafe-search-path/index.d.ts +0 -8
- package/dist/src/rules/no-unsafe-search-path/index.js +0 -144
- package/dist/src/rules/prefer-pool-query/index.d.ts +0 -8
- package/dist/src/rules/prefer-pool-query/index.js +0 -104
- package/dist/src/rules/prevent-double-release/index.d.ts +0 -8
- package/dist/src/rules/prevent-double-release/index.js +0 -456
- package/dist/src/types/index.js +0 -7
- package/src/__compatibility__/pg-interface.spec.ts +0 -495
- package/src/constants.ts +0 -11
- package/src/index.spec.ts +0 -14
- package/src/index.test.ts +0 -59
- package/src/index.ts +0 -130
- package/src/oxlint.spec.ts +0 -70
- package/src/oxlint.ts +0 -23
- package/src/rules/check-query-params/check-query-params.test.ts +0 -68
- package/src/rules/check-query-params/index.spec.ts +0 -117
- package/src/rules/check-query-params/index.ts +0 -106
- package/src/rules/no-batch-insert-loop/index.spec.ts +0 -105
- package/src/rules/no-batch-insert-loop/index.ts +0 -105
- package/src/rules/no-batch-insert-loop/no-batch-insert-loop.test.ts +0 -68
- package/src/rules/no-floating-query/index.spec.ts +0 -112
- package/src/rules/no-floating-query/index.ts +0 -81
- package/src/rules/no-floating-query/no-floating-query.test.ts +0 -68
- package/src/rules/no-hardcoded-credentials/index.spec.ts +0 -38
- package/src/rules/no-hardcoded-credentials/index.ts +0 -93
- package/src/rules/no-hardcoded-credentials/no-hardcoded-credentials.test.ts +0 -68
- package/src/rules/no-insecure-ssl/index.spec.ts +0 -40
- package/src/rules/no-insecure-ssl/index.ts +0 -81
- package/src/rules/no-insecure-ssl/no-insecure-ssl.test.ts +0 -68
- package/src/rules/no-missing-client-release/coverage-gaps.spec.ts +0 -42
- package/src/rules/no-missing-client-release/index.spec.ts +0 -52
- package/src/rules/no-missing-client-release/index.ts +0 -100
- package/src/rules/no-missing-client-release/no-missing-client-release.test.ts +0 -68
- package/src/rules/no-select-all/index.spec.ts +0 -44
- package/src/rules/no-select-all/index.ts +0 -92
- package/src/rules/no-select-all/no-select-all.test.ts +0 -68
- package/src/rules/no-transaction-on-pool/index.spec.ts +0 -36
- package/src/rules/no-transaction-on-pool/index.ts +0 -85
- package/src/rules/no-transaction-on-pool/no-transaction-on-pool.test.ts +0 -68
- package/src/rules/no-unsafe-copy-from/coverage-gaps.spec.ts +0 -76
- package/src/rules/no-unsafe-copy-from/index.spec.ts +0 -274
- package/src/rules/no-unsafe-copy-from/index.ts +0 -226
- package/src/rules/no-unsafe-copy-from/no-unsafe-copy-from.test.ts +0 -78
- package/src/rules/no-unsafe-query/coverage-gaps.spec.ts +0 -61
- package/src/rules/no-unsafe-query/index.spec.ts +0 -103
- package/src/rules/no-unsafe-query/index.ts +0 -149
- package/src/rules/no-unsafe-query/no-unsafe-query.test.ts +0 -73
- package/src/rules/no-unsafe-search-path/index.spec.ts +0 -46
- package/src/rules/no-unsafe-search-path/index.ts +0 -164
- package/src/rules/no-unsafe-search-path/no-unsafe-search-path.test.ts +0 -68
- package/src/rules/prefer-pool-query/coverage-gaps.spec.ts +0 -76
- package/src/rules/prefer-pool-query/index.spec.ts +0 -97
- package/src/rules/prefer-pool-query/index.ts +0 -118
- package/src/rules/prefer-pool-query/prefer-pool-query.test.ts +0 -68
- package/src/rules/prevent-double-release/coverage-gaps.spec.ts +0 -538
- package/src/rules/prevent-double-release/index.spec.ts +0 -824
- package/src/rules/prevent-double-release/index.ts +0 -534
- package/src/rules/prevent-double-release/prevent-double-release.test.ts +0 -70
- package/src/types/index.ts +0 -58
- /package/{dist/src → src}/types/index.d.ts +0 -0
package/dist/CHANGELOG.md
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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/dist/README.md
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
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
|
-
|
|
4
|
-
<a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/eslint-logo.svg" alt="ESLint" height="90" /></a>
|
|
5
|
-
|
|
6
|
-
<a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/oxlint-logo.svg" alt="oxlint" height="90" /></a>
|
|
7
|
-
|
|
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) | [](https://www.npmjs.com/package/pg) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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
|
-
[](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/package.json
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eslint-plugin-postgresql-security",
|
|
3
|
-
"version": "1.5.0",
|
|
4
|
-
"description": "ESLint plugin for the pg PostgreSQL driver — detects SQL injection, unreleased clients, floating queries, unsafe search_path, and insecure SSL.",
|
|
5
|
-
"type": "commonjs",
|
|
6
|
-
"main": "./src/index.js",
|
|
7
|
-
"types": "./src/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./src/index.d.ts",
|
|
11
|
-
"default": "./src/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./oxlint": {
|
|
14
|
-
"types": "./src/oxlint.d.ts",
|
|
15
|
-
"default": "./src/oxlint.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"author": "Ofri Peretz <ofriperetzdev@gmail.com>",
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"homepage": "https://eslint.interlace.tools/docs/security/plugin-postgresql-security?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-postgresql-security",
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "https://github.com/ofri-peretz/eslint",
|
|
24
|
-
"directory": "packages/eslint-plugin-postgresql-security"
|
|
25
|
-
},
|
|
26
|
-
"bugs": {
|
|
27
|
-
"url": "https://github.com/ofri-peretz/eslint/issues"
|
|
28
|
-
},
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
31
|
-
},
|
|
32
|
-
"files": [
|
|
33
|
-
"src/",
|
|
34
|
-
"dist/",
|
|
35
|
-
"README.md",
|
|
36
|
-
"LICENSE",
|
|
37
|
-
"CHANGELOG.md"
|
|
38
|
-
],
|
|
39
|
-
"keywords": [
|
|
40
|
-
"eslint",
|
|
41
|
-
"eslintplugin",
|
|
42
|
-
"eslint-plugin",
|
|
43
|
-
"static-analysis",
|
|
44
|
-
"linting",
|
|
45
|
-
"code-quality",
|
|
46
|
-
"security",
|
|
47
|
-
"sast",
|
|
48
|
-
"appsec",
|
|
49
|
-
"vulnerability",
|
|
50
|
-
"owasp",
|
|
51
|
-
"cwe",
|
|
52
|
-
"interlace-security",
|
|
53
|
-
"pg",
|
|
54
|
-
"postgres",
|
|
55
|
-
"postgresql",
|
|
56
|
-
"node-postgres",
|
|
57
|
-
"sql",
|
|
58
|
-
"sql-injection",
|
|
59
|
-
"cwe-89",
|
|
60
|
-
"database",
|
|
61
|
-
"database-security",
|
|
62
|
-
"connection-pool",
|
|
63
|
-
"best-practices",
|
|
64
|
-
"llm-optimized",
|
|
65
|
-
"ai-assistant",
|
|
66
|
-
"typescript"
|
|
67
|
-
],
|
|
68
|
-
"engines": {
|
|
69
|
-
"node": ">=18.0.0"
|
|
70
|
-
},
|
|
71
|
-
"peerDependencies": {
|
|
72
|
-
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
73
|
-
"pg": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
74
|
-
},
|
|
75
|
-
"peerDependenciesMeta": {
|
|
76
|
-
"pg": {
|
|
77
|
-
"optional": true
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"dependencies": {
|
|
81
|
-
"tslib": "^2.3.0",
|
|
82
|
-
"@interlace/eslint-devkit": "^1.4.3"
|
|
83
|
-
},
|
|
84
|
-
"devDependencies": {
|
|
85
|
-
"@typescript-eslint/parser": "^8.46.2",
|
|
86
|
-
"@typescript-eslint/rule-tester": "^8.46.2",
|
|
87
|
-
"pg": "^8.22.0"
|
|
88
|
-
},
|
|
89
|
-
"scripts": {
|
|
90
|
-
"build": "tsx ../../scripts/build-package.ts",
|
|
91
|
-
"test": "vitest run",
|
|
92
|
-
"test:coverage": "vitest run --coverage",
|
|
93
|
-
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
94
|
-
},
|
|
95
|
-
"funding": {
|
|
96
|
-
"type": "github",
|
|
97
|
-
"url": "https://github.com/ofri-peretz/eslint"
|
|
98
|
-
}
|
|
99
|
-
}
|
package/dist/src/constants.d.ts
DELETED
package/dist/src/constants.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.PG_PROTOCOLS = void 0;
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
* Connection string protocols for PostgreSQL
|
|
12
|
-
*/
|
|
13
|
-
exports.PG_PROTOCOLS = ['postgres://', 'postgresql://'];
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* eslint-plugin-postgresql-security
|
|
8
|
-
*
|
|
9
|
-
* ESLint plugin with security and best practices rules for the pg Node.js driver.
|
|
10
|
-
*
|
|
11
|
-
* @see https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-postgresql-security
|
|
12
|
-
*/
|
|
13
|
-
import { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
-
/**
|
|
15
|
-
* Collection of all rules
|
|
16
|
-
*/
|
|
17
|
-
export declare const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
|
|
18
|
-
/**
|
|
19
|
-
* ESLint Plugin object
|
|
20
|
-
*/
|
|
21
|
-
export declare const plugin: TSESLint.FlatConfig.Plugin;
|
|
22
|
-
/**
|
|
23
|
-
* Preset configurations
|
|
24
|
-
*/
|
|
25
|
-
export declare const configs: Record<string, TSESLint.FlatConfig.Config>;
|
|
26
|
-
export default plugin;
|
package/dist/src/index.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.configs = exports.plugin = exports.rules = void 0;
|
|
9
|
-
const no_unsafe_query_1 = require("./rules/no-unsafe-query");
|
|
10
|
-
const no_insecure_ssl_1 = require("./rules/no-insecure-ssl");
|
|
11
|
-
const no_hardcoded_credentials_1 = require("./rules/no-hardcoded-credentials");
|
|
12
|
-
const check_query_params_1 = require("./rules/check-query-params");
|
|
13
|
-
const no_missing_client_release_1 = require("./rules/no-missing-client-release");
|
|
14
|
-
const no_transaction_on_pool_1 = require("./rules/no-transaction-on-pool");
|
|
15
|
-
const no_floating_query_1 = require("./rules/no-floating-query");
|
|
16
|
-
const no_select_all_1 = require("./rules/no-select-all");
|
|
17
|
-
const prefer_pool_query_1 = require("./rules/prefer-pool-query");
|
|
18
|
-
const no_batch_insert_loop_1 = require("./rules/no-batch-insert-loop");
|
|
19
|
-
const no_unsafe_search_path_1 = require("./rules/no-unsafe-search-path");
|
|
20
|
-
const no_unsafe_copy_from_1 = require("./rules/no-unsafe-copy-from");
|
|
21
|
-
const prevent_double_release_1 = require("./rules/prevent-double-release");
|
|
22
|
-
/**
|
|
23
|
-
* Collection of all rules
|
|
24
|
-
*/
|
|
25
|
-
exports.rules = {
|
|
26
|
-
'no-unsafe-query': no_unsafe_query_1.noUnsafeQuery,
|
|
27
|
-
'no-insecure-ssl': no_insecure_ssl_1.noInsecureSsl,
|
|
28
|
-
'no-hardcoded-credentials': no_hardcoded_credentials_1.noHardcodedCredentials,
|
|
29
|
-
'check-query-params': check_query_params_1.checkQueryParams,
|
|
30
|
-
'no-missing-client-release': no_missing_client_release_1.noMissingClientRelease,
|
|
31
|
-
'no-transaction-on-pool': no_transaction_on_pool_1.noTransactionOnPool,
|
|
32
|
-
'no-floating-query': no_floating_query_1.noFloatingQuery,
|
|
33
|
-
'no-select-all': no_select_all_1.noSelectAll,
|
|
34
|
-
'prefer-pool-query': prefer_pool_query_1.preferPoolQuery,
|
|
35
|
-
'no-batch-insert-loop': no_batch_insert_loop_1.noBatchInsertLoop,
|
|
36
|
-
'no-unsafe-search-path': no_unsafe_search_path_1.noUnsafeSearchPath,
|
|
37
|
-
'no-unsafe-copy-from': no_unsafe_copy_from_1.noUnsafeCopyFrom,
|
|
38
|
-
'prevent-double-release': prevent_double_release_1.preventDoubleRelease,
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* ESLint Plugin object
|
|
42
|
-
*/
|
|
43
|
-
exports.plugin = {
|
|
44
|
-
meta: {
|
|
45
|
-
name: 'eslint-plugin-postgresql-security',
|
|
46
|
-
version: '1.4.9',
|
|
47
|
-
},
|
|
48
|
-
rules: exports.rules,
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Preset configurations
|
|
52
|
-
*/
|
|
53
|
-
exports.configs = {
|
|
54
|
-
/**
|
|
55
|
-
* Flagship preset — exactly the rule(s) from this plugin that appear in
|
|
56
|
-
* the ecosystem-wide flagship list (`.agent/flagship-rules.md`). Use this
|
|
57
|
-
* when you want the highest-signal subset shippable in CI gates without
|
|
58
|
-
* the noise of `recommended`.
|
|
59
|
-
*/
|
|
60
|
-
flagship: {
|
|
61
|
-
plugins: { 'pg': exports.plugin },
|
|
62
|
-
rules: {
|
|
63
|
-
'pg/no-unsafe-query': 'error',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* Recommended preset - balanced security for most projects
|
|
68
|
-
*/
|
|
69
|
-
recommended: {
|
|
70
|
-
plugins: {
|
|
71
|
-
'pg': exports.plugin,
|
|
72
|
-
},
|
|
73
|
-
rules: {
|
|
74
|
-
// Security rules (errors)
|
|
75
|
-
'pg/no-unsafe-query': 'error',
|
|
76
|
-
'pg/no-insecure-ssl': 'error',
|
|
77
|
-
'pg/no-hardcoded-credentials': 'error',
|
|
78
|
-
'pg/no-unsafe-search-path': 'error',
|
|
79
|
-
'pg/no-unsafe-copy-from': 'error',
|
|
80
|
-
'pg/no-transaction-on-pool': 'error',
|
|
81
|
-
// Resource management (errors)
|
|
82
|
-
'pg/no-missing-client-release': 'error',
|
|
83
|
-
'pg/prevent-double-release': 'error',
|
|
84
|
-
'pg/no-floating-query': 'error',
|
|
85
|
-
// Quality (warnings)
|
|
86
|
-
'pg/check-query-params': 'warn',
|
|
87
|
-
'pg/no-select-all': 'warn',
|
|
88
|
-
'pg/prefer-pool-query': 'warn',
|
|
89
|
-
'pg/no-batch-insert-loop': 'warn',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
/**
|
|
93
|
-
* Strict preset - all rules as errors
|
|
94
|
-
*/
|
|
95
|
-
strict: {
|
|
96
|
-
plugins: {
|
|
97
|
-
'pg': exports.plugin,
|
|
98
|
-
},
|
|
99
|
-
rules: {
|
|
100
|
-
'pg/no-unsafe-query': 'error',
|
|
101
|
-
'pg/no-insecure-ssl': 'error',
|
|
102
|
-
'pg/no-hardcoded-credentials': 'error',
|
|
103
|
-
'pg/no-unsafe-search-path': 'error',
|
|
104
|
-
'pg/no-unsafe-copy-from': 'error',
|
|
105
|
-
'pg/no-transaction-on-pool': 'error',
|
|
106
|
-
'pg/no-missing-client-release': 'error',
|
|
107
|
-
'pg/prevent-double-release': 'error',
|
|
108
|
-
'pg/no-floating-query': 'error',
|
|
109
|
-
'pg/check-query-params': 'error',
|
|
110
|
-
'pg/no-select-all': 'error',
|
|
111
|
-
'pg/prefer-pool-query': 'error',
|
|
112
|
-
'pg/no-batch-insert-loop': 'error',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
exports.default = exports.plugin;
|
package/dist/src/oxlint.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* oxlint sub-export.
|
|
8
|
-
*
|
|
9
|
-
* Consumers wire oxlint to this entry via:
|
|
10
|
-
* { "jsPlugins": ["eslint-plugin-postgresql-security/oxlint"] }
|
|
11
|
-
*
|
|
12
|
-
* oxlint's JS plugin loader does `require('eslint-plugin-postgresql-security/oxlint')` and reads
|
|
13
|
-
* `.rules` off the result. The compiled output of `export = plugin` is
|
|
14
|
-
* `module.exports = plugin`, which gives oxlint the plugin object directly
|
|
15
|
-
* (`{ meta, rules }`) — no wrapper, no `.default` indirection.
|
|
16
|
-
*
|
|
17
|
-
* Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
|
|
18
|
-
*/
|
|
19
|
-
import { plugin } from './index';
|
|
20
|
-
export = plugin;
|