eslint-plugin-sequelize-security 0.1.2 → 0.2.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
@@ -120,6 +120,7 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
120
120
  | Rule | CWE | OWASP | CVSS | Description | 🧠 | šŸ’¼ | āš ļø | šŸ”§ | šŸ’” | 🚫 |
121
121
  | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
122
122
  | [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
+ | [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… | 🟢 | | | | | |
123
124
  <!-- AUTO-GENERATED:RULES_TABLE:END -->
124
125
  ## šŸ”— Related ESLint Plugins
125
126
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-sequelize-security",
3
- "version": "0.1.2",
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.2.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, and connection configuration that disables TLS or certificate validation.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
7
7
  "types": "./src/index.d.ts",
@@ -76,8 +76,7 @@
76
76
  }
77
77
  },
78
78
  "dependencies": {
79
- "tslib": "^2.3.0",
80
- "@interlace/eslint-devkit": "^1.6.1"
79
+ "@interlace/eslint-devkit": "^1.8.0"
81
80
  },
82
81
  "funding": {
83
82
  "type": "github",
package/src/index.js CHANGED
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configs = exports.plugin = exports.rules = void 0;
4
- const no_unsafe_query_1 = require("./rules/no-unsafe-query");
5
4
  exports.rules = {
6
- 'no-unsafe-query': no_unsafe_query_1.noUnsafeQuery,
5
+ get 'no-unsafe-query'() { return require("./rules/no-unsafe-query").noUnsafeQuery; },
6
+ get 'require-tls'() { return require("./rules/require-tls").requireTls; },
7
+
7
8
  };
8
9
  exports.plugin = {
9
10
  meta: {
10
11
  name: 'eslint-plugin-sequelize-security',
11
- version: '0.1.2',
12
+ version: '0.2.0',
12
13
  },
13
14
  rules: exports.rules,
14
15
  };
@@ -0,0 +1,22 @@
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
+ });
@@ -4,6 +4,14 @@
4
4
  * MIT license that can be found in the LICENSE file.
5
5
  */
6
6
  export type NoUnsafeQueryOptions = [];
7
+ /**
8
+ * Options for `require-tls`.
9
+ *
10
+ * The rule takes none: which key disables TLS is fixed by the driver's own
11
+ * config schema, not by project preference.
12
+ */
13
+ export type RequireTlsOptions = [];
7
14
  export interface AllSequelizeRulesOptions {
8
15
  'sequelize-security/no-unsafe-query': NoUnsafeQueryOptions;
16
+ 'sequelize-security/require-tls': RequireTlsOptions;
9
17
  }