eslint-plugin-typeorm-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 +1 -0
- package/package.json +3 -4
- package/src/index.js +4 -3
- package/src/rules/require-tls/index.js +22 -0
- package/src/types/index.d.ts +8 -0
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
|
|
|
118
118
|
| Rule | CWE | OWASP | CVSS | Description | π§ | πΌ | β οΈ | π§ | π‘ | π« |
|
|
119
119
|
| :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
120
120
|
| [no-unsafe-query](https://eslint.interlace.tools/docs/security/plugin-typeorm-security/rules/no-unsafe-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-typeorm-security) | CWE-89 | A03:2021 | | Prevent SQL injection by disallowing string concatenation or interpolated template literals in TypeORM rawβ¦ | π’ | πΌ | | | | |
|
|
121
|
+
| [require-tls](https://eslint.interlace.tools/docs/security/plugin-typeorm-security/rules/require-tls?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-typeorm-security) | CWE-319 | A02:2021 | | Require TLS on TypeORM DataSource connections, so queries and credentials are not sent in cleartext and theβ¦ | π’ | | | | | |
|
|
121
122
|
<!-- AUTO-GENERATED:RULES_TABLE:END -->
|
|
122
123
|
## π Related ESLint Plugins
|
|
123
124
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-typeorm-security",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "ESLint plugin for typeorm β detects SQL injection in raw queries built with string concatenation or template literals.",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "ESLint plugin for typeorm β detects SQL injection in raw queries 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
|
-
"
|
|
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'
|
|
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-typeorm-security',
|
|
11
|
-
version: '0.
|
|
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 TypeORM DataSource 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-typeorm-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: ['typeorm'],
|
|
18
|
+
connectionKeys: ['extra', 'type', 'entities', 'synchronize', 'options'],
|
|
19
|
+
urlSchemes: ['postgres', 'postgresql', 'mysql', 'mariadb'],
|
|
20
|
+
fix: 'Keep TLS on and supply the CA β `ssl: { ca: fs.readFileSync(caPath) }`, or `extra: { ssl: { ca } }` for driver passthrough.',
|
|
21
|
+
documentationLink: 'https://typeorm.io/data-source-options',
|
|
22
|
+
});
|
package/src/types/index.d.ts
CHANGED
|
@@ -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 AllTypeORMRulesOptions {
|
|
8
15
|
'typeorm-security/no-unsafe-query': NoUnsafeQueryOptions;
|
|
16
|
+
'typeorm-security/require-tls': RequireTlsOptions;
|
|
9
17
|
}
|