eslint-plugin-typeorm-security 2.0.2 → 2.0.4
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/AGENTS.md +87 -0
- package/README.md +24 -38
- package/package.json +3 -2
- package/src/index.js +1 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<!-- Generated by scripts/generate-plugin-agents-md.ts from package.json and the plugin exports. Do not edit by hand; run `npm run agents-md`. -->
|
|
2
|
+
|
|
3
|
+
# eslint-plugin-typeorm-security
|
|
4
|
+
|
|
5
|
+
Guide for AI coding assistants using this plugin in a project. To change the plugin's own source, read https://github.com/ofri-peretz/eslint/blob/main/AGENTS.md instead.
|
|
6
|
+
|
|
7
|
+
> ESLint TypeORM security rules — detects SQL injection in raw queries built with string concatenation or template literals, connection configuration that disables TLS or certificate validation, and hardcoded database credentials.
|
|
8
|
+
|
|
9
|
+
## Enable it
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --save-dev eslint-plugin-typeorm-security
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires ESLint ^8.40.0 || ^9.0.0 || ^10.0.0 and Node >=22.13.0.
|
|
16
|
+
|
|
17
|
+
Flat config files (`eslint.config.*`) are found by ESLint 8.57 and newer; on ESLint 9 and 10 they are the default.
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// eslint.config.mjs
|
|
21
|
+
import typeormSecurity from 'eslint-plugin-typeorm-security';
|
|
22
|
+
|
|
23
|
+
export default [typeormSecurity.configs.recommended];
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Each preset is one flat config object: put it in the array as an element, do not spread it. Rule ids are prefixed `typeorm-security/`. Add it to the config you already have; do not remove other plugins. TypeScript files need a TypeScript parser in the config (`typescript-eslint`).
|
|
27
|
+
|
|
28
|
+
Use it alongside `eslint-plugin-security`, not instead of it: keep that plugin if the project has it. Measured overlap and the limits of both: https://eslint.interlace.tools/docs/getting-started/with-eslint-plugin-security
|
|
29
|
+
|
|
30
|
+
## Presets
|
|
31
|
+
|
|
32
|
+
| Preset | Rules | Errors | Warnings |
|
|
33
|
+
| ------------- | ----- | ------ | -------- |
|
|
34
|
+
| `flagship` | 1 | 1 | 0 |
|
|
35
|
+
| `recommended` | 1 | 1 | 0 |
|
|
36
|
+
| `strict` | 4 | 4 | 0 |
|
|
37
|
+
|
|
38
|
+
### `flagship`
|
|
39
|
+
|
|
40
|
+
Same rules as `recommended`.
|
|
41
|
+
|
|
42
|
+
### `recommended`
|
|
43
|
+
|
|
44
|
+
1 rule:
|
|
45
|
+
|
|
46
|
+
- `no-unsafe-query` (error): Prevent SQL injection by disallowing string concatenation or interpolated template literals in TypeORM raw queries.
|
|
47
|
+
|
|
48
|
+
### `strict`
|
|
49
|
+
|
|
50
|
+
Everything in `recommended` plus 3 more:
|
|
51
|
+
|
|
52
|
+
- `no-hardcoded-credentials` (error): Disallow literal database passwords in TypeORM DataSource configuration, including credentials embedded in a connection URL.
|
|
53
|
+
- `no-mass-assignment` (error): Disallow writing an inbound request object straight to the database through TypeORM, which lets the caller set every column the model exposes.
|
|
54
|
+
- `require-tls` (error): Require TLS on TypeORM DataSource connections, so queries and credentials are not sent in cleartext and the server is authenticated.
|
|
55
|
+
|
|
56
|
+
## Other Interlace plugins by dependency
|
|
57
|
+
|
|
58
|
+
If the project also depends on one of these, add the matching plugin the same way:
|
|
59
|
+
|
|
60
|
+
- `express`, `fastify`, `koa`, `@hapi/hapi`, `restify`, `hono`, `next`, `@nestjs/core`, `@nestjs/common`, `aws-lambda`, `@types/aws-lambda`, `@middy/core`, `commander`, `yargs`, `@oclif/core`, `@modelcontextprotocol/*`: `eslint-plugin-node-security`
|
|
61
|
+
- `express`: `eslint-plugin-express-security`
|
|
62
|
+
- `@nestjs/common`, `@nestjs/core`: `eslint-plugin-nestjs-security`
|
|
63
|
+
- `react`, `react-dom`, `preact`, `vue`, `svelte`, `@angular/core`, `solid-js`, `lit`, `next`, `nuxt`: `eslint-plugin-browser-security`
|
|
64
|
+
- `jsonwebtoken`, `jose`, `express-jwt`, `@nestjs/jwt`, `jwks-rsa`, `jwt-decode`: `eslint-plugin-jwt-security`
|
|
65
|
+
- `pg`, `pg-pool`, `pg-promise`, `postgres`, `slonik`: `eslint-plugin-postgresql-security`
|
|
66
|
+
- `mysql2`, `mysql`: `eslint-plugin-mysql-security`
|
|
67
|
+
- `mongodb`, `mongoose`: `eslint-plugin-mongodb-security`
|
|
68
|
+
- `better-sqlite3`, `sqlite3`: `eslint-plugin-sqlite-security`
|
|
69
|
+
- `knex`: `eslint-plugin-knex-security`
|
|
70
|
+
- `@prisma/client`, `prisma`: `eslint-plugin-prisma-security`
|
|
71
|
+
- `drizzle-orm`: `eslint-plugin-drizzle-security`
|
|
72
|
+
- `sequelize`: `eslint-plugin-sequelize-security`
|
|
73
|
+
- `@supabase/supabase-js`: `eslint-plugin-supabase-security`
|
|
74
|
+
- `@modelcontextprotocol/*`: `eslint-plugin-mcp-sdk-security`
|
|
75
|
+
- `openai`, `@openai/agents`: `eslint-plugin-openai-security`
|
|
76
|
+
- `@anthropic-ai/sdk`, `@anthropic-ai/claude-agent-sdk`: `eslint-plugin-anthropic-security`
|
|
77
|
+
- `@google/genai`: `eslint-plugin-gemini-security`
|
|
78
|
+
- `ai`: `eslint-plugin-vercel-ai-security`
|
|
79
|
+
- `aws-lambda`, `@types/aws-lambda`, `@middy/core`: `eslint-plugin-lambda-security`
|
|
80
|
+
|
|
81
|
+
The full stack-to-plugin playbook (with config rendering and a proof step) is the `security-linting` skill: https://github.com/ofri-peretz/eslint/tree/main/skills/security-linting
|
|
82
|
+
|
|
83
|
+
## More
|
|
84
|
+
|
|
85
|
+
- Docs: https://eslint.interlace.tools/docs/security/plugin-typeorm-security
|
|
86
|
+
- README.md in this package: every rule with examples.
|
|
87
|
+
- `eslint-plugin-typeorm-security/oxlint` is an entry point for oxlint's JS plugin support; see the README.
|
package/README.md
CHANGED
|
@@ -22,7 +22,28 @@
|
|
|
22
22
|
<a href="https://scorecard.dev/viewer/?uri=github.com/ofri-peretz/eslint" target="_blank"><img src="https://api.securityscorecards.dev/projects/github.com/ofri-peretz/eslint/badge" alt="OpenSSF Scorecard" /></a>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-typeorm-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-typeorm-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-typeorm-security). 📚
|
|
28
|
+
|
|
29
|
+
<!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install --save-dev eslint eslint-plugin-typeorm-security
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
// eslint.config.mjs
|
|
37
|
+
import { configs } from 'eslint-plugin-typeorm-security';
|
|
38
|
+
|
|
39
|
+
export default [configs.recommended];
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`recommended` is the preset to start with. The others are listed under Configuration Presets below.
|
|
43
|
+
|
|
44
|
+
Using oxlint or Vite+? Install `oxlint-plugin-typeorm-security`: the same rules under the same `typeorm-security/<rule>` IDs, without ESLint. Its [page](https://www.npmjs.com/package/oxlint-plugin-typeorm-security) has the setup.
|
|
45
|
+
|
|
46
|
+
<!-- AUTO-GENERATED:INSTALL:END -->
|
|
26
47
|
|
|
27
48
|
## Description
|
|
28
49
|
|
|
@@ -50,40 +71,6 @@ That trade costs recall, and we measure it:
|
|
|
50
71
|
|
|
51
72
|
<!-- AUTO-GENERATED:DOCTRINE:END -->
|
|
52
73
|
|
|
53
|
-
## Getting Started
|
|
54
|
-
|
|
55
|
-
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-typeorm-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-typeorm-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-typeorm-security). 📚
|
|
56
|
-
|
|
57
|
-
<!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
|
|
58
|
-
|
|
59
|
-
**oxlint / Vite+** — the same rules under the same `typeorm-security/<rule>` IDs, without ESLint:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npm install oxlint-plugin-typeorm-security --save-dev
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
```jsonc
|
|
66
|
-
// .oxlintrc.json
|
|
67
|
-
{ "jsPlugins": ["oxlint-plugin-typeorm-security"] }
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
// vite.config.ts
|
|
72
|
-
import { defineConfig } from 'vite-plus';
|
|
73
|
-
|
|
74
|
-
export default defineConfig({
|
|
75
|
-
lint: { jsPlugins: ['oxlint-plugin-typeorm-security'] },
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**ESLint:**
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npm install eslint-plugin-typeorm-security --save-dev
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
<!-- AUTO-GENERATED:INSTALL:END -->
|
|
86
|
-
|
|
87
74
|
## ⚙️ Configuration Presets
|
|
88
75
|
| Preset | Description |
|
|
89
76
|
| :------------ | :------------------------------------------------------- |
|
|
@@ -206,11 +193,10 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
|
|
|
206
193
|
<!-- AUTO-GENERATED:ECOSYSTEM_TABLE:END -->
|
|
207
194
|
|
|
208
195
|
<!-- INTERLACE:STAR_CTA:START -->
|
|
209
|
-
## ⭐ Support & follow
|
|
210
196
|
|
|
211
|
-
|
|
197
|
+
## Support
|
|
212
198
|
|
|
213
|
-
[
|
|
199
|
+
Found a false positive? [Open an issue](https://github.com/ofri-peretz/eslint/issues): that is a bug. If the plugin helped, a star on [ofri-peretz/eslint](https://github.com/ofri-peretz/eslint) helps others find it.
|
|
214
200
|
|
|
215
201
|
<!-- INTERLACE:STAR_CTA:END -->
|
|
216
202
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-typeorm-security",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "ESLint TypeORM security rules — detects SQL injection in raw queries 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
|
"sideEffects": false,
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"files": [
|
|
34
34
|
"src/",
|
|
35
35
|
"README.md",
|
|
36
|
-
"LICENSE"
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"AGENTS.md"
|
|
37
38
|
],
|
|
38
39
|
"keywords": [
|
|
39
40
|
"eslint",
|
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-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}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-typeorm-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-typeorm-security",version:"2.0.
|
|
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-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}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-typeorm-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-typeorm-security",version:"2.0.4"},rules:exports.rules};exports.configs={flagship:{plugins:{"typeorm-security":exports.plugin},rules:{"typeorm-security/no-unsafe-query":"error"}},recommended:{plugins:{"typeorm-security":exports.plugin},rules:{"typeorm-security/no-unsafe-query":"error"}},strict:{plugins:{"typeorm-security":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`typeorm-security/${ruleName}`,"error"]))}};exports.default=exports.plugin;
|