eslint-plugin-sequelize-security 0.2.0 β 0.3.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
|
@@ -119,6 +119,8 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
|
|
|
119
119
|
<!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
|
|
120
120
|
| Rule | CWE | OWASP | CVSS | Description | π§ | πΌ | β οΈ | π§ | π‘ | π« |
|
|
121
121
|
| :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
122
|
+
| [no-hardcoded-credentials](https://eslint.interlace.tools/docs/security/plugin-sequelize-security/rules/no-hardcoded-credentials?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-sequelize-security) | CWE-798 | A07:2021 | | Disallow literal database passwords in Sequelize connection configuration, including credentials embedded iβ¦ | π’ | | | | | |
|
|
123
|
+
| [no-mass-assignment](https://eslint.interlace.tools/docs/security/plugin-sequelize-security/rules/no-mass-assignment?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-sequelize-security) | CWE-915 | A04:2021 | | Disallow writing an inbound request object straight to the database through Sequelize, which lets the calleβ¦ | π’ | | | | | |
|
|
122
124
|
| [no-unsafe-query](https://eslint.interlace.tools/docs/security/plugin-sequelize-security/rules/no-unsafe-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-sequelize-security) | CWE-89 | A03:2021 | | Detects SQL injection in raw Sequelize queries built with string concatenation or template literals | π’ | πΌ | | | | |
|
|
123
125
|
| [require-tls](https://eslint.interlace.tools/docs/security/plugin-sequelize-security/rules/require-tls?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-sequelize-security) | CWE-319 | A02:2021 | | Require TLS on Sequelize connections, so queries and credentials are not sent in cleartext and the server iβ¦ | π’ | | | | | |
|
|
124
126
|
<!-- AUTO-GENERATED:RULES_TABLE:END -->
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-sequelize-security",
|
|
3
|
-
"version": "0.
|
|
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,
|
|
3
|
+
"version": "0.3.0",
|
|
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",
|
|
7
7
|
"types": "./src/index.d.ts",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@interlace/eslint-devkit": "^1.
|
|
79
|
+
"@interlace/eslint-devkit": "^1.9.0"
|
|
80
80
|
},
|
|
81
81
|
"funding": {
|
|
82
82
|
"type": "github",
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
4
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; },
|
|
5
7
|
get 'no-unsafe-query'() { return require("./rules/no-unsafe-query").noUnsafeQuery; },
|
|
6
8
|
get 'require-tls'() { return require("./rules/require-tls").requireTls; },
|
|
7
9
|
|
|
@@ -9,7 +11,7 @@ exports.rules = {
|
|
|
9
11
|
exports.plugin = {
|
|
10
12
|
meta: {
|
|
11
13
|
name: 'eslint-plugin-sequelize-security',
|
|
12
|
-
version: '0.
|
|
14
|
+
version: '0.3.0',
|
|
13
15
|
},
|
|
14
16
|
rules: exports.rules,
|
|
15
17
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
});
|
package/src/types/index.d.ts
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
4
|
* MIT license that can be found in the LICENSE file.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Options for `no-mass-assignment`.
|
|
8
|
+
*
|
|
9
|
+
* The rule takes none. An allowlist option would let a project re-approve the
|
|
10
|
+
* dangerous shape wholesale, one config file further from the call site.
|
|
11
|
+
*/
|
|
12
|
+
export type NoMassAssignmentOptions = [];
|
|
13
|
+
/**
|
|
14
|
+
* Options for `no-hardcoded-credentials`.
|
|
15
|
+
*
|
|
16
|
+
* The rule takes none: a literal password is a literal password.
|
|
17
|
+
*/
|
|
18
|
+
export type NoHardcodedCredentialsOptions = [];
|
|
6
19
|
export type NoUnsafeQueryOptions = [];
|
|
7
20
|
/**
|
|
8
21
|
* Options for `require-tls`.
|
|
@@ -12,6 +25,8 @@ export type NoUnsafeQueryOptions = [];
|
|
|
12
25
|
*/
|
|
13
26
|
export type RequireTlsOptions = [];
|
|
14
27
|
export interface AllSequelizeRulesOptions {
|
|
28
|
+
'sequelize-security/no-mass-assignment': NoMassAssignmentOptions;
|
|
29
|
+
'sequelize-security/no-hardcoded-credentials': NoHardcodedCredentialsOptions;
|
|
15
30
|
'sequelize-security/no-unsafe-query': NoUnsafeQueryOptions;
|
|
16
31
|
'sequelize-security/require-tls': RequireTlsOptions;
|
|
17
32
|
}
|