eslint-plugin-prisma-security 0.3.8 → 1.1.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.
package/README.md
CHANGED
|
@@ -54,10 +54,34 @@ That trade costs recall, and we measure it:
|
|
|
54
54
|
|
|
55
55
|
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-prisma-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-prisma-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-prisma-security). 📚
|
|
56
56
|
|
|
57
|
+
<!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
|
|
58
|
+
|
|
59
|
+
**oxlint / Vite+** — the same rules under the same `prisma-security/<rule>` IDs, without ESLint:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install oxlint-plugin-prisma-security --save-dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```jsonc
|
|
66
|
+
// .oxlintrc.json
|
|
67
|
+
{ "jsPlugins": ["oxlint-plugin-prisma-security"] }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
// vite.config.ts
|
|
72
|
+
import { defineConfig } from 'vite-plus';
|
|
73
|
+
|
|
74
|
+
export default defineConfig({ lint: { jsPlugins: ['oxlint-plugin-prisma-security'] } });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**ESLint:**
|
|
78
|
+
|
|
57
79
|
```bash
|
|
58
80
|
npm install eslint-plugin-prisma-security --save-dev
|
|
59
81
|
```
|
|
60
82
|
|
|
83
|
+
<!-- AUTO-GENERATED:INSTALL:END -->
|
|
84
|
+
|
|
61
85
|
## ⚙️ Configuration Presets
|
|
62
86
|
| Preset | Description |
|
|
63
87
|
| :------------ | :------------------------------------------------------- |
|
|
@@ -159,6 +183,7 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
|
|
|
159
183
|
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [](https://www.npmjs.com/package/eslint-plugin-secure-coding) | Injection prevention. |
|
|
160
184
|
| [`eslint-plugin-sequelize-security`](https://www.npmjs.com/package/eslint-plugin-sequelize-security) | [](https://www.npmjs.com/package/eslint-plugin-sequelize-security) | Sequelize ORM security. |
|
|
161
185
|
| [`eslint-plugin-sqlite-security`](https://www.npmjs.com/package/eslint-plugin-sqlite-security) | [](https://www.npmjs.com/package/eslint-plugin-sqlite-security) | SQLite security. |
|
|
186
|
+
| [`eslint-plugin-supabase-security`](https://www.npmjs.com/package/eslint-plugin-supabase-security) | [](https://www.npmjs.com/package/eslint-plugin-supabase-security) | Supabase security. |
|
|
162
187
|
| [`eslint-plugin-typeorm-security`](https://www.npmjs.com/package/eslint-plugin-typeorm-security) | [](https://www.npmjs.com/package/eslint-plugin-typeorm-security) | TypeORM security. |
|
|
163
188
|
| [`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) | AI SDK security. |
|
|
164
189
|
|
|
@@ -166,6 +191,7 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
|
|
|
166
191
|
|
|
167
192
|
| Plugin | Downloads | Description |
|
|
168
193
|
| :--- | :---: | :--- |
|
|
194
|
+
| [`eslint-plugin-cli-floor`](https://www.npmjs.com/package/eslint-plugin-cli-floor) | [](https://www.npmjs.com/package/eslint-plugin-cli-floor) | CLI floor for commander, yargs and burgee. |
|
|
169
195
|
| [`eslint-plugin-conventions`](https://www.npmjs.com/package/eslint-plugin-conventions) | [](https://www.npmjs.com/package/eslint-plugin-conventions) | Team-specific habits and styles. |
|
|
170
196
|
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [](https://www.npmjs.com/package/eslint-plugin-import-next) | Fast cycle + import-graph analysis. |
|
|
171
197
|
| [`eslint-plugin-maintainability`](https://www.npmjs.com/package/eslint-plugin-maintainability) | [](https://www.npmjs.com/package/eslint-plugin-maintainability) | Cognitive load and clean-code patterns. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-prisma-security",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ESLint plugin for @prisma/client — detects SQL injection in raw queries built with string concatenation or template literals.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -71,12 +71,15 @@
|
|
|
71
71
|
"@prisma/client": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
|
+
"eslint": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
74
77
|
"@prisma/client": {
|
|
75
78
|
"optional": true
|
|
76
79
|
}
|
|
77
80
|
},
|
|
78
81
|
"dependencies": {
|
|
79
|
-
"@interlace/eslint-devkit": "^1.
|
|
82
|
+
"@interlace/eslint-devkit": "^1.21.0"
|
|
80
83
|
},
|
|
81
84
|
"funding": {
|
|
82
85
|
"type": "github",
|
package/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-mass-assignment"(){return require("./rules/no-mass-assignment").noMassAssignment},get"no-raw-identifier-interpolation"(){return require("./rules/no-raw-identifier-interpolation").noRawIdentifierInterpolation},get"no-unsafe-query"(){return require("./rules/no-unsafe-query").noUnsafeQuery},get"no-unscoped-mutation"(){return require("./rules/no-unscoped-mutation").noUnscopedMutation}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-prisma-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-prisma-security",version:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-mass-assignment"(){return require("./rules/no-mass-assignment").noMassAssignment},get"no-raw-identifier-interpolation"(){return require("./rules/no-raw-identifier-interpolation").noRawIdentifierInterpolation},get"no-unsafe-query"(){return require("./rules/no-unsafe-query").noUnsafeQuery},get"no-unscoped-mutation"(){return require("./rules/no-unscoped-mutation").noUnscopedMutation}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-prisma-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-prisma-security",version:"1.1.0"},rules:exports.rules};exports.configs={flagship:{plugins:{"prisma-security":exports.plugin},rules:{"prisma-security/no-unsafe-query":"error"}},recommended:{plugins:{"prisma-security":exports.plugin},rules:{"prisma-security/no-unsafe-query":"error"}},strict:{plugins:{"prisma-security":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`prisma-security/${ruleName}`,"error"]))}};exports.default=exports.plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noMassAssignment=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noMassAssignment=(0,eslint_devkit_1.createMassAssignmentRule)({meta:{type:"problem",docs:{description:"Disallow writing an inbound request object straight to the database through Prisma, which lets the caller set every column the model exposes.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-mass-assignment.md",cwe:"CWE-915",cvss:8.1,confidence:"high"}},methods:["create","update","upsert","createMany","updateMany"],payloadKeys:["data","create","update"],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noMassAssignment=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noMassAssignment=(0,eslint_devkit_1.createMassAssignmentRule)({meta:{type:"problem",docs:{description:"Disallow writing an inbound request object straight to the database through Prisma, which lets the caller set every column the model exposes.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-mass-assignment.md",cwe:"CWE-915",cvss:8.1,confidence:"high"}},methods:["create","update","upsert","createMany","updateMany","createManyAndReturn","updateManyAndReturn"],distinctiveShape:"model-accessor",payloadKeys:["data","create","update"],modules:["@prisma/client"],fix:"Name the columns you accept \u2014 `data: { name: req.body.name }` \u2014 or validate into a typed object first (`const input = UserUpdate.parse(req.body)`). Prisma will happily write any column in the model.",documentationLink:"https://www.prisma.io/docs/orm/prisma-client/queries/crud"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noRawIdentifierInterpolation=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noRawIdentifierInterpolation=(0,eslint_devkit_1.createRawIdentifierRule)({meta:{type:"problem",docs:{description:"Disallow interpolating table, column or sort identifiers into a Prisma $queryRaw / $executeRaw template, where bind parameters cannot reach them.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-raw-identifier-interpolation.md",cwe:"CWE-89",cvss:9.8,confidence:"high"}},tags:["$queryRaw","$executeRaw"],modules:["@prisma/client"],requireImport:false,identifierHelpers:[],fix:'Map the input through a fixed allowlist before it reaches the query \u2014 `const column = ALLOWED[input] ?? "id"`. Prisma has no identifier escaper, so an allowlist is the only safe construction.',sortDirectionFix:'Resolve the direction to a literal: `const dir = input === "desc" ? "desc" : "asc"`, or move the sort into the type-safe `orderBy` argument.',documentationLink:"https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/raw-queries#considerations"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noRawIdentifierInterpolation=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noRawIdentifierInterpolation=(0,eslint_devkit_1.createRawIdentifierRule)({meta:{type:"problem",docs:{description:"Disallow interpolating table, column or sort identifiers into a Prisma $queryRaw / $executeRaw template, where bind parameters cannot reach them.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-raw-identifier-interpolation.md",cwe:"CWE-89",cvss:9.8,confidence:"high"}},tags:["$queryRaw","$executeRaw"],driverTags:["sql"],modules:["@prisma/client"],requireImport:false,identifierHelpers:[],fix:'Map the input through a fixed allowlist before it reaches the query \u2014 `const column = ALLOWED[input] ?? "id"`. Prisma has no identifier escaper, so an allowlist is the only safe construction.',sortDirectionFix:'Resolve the direction to a literal: `const dir = input === "desc" ? "desc" : "asc"`, or move the sort into the type-safe `orderBy` argument.',documentationLink:"https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/raw-queries#considerations"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUnsafeQuery=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noUnsafeQuery=(0,eslint_devkit_1.createSqlInjectionRule)({meta:{type:"problem",docs:{description:"Prevent SQL injection by disallowing string concatenation or interpolated template literals in Prisma raw queries.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-unsafe-query.md",cwe:"CWE-89",cvss:9.8,confidence:"high"}},modules:["@prisma/client","prisma"],methods:["$queryRawUnsafe","$executeRawUnsafe"],requireSqlKeywords:false,fix:"Use the `$queryRaw` tagged template (or `Prisma.sql`), which parameterizes interpolated values.",documentationLink:"https://www.prisma.io/docs/orm/prisma-client/queries/raw-database-access/raw-queries#queryrawunsafe"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUnsafeQuery=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noUnsafeQuery=(0,eslint_devkit_1.createSqlInjectionRule)({meta:{type:"problem",docs:{description:"Prevent SQL injection by disallowing string concatenation or interpolated template literals in Prisma raw queries.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-unsafe-query.md",cwe:"CWE-89",cvss:9.8,confidence:"high"}},modules:["@prisma/client","prisma"],methods:[],fragmentMethods:["$queryRawUnsafe","$executeRawUnsafe",{name:"raw",requireDriverReceiver:true}],fragmentFactories:["join","empty","sql","raw"],requireSqlKeywords:false,fix:"Use the `$queryRaw` tagged template (or `Prisma.sql`), which parameterizes interpolated values.",documentationLink:"https://www.prisma.io/docs/orm/prisma-client/queries/raw-database-access/raw-queries#queryrawunsafe"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUnscopedMutation=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noUnscopedMutation=(0,eslint_devkit_1.createUnscopedMutationRule)({meta:{type:"problem",docs:{description:"Require a `where` filter on Prisma bulk mutations, so deleteMany and updateMany cannot rewrite or delete every row in the table.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-unscoped-mutation.md",cwe:"CWE-284",cvss:7.5,confidence:"high"}},methods:["deleteMany","updateMany"],modules:["@prisma/client",".prisma/client"],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUnscopedMutation=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noUnscopedMutation=(0,eslint_devkit_1.createUnscopedMutationRule)({meta:{type:"problem",docs:{description:"Require a `where` filter on Prisma bulk mutations, so deleteMany and updateMany cannot rewrite or delete every row in the table.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-prisma-security/docs/rules/no-unscoped-mutation.md",cwe:"CWE-284",cvss:7.5,confidence:"high"}},methods:["deleteMany","updateMany","updateManyAndReturn"],distinctiveShape:"model-accessor",modules:["@prisma/client",".prisma/client"],fix:"Pass a `where` filter, e.g. `prisma.user.deleteMany({ where: { id } })`.",documentationLink:"https://www.prisma.io/docs/orm/prisma-client/queries/crud#delete-all-records"});
|