decision-guardian 1.1.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/LICENSE +21 -0
- package/README.md +792 -0
- package/dist/adapters/github/actions-logger.js +88 -0
- package/dist/adapters/github/comment.js +601 -0
- package/dist/adapters/github/github-provider.js +260 -0
- package/dist/adapters/github/health.js +56 -0
- package/dist/adapters/local/console-logger.js +46 -0
- package/dist/adapters/local/local-git-provider.js +247 -0
- package/dist/cli/commands/check.js +134 -0
- package/dist/cli/commands/init.js +58 -0
- package/dist/cli/commands/template.js +70 -0
- package/dist/cli/formatter.js +68 -0
- package/dist/cli/index.js +12458 -0
- package/dist/cli/licenses.txt +143 -0
- package/dist/cli/paths.js +40 -0
- package/dist/core/content-matchers.js +333 -0
- package/dist/core/health.js +52 -0
- package/dist/core/interfaces/index.js +2 -0
- package/dist/core/interfaces/logger.js +2 -0
- package/dist/core/interfaces/scm-provider.js +5 -0
- package/dist/core/logger.js +20 -0
- package/dist/core/matcher.js +184 -0
- package/dist/core/metrics.js +87 -0
- package/dist/core/parser.js +338 -0
- package/dist/core/rule-evaluator.js +186 -0
- package/dist/core/rule-parser.js +211 -0
- package/dist/core/rule-types.js +22 -0
- package/dist/core/trie.js +83 -0
- package/dist/core/types.js +2 -0
- package/dist/index.js +61142 -0
- package/dist/licenses.txt +758 -0
- package/dist/main.js +290 -0
- package/dist/telemetry/payload.js +25 -0
- package/dist/telemetry/privacy.js +37 -0
- package/dist/telemetry/sender.js +40 -0
- package/dist/version.js +7 -0
- package/package.json +60 -0
- package/templates/advanced-rules.md +94 -0
- package/templates/api.md +70 -0
- package/templates/basic.md +38 -0
- package/templates/database.md +81 -0
- package/templates/security.md +89 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!-- DECISION-DB-001 -->
|
|
2
|
+
## Decision: Migration Files Are Immutable
|
|
3
|
+
**Status**: Active
|
|
4
|
+
**Date**: 2024-03-01
|
|
5
|
+
**Severity**: Critical
|
|
6
|
+
**Files**:
|
|
7
|
+
- `migrations/**/*`
|
|
8
|
+
- `db/migrations/**/*`
|
|
9
|
+
|
|
10
|
+
### Context
|
|
11
|
+
Never modify existing migration files. Create new migrations instead. Modifying past migrations breaks deployed databases.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<!-- DECISION-DB-002 -->
|
|
16
|
+
## Decision: Schema Version Lock
|
|
17
|
+
**Status**: Active
|
|
18
|
+
**Date**: 2024-03-15
|
|
19
|
+
**Severity**: Critical
|
|
20
|
+
**Files**:
|
|
21
|
+
- `src/db/schema.ts`
|
|
22
|
+
- `prisma/schema.prisma`
|
|
23
|
+
- `drizzle/**/*.ts`
|
|
24
|
+
|
|
25
|
+
**Rules**:
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"match": "any",
|
|
29
|
+
"conditions": [
|
|
30
|
+
{
|
|
31
|
+
"files": ["prisma/schema.prisma"],
|
|
32
|
+
"content": {
|
|
33
|
+
"mode": "regex",
|
|
34
|
+
"pattern": "@@map|@@ignore|model\\s+\\w+"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"files": ["src/db/schema.ts", "drizzle/**/*.ts"],
|
|
39
|
+
"content": {
|
|
40
|
+
"mode": "string",
|
|
41
|
+
"patterns": ["createTable", "dropTable", "alterTable", "addColumn", "dropColumn"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Context
|
|
49
|
+
Schema changes must be paired with migrations and reviewed by the database team.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
<!-- DECISION-DB-003 -->
|
|
54
|
+
## Decision: Connection Pool Configuration
|
|
55
|
+
**Status**: Active
|
|
56
|
+
**Date**: 2024-04-01
|
|
57
|
+
**Severity**: Warning
|
|
58
|
+
**Files**:
|
|
59
|
+
- `config/database.*`
|
|
60
|
+
- `src/db/pool.*`
|
|
61
|
+
- `.env*`
|
|
62
|
+
|
|
63
|
+
**Rules**:
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"match": "any",
|
|
67
|
+
"conditions": [
|
|
68
|
+
{
|
|
69
|
+
"files": ["config/database.*", "src/db/pool.*"],
|
|
70
|
+
"content": {
|
|
71
|
+
"mode": "regex",
|
|
72
|
+
"pattern": "(pool_size|max_connections|min_connections|idle_timeout)\\s*[:=]",
|
|
73
|
+
"flags": "i"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Context
|
|
81
|
+
Pool configuration changes can cause production outages. Must be load-tested before deployment.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<!-- DECISION-SEC-001 -->
|
|
2
|
+
## Decision: No Hardcoded Secrets
|
|
3
|
+
**Status**: Active
|
|
4
|
+
**Date**: 2024-04-01
|
|
5
|
+
**Severity**: Critical
|
|
6
|
+
**Files**:
|
|
7
|
+
- `src/**/*.ts`
|
|
8
|
+
- `src/**/*.js`
|
|
9
|
+
- `config/**/*`
|
|
10
|
+
|
|
11
|
+
**Rules**:
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"match": "any",
|
|
15
|
+
"conditions": [
|
|
16
|
+
{
|
|
17
|
+
"files": ["src/**/*.ts", "src/**/*.js", "config/**/*"],
|
|
18
|
+
"content": {
|
|
19
|
+
"mode": "regex",
|
|
20
|
+
"pattern": "(api[_-]?key|secret|password|token|private[_-]?key)\\s*[:=]\\s*['\"][^'\"]{8,}['\"]",
|
|
21
|
+
"flags": "i"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Context
|
|
29
|
+
Hardcoded secrets must never appear in source code. Use environment variables or a secrets manager.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<!-- DECISION-SEC-002 -->
|
|
34
|
+
## Decision: Auth Middleware Required
|
|
35
|
+
**Status**: Active
|
|
36
|
+
**Date**: 2024-04-15
|
|
37
|
+
**Severity**: Critical
|
|
38
|
+
**Files**:
|
|
39
|
+
- `src/routes/**/*.ts`
|
|
40
|
+
- `src/api/**/*.ts`
|
|
41
|
+
|
|
42
|
+
**Rules**:
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"match": "any",
|
|
46
|
+
"conditions": [
|
|
47
|
+
{
|
|
48
|
+
"files": ["src/routes/**/*.ts", "src/api/**/*.ts"],
|
|
49
|
+
"content": {
|
|
50
|
+
"mode": "string",
|
|
51
|
+
"patterns": ["router.get(", "router.post(", "router.put(", "router.delete(", "app.get(", "app.post("]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Context
|
|
59
|
+
All route handlers must use the authentication middleware. Changes to route files require security review.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
<!-- DECISION-SEC-003 -->
|
|
64
|
+
## Decision: Security-Critical Dependencies
|
|
65
|
+
**Status**: Active
|
|
66
|
+
**Date**: 2024-05-01
|
|
67
|
+
**Severity**: Warning
|
|
68
|
+
**Files**:
|
|
69
|
+
- `package.json`
|
|
70
|
+
- `package-lock.json`
|
|
71
|
+
|
|
72
|
+
**Rules**:
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"match": "any",
|
|
76
|
+
"conditions": [
|
|
77
|
+
{
|
|
78
|
+
"files": ["package.json"],
|
|
79
|
+
"content": {
|
|
80
|
+
"mode": "json_path",
|
|
81
|
+
"paths": ["dependencies.jsonwebtoken", "dependencies.bcrypt", "dependencies.helmet", "dependencies.cors"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Context
|
|
89
|
+
Changes to security-critical dependencies require extra review and testing.
|