eslint-plugin-sequelize-security 0.3.0 → 0.3.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 +1 -1
- package/package.json +3 -3
- package/src/index.js +1 -36
- package/src/oxlint.js +1 -3
- package/src/rules/no-hardcoded-credentials/index.js +1 -22
- package/src/rules/no-mass-assignment/index.js +1 -22
- package/src/rules/no-unsafe-query/index.js +1 -20
- package/src/rules/require-tls/index.js +1 -22
- package/src/types/index.js +1 -2
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ routes/search.ts
|
|
|
96
96
|
## 📦 Compatibility
|
|
97
97
|
| Package | Version |
|
|
98
98
|
| :--- | :--- |
|
|
99
|
-
| ESLint | `^8.
|
|
99
|
+
| ESLint | `^8.40.0 \|\| ^9.0.0 \|\| ^10.0.0` |
|
|
100
100
|
| Node.js | `>=18.0.0` |
|
|
101
101
|
|
|
102
102
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-sequelize-security",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "ESLint plugin for the Sequelize ORM — detects SQL injection in raw sequelize.query() and Sequelize.literal() calls built with string concatenation or template literals, connection configuration that disables TLS or certificate validation, and hardcoded database credentials.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"node": ">=18.0.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"eslint": "^8.
|
|
70
|
+
"eslint": "^8.40.0 || ^9.0.0 || ^10.0.0",
|
|
71
71
|
"sequelize": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@interlace/eslint-devkit": "^1.
|
|
79
|
+
"@interlace/eslint-devkit": "^1.11.0"
|
|
80
80
|
},
|
|
81
81
|
"funding": {
|
|
82
82
|
"type": "github",
|
package/src/index.js
CHANGED
|
@@ -1,36 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configs = exports.plugin = exports.rules = void 0;
|
|
4
|
-
exports.rules = {
|
|
5
|
-
get 'no-hardcoded-credentials'() { return require("./rules/no-hardcoded-credentials").noHardcodedCredentials; },
|
|
6
|
-
get 'no-mass-assignment'() { return require("./rules/no-mass-assignment").noMassAssignment; },
|
|
7
|
-
get 'no-unsafe-query'() { return require("./rules/no-unsafe-query").noUnsafeQuery; },
|
|
8
|
-
get 'require-tls'() { return require("./rules/require-tls").requireTls; },
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
exports.plugin = {
|
|
12
|
-
meta: {
|
|
13
|
-
name: 'eslint-plugin-sequelize-security',
|
|
14
|
-
version: '0.3.0',
|
|
15
|
-
},
|
|
16
|
-
rules: exports.rules,
|
|
17
|
-
};
|
|
18
|
-
exports.configs = {
|
|
19
|
-
flagship: {
|
|
20
|
-
plugins: { 'sequelize-security': exports.plugin },
|
|
21
|
-
rules: {
|
|
22
|
-
'sequelize-security/no-unsafe-query': 'error',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
recommended: {
|
|
26
|
-
plugins: { 'sequelize-security': exports.plugin },
|
|
27
|
-
rules: {
|
|
28
|
-
'sequelize-security/no-unsafe-query': 'error',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
strict: {
|
|
32
|
-
plugins: { 'sequelize-security': exports.plugin },
|
|
33
|
-
rules: Object.fromEntries(Object.keys(exports.rules).map((ruleName) => [`sequelize-security/${ruleName}`, 'error'])),
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
exports.default = exports.plugin;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;exports.rules={get"no-hardcoded-credentials"(){return require("./rules/no-hardcoded-credentials").noHardcodedCredentials},get"no-mass-assignment"(){return require("./rules/no-mass-assignment").noMassAssignment},get"no-unsafe-query"(){return require("./rules/no-unsafe-query").noUnsafeQuery},get"require-tls"(){return require("./rules/require-tls").requireTls}};exports.plugin={meta:{name:"eslint-plugin-sequelize-security",version:"0.3.2"},rules:exports.rules};exports.configs={flagship:{plugins:{"sequelize-security":exports.plugin},rules:{"sequelize-security/no-unsafe-query":"error"}},recommended:{plugins:{"sequelize-security":exports.plugin},rules:{"sequelize-security/no-unsafe-query":"error"}},strict:{plugins:{"sequelize-security":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`sequelize-security/${ruleName}`,"error"]))}};exports.default=exports.plugin;
|
package/src/oxlint.js
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noHardcodedCredentials = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
exports.noHardcodedCredentials = (0, eslint_devkit_1.createHardcodedCredentialsRule)({
|
|
6
|
-
meta: {
|
|
7
|
-
type: 'problem',
|
|
8
|
-
docs: {
|
|
9
|
-
description: 'Disallow literal database passwords in Sequelize connection configuration, including credentials embedded in a connection URL.',
|
|
10
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/no-hardcoded-credentials.md',
|
|
11
|
-
cwe: 'CWE-798',
|
|
12
|
-
cvss: 9.8,
|
|
13
|
-
confidence: 'high',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
modules: ['sequelize', 'sequelize-typescript'],
|
|
17
|
-
connectionKeys: ['dialectOptions', 'dialect', 'replication'],
|
|
18
|
-
urlSchemes: ['postgres', 'postgresql', 'mysql', 'mariadb'],
|
|
19
|
-
fix: 'Read the password from the environment — `password: process.env.DB_PASSWORD` — and keep the value in your secret manager, never in the repo.',
|
|
20
|
-
urlFix: 'Keep the secret out of the URL: build the config from discrete fields with `password: process.env.DB_PASSWORD`, or inject the whole URL as `process.env.DATABASE_URL`.',
|
|
21
|
-
documentationLink: 'https://owasp.org/www-community/vulnerabilities/Use_of_hard-coded_password',
|
|
22
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noHardcodedCredentials=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noHardcodedCredentials=(0,eslint_devkit_1.createHardcodedCredentialsRule)({meta:{type:"problem",docs:{description:"Disallow literal database passwords in Sequelize connection configuration, including credentials embedded in a connection URL.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/no-hardcoded-credentials.md",cwe:"CWE-798",cvss:9.8,confidence:"high"}},modules:["sequelize","sequelize-typescript"],connectionKeys:["dialectOptions","dialect","replication"],urlSchemes:["postgres","postgresql","mysql","mariadb"],fix:"Read the password from the environment \u2014 `password: process.env.DB_PASSWORD` \u2014 and keep the value in your secret manager, never in the repo.",urlFix:"Keep the secret out of the URL: build the config from discrete fields with `password: process.env.DB_PASSWORD`, or inject the whole URL as `process.env.DATABASE_URL`.",documentationLink:"https://owasp.org/www-community/vulnerabilities/Use_of_hard-coded_password"});
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noMassAssignment = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
exports.noMassAssignment = (0, eslint_devkit_1.createMassAssignmentRule)({
|
|
6
|
-
meta: {
|
|
7
|
-
type: 'problem',
|
|
8
|
-
docs: {
|
|
9
|
-
description: 'Disallow writing an inbound request object straight to the database through Sequelize, which lets the caller set every column the model exposes.',
|
|
10
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/no-mass-assignment.md',
|
|
11
|
-
cwe: 'CWE-915',
|
|
12
|
-
cvss: 8.1,
|
|
13
|
-
confidence: 'high',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
methods: ['create', 'update', 'bulkCreate', 'set', 'upsert'],
|
|
17
|
-
payloadKeys: [],
|
|
18
|
-
receiverPattern: /^(sequelize|db|database|model|Model|tx|trx)$|[Ss]equelize$|[Mm]odel$/,
|
|
19
|
-
modules: ['sequelize', 'sequelize-typescript'],
|
|
20
|
-
fix: 'Name the attributes you accept, or pass Sequelize\'s own allowlist — `User.create(req.body, { fields: [\'name\', \'email\'] })`, which is exactly what `fields` is for.',
|
|
21
|
-
documentationLink: 'https://sequelize.org/docs/v6/core-concepts/model-instances/',
|
|
22
|
-
});
|
|
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 Sequelize, which lets the caller set every column the model exposes.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/no-mass-assignment.md",cwe:"CWE-915",cvss:8.1,confidence:"high"}},methods:["create","update","bulkCreate","set","upsert"],payloadKeys:[],receiverPattern:/^(sequelize|db|database|model|Model|tx|trx)$|[Ss]equelize$|[Mm]odel$/,modules:["sequelize","sequelize-typescript"],fix:"Name the attributes you accept, or pass Sequelize's own allowlist \u2014 `User.create(req.body, { fields: ['name', 'email'] })`, which is exactly what `fields` is for.",documentationLink:"https://sequelize.org/docs/v6/core-concepts/model-instances/"});
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noUnsafeQuery = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
exports.noUnsafeQuery = (0, eslint_devkit_1.createSqlInjectionRule)({
|
|
6
|
-
meta: {
|
|
7
|
-
type: 'problem',
|
|
8
|
-
docs: {
|
|
9
|
-
description: 'Prevent SQL injection by disallowing string concatenation or interpolated template literals in raw Sequelize queries.',
|
|
10
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/no-unsafe-query.md',
|
|
11
|
-
cwe: 'CWE-89',
|
|
12
|
-
cvss: 9.8,
|
|
13
|
-
confidence: 'high',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
methods: ['query', 'literal'],
|
|
17
|
-
requireSqlKeywords: false,
|
|
18
|
-
fix: 'Pass values via `replacements` or `bind` instead of interpolating them into the SQL string.',
|
|
19
|
-
documentationLink: 'https://sequelize.org/docs/v7/querying/raw-queries/',
|
|
20
|
-
});
|
|
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 raw Sequelize queries.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/no-unsafe-query.md",cwe:"CWE-89",cvss:9.8,confidence:"high"}},methods:["query","literal"],requireSqlKeywords:false,fix:"Pass values via `replacements` or `bind` instead of interpolating them into the SQL string.",documentationLink:"https://sequelize.org/docs/v7/querying/raw-queries/"});
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requireTls = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
exports.requireTls = (0, eslint_devkit_1.createRequireTlsRule)({
|
|
6
|
-
meta: {
|
|
7
|
-
type: 'problem',
|
|
8
|
-
docs: {
|
|
9
|
-
description: 'Require TLS on Sequelize connections, so queries and credentials are not sent in cleartext and the server is authenticated.',
|
|
10
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/require-tls.md',
|
|
11
|
-
cwe: 'CWE-319',
|
|
12
|
-
cweJustification: 'CWE-319 (Cleartext Transmission) covers the tlsDisabled finding. The second finding, certificateValidationDisabled, is CWE-295 (Improper Certificate Validation): the channel is still encrypted, but the peer is no longer authenticated, so an attacker who answers in place of the database completes the handshake. One rule, two weaknesses — meta.docs.cwe carries a single identifier, so the secondary mapping is recorded here.',
|
|
13
|
-
cvss: 7.4,
|
|
14
|
-
confidence: 'high',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
modules: ['sequelize', 'sequelize-typescript'],
|
|
18
|
-
connectionKeys: ['dialectOptions', 'dialect', 'replication'],
|
|
19
|
-
urlSchemes: ['postgres', 'postgresql', 'mysql', 'mariadb'],
|
|
20
|
-
fix: 'Keep TLS on and supply the CA — `dialectOptions: { ssl: { require: true, ca } }`.',
|
|
21
|
-
documentationLink: 'https://sequelize.org/docs/v6/other-topics/dialect-specific-things/#postgresql',
|
|
22
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.requireTls=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.requireTls=(0,eslint_devkit_1.createRequireTlsRule)({meta:{type:"problem",docs:{description:"Require TLS on Sequelize connections, so queries and credentials are not sent in cleartext and the server is authenticated.",url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-sequelize-security/docs/rules/require-tls.md",cwe:"CWE-319",cweJustification:"CWE-319 (Cleartext Transmission) covers the tlsDisabled finding. The second finding, certificateValidationDisabled, is CWE-295 (Improper Certificate Validation): the channel is still encrypted, but the peer is no longer authenticated, so an attacker who answers in place of the database completes the handshake. One rule, two weaknesses \u2014 meta.docs.cwe carries a single identifier, so the secondary mapping is recorded here.",cvss:7.4,confidence:"high"}},modules:["sequelize","sequelize-typescript"],connectionKeys:["dialectOptions","dialect","replication"],urlSchemes:["postgres","postgresql","mysql","mariadb"],fix:"Keep TLS on and supply the CA \u2014 `dialectOptions: { ssl: { require: true, ca } }`.",documentationLink:"https://sequelize.org/docs/v6/other-topics/dialect-specific-things/#postgresql"});
|
package/src/types/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|