@devilsdev/rag-pipeline-utils 2.2.1 → 2.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 +244 -11
- package/contracts/contract-schema.json +189 -0
- package/dist/index.cjs +19 -0
- package/dist/index.mjs +15 -1
- package/package.json +3 -2
- package/src/cli/commands/wizard.js +627 -0
- package/src/cli/input-sanitization-middleware.js +356 -0
- package/src/cli/templates/development.template.json +64 -0
- package/src/cli/templates/minimal.template.json +33 -0
- package/src/cli/templates/production.template.json +104 -0
- package/src/cli/templates/testing.template.json +45 -0
- package/src/config/connection-pool-config.json +259 -0
- package/src/config/memory-optimization.js +414 -0
- package/src/config/redaction-patterns.json +150 -0
- package/src/config/sanitization-rules.json +323 -0
- package/src/core/plugin-registry.js +266 -20
- package/src/dag/core/error-context.js +391 -0
- package/src/dag/core/execution-scheduler.js +350 -0
- package/src/dag/core/topology-validation.js +415 -0
- package/src/dag/dag-engine.js +26 -424
- package/src/dev/README.md +126 -0
- package/src/dev/dev-server.js +356 -0
- package/src/dev/examples/hot-reload-usage.js +355 -0
- package/src/dev/hot-reload.js +807 -0
- package/src/enterprise/sso-integration.js +67 -25
- package/src/index.js +19 -0
- package/src/observability/event-logger.js +62 -2
- package/src/plugins/optimized-openai-embedder.js +169 -0
- package/src/security/jwt-config.js +431 -0
- package/src/security/jwt-validator.js +701 -0
- package/src/utils/api-client-pool-integration.js +436 -0
- package/src/utils/batch-processor.js +710 -0
- package/src/utils/connection-pool.js +605 -0
- package/src/utils/contract-validator.js +460 -0
- package/src/utils/error-formatter.js +603 -0
- package/src/utils/examples/error-formatter-usage.js +351 -0
- package/src/utils/input-sanitizer.js +967 -0
- package/src/utils/memory-monitor.js +800 -0
- package/src/utils/secure-logger-config.js +352 -0
- package/src/utils/secure-logger.js +576 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Redaction Patterns Configuration",
|
|
4
|
+
"description": "Configuration for secure logger redaction patterns. Define custom patterns to automatically redact sensitive data from logs.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"enabled": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"description": "Enable or disable secure logging globally",
|
|
10
|
+
"default": true
|
|
11
|
+
},
|
|
12
|
+
"trackStats": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Enable statistics tracking for redactions",
|
|
15
|
+
"default": true
|
|
16
|
+
},
|
|
17
|
+
"redactionMarker": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Default marker to use for redacted values",
|
|
20
|
+
"default": "[REDACTED]"
|
|
21
|
+
},
|
|
22
|
+
"enabledPatterns": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"description": "List of pattern names to enable (leave empty to use all)",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"default": []
|
|
29
|
+
},
|
|
30
|
+
"disabledPatterns": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"description": "List of pattern names to disable",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"default": []
|
|
37
|
+
},
|
|
38
|
+
"redactEmails": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Enable email address redaction",
|
|
41
|
+
"default": false
|
|
42
|
+
},
|
|
43
|
+
"redactIPs": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"description": "Enable IP address redaction",
|
|
46
|
+
"default": false
|
|
47
|
+
},
|
|
48
|
+
"customPatterns": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Custom redaction patterns",
|
|
51
|
+
"patternProperties": {
|
|
52
|
+
"^[a-zA-Z0-9_]+$": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"regex": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Regular expression pattern (as string)"
|
|
58
|
+
},
|
|
59
|
+
"flags": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "Regex flags (e.g., 'gi')",
|
|
62
|
+
"default": "g"
|
|
63
|
+
},
|
|
64
|
+
"replacement": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Replacement string"
|
|
67
|
+
},
|
|
68
|
+
"description": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Pattern description"
|
|
71
|
+
},
|
|
72
|
+
"enabled": {
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"description": "Enable this pattern",
|
|
75
|
+
"default": true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": ["regex", "replacement"]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"default": {}
|
|
82
|
+
},
|
|
83
|
+
"sensitiveFields": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"description": "Additional field names to treat as sensitive",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"default": []
|
|
90
|
+
},
|
|
91
|
+
"environments": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"description": "Environment-specific configurations",
|
|
94
|
+
"properties": {
|
|
95
|
+
"development": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"description": "Configuration for development environment"
|
|
98
|
+
},
|
|
99
|
+
"production": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"description": "Configuration for production environment"
|
|
102
|
+
},
|
|
103
|
+
"test": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"description": "Configuration for test environment"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"default": {}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"examples": [
|
|
112
|
+
{
|
|
113
|
+
"enabled": true,
|
|
114
|
+
"trackStats": true,
|
|
115
|
+
"redactionMarker": "***REDACTED***",
|
|
116
|
+
"redactEmails": true,
|
|
117
|
+
"redactIPs": false,
|
|
118
|
+
"customPatterns": {
|
|
119
|
+
"internalToken": {
|
|
120
|
+
"regex": "\\bINT-[A-Z0-9]{32}\\b",
|
|
121
|
+
"flags": "g",
|
|
122
|
+
"replacement": "[INTERNAL_TOKEN]",
|
|
123
|
+
"description": "Internal application tokens",
|
|
124
|
+
"enabled": true
|
|
125
|
+
},
|
|
126
|
+
"sessionId": {
|
|
127
|
+
"regex": "\\bsession_id=([a-f0-9]{64})\\b",
|
|
128
|
+
"flags": "gi",
|
|
129
|
+
"replacement": "session_id=[REDACTED_SESSION]",
|
|
130
|
+
"description": "Session identifiers",
|
|
131
|
+
"enabled": true
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"sensitiveFields": ["ssn", "taxId", "bankAccount", "routingNumber"],
|
|
135
|
+
"disabledPatterns": ["creditCard"],
|
|
136
|
+
"environments": {
|
|
137
|
+
"development": {
|
|
138
|
+
"enabled": false,
|
|
139
|
+
"trackStats": false
|
|
140
|
+
},
|
|
141
|
+
"production": {
|
|
142
|
+
"enabled": true,
|
|
143
|
+
"trackStats": true,
|
|
144
|
+
"redactEmails": true,
|
|
145
|
+
"redactIPs": true
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Input Sanitization Rules Configuration",
|
|
4
|
+
"description": "Configuration for input validation and sanitization rules across the application",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"enabled": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"description": "Enable or disable input sanitization globally",
|
|
10
|
+
"default": true
|
|
11
|
+
},
|
|
12
|
+
"enableCache": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Enable result caching for performance",
|
|
15
|
+
"default": true
|
|
16
|
+
},
|
|
17
|
+
"cacheSize": {
|
|
18
|
+
"type": "integer",
|
|
19
|
+
"description": "Maximum number of cached sanitization results",
|
|
20
|
+
"default": 1000,
|
|
21
|
+
"minimum": 0
|
|
22
|
+
},
|
|
23
|
+
"cacheTTL": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"description": "Cache time-to-live in milliseconds",
|
|
26
|
+
"default": 60000,
|
|
27
|
+
"minimum": 1000
|
|
28
|
+
},
|
|
29
|
+
"throwOnInvalid": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Throw error on invalid input instead of sanitizing",
|
|
32
|
+
"default": false
|
|
33
|
+
},
|
|
34
|
+
"stripInvalid": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "Strip invalid content instead of rejecting",
|
|
37
|
+
"default": true
|
|
38
|
+
},
|
|
39
|
+
"trackStats": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "Track sanitization statistics",
|
|
42
|
+
"default": true
|
|
43
|
+
},
|
|
44
|
+
"defaultObjectDepth": {
|
|
45
|
+
"type": "integer",
|
|
46
|
+
"description": "Maximum depth for recursive object sanitization",
|
|
47
|
+
"default": 10,
|
|
48
|
+
"minimum": 1,
|
|
49
|
+
"maximum": 50
|
|
50
|
+
},
|
|
51
|
+
"fieldRules": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"description": "Field-specific sanitization rules",
|
|
54
|
+
"properties": {
|
|
55
|
+
"cli": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"description": "CLI input rules",
|
|
58
|
+
"properties": {
|
|
59
|
+
"command": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"enum": ["command", "alphanumeric"],
|
|
62
|
+
"default": "command"
|
|
63
|
+
},
|
|
64
|
+
"path": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"enum": ["path"],
|
|
67
|
+
"default": "path"
|
|
68
|
+
},
|
|
69
|
+
"file": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"enum": ["path"],
|
|
72
|
+
"default": "path"
|
|
73
|
+
},
|
|
74
|
+
"url": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"enum": ["url"],
|
|
77
|
+
"default": "url"
|
|
78
|
+
},
|
|
79
|
+
"email": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"enum": ["email"],
|
|
82
|
+
"default": "email"
|
|
83
|
+
},
|
|
84
|
+
"string": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"enum": ["html", "xss"],
|
|
87
|
+
"default": "html"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"api": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"description": "API input rules",
|
|
94
|
+
"properties": {
|
|
95
|
+
"query": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"enum": ["html", "xss"],
|
|
98
|
+
"default": "html"
|
|
99
|
+
},
|
|
100
|
+
"body": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"enum": ["html", "xss"],
|
|
103
|
+
"default": "xss"
|
|
104
|
+
},
|
|
105
|
+
"headers": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"enum": ["html"],
|
|
108
|
+
"default": "html"
|
|
109
|
+
},
|
|
110
|
+
"url": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"enum": ["url"],
|
|
113
|
+
"default": "url"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"database": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"description": "Database input rules",
|
|
120
|
+
"properties": {
|
|
121
|
+
"query": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"enum": ["sql"],
|
|
124
|
+
"default": "sql"
|
|
125
|
+
},
|
|
126
|
+
"text": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"enum": ["html", "xss"],
|
|
129
|
+
"default": "html"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"filesystem": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"description": "Filesystem operation rules",
|
|
136
|
+
"properties": {
|
|
137
|
+
"path": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"enum": ["path"],
|
|
140
|
+
"default": "path"
|
|
141
|
+
},
|
|
142
|
+
"filename": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"enum": ["alphanumeric", "slug"],
|
|
145
|
+
"default": "slug"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"common": {
|
|
150
|
+
"type": "object",
|
|
151
|
+
"description": "Common field rules",
|
|
152
|
+
"properties": {
|
|
153
|
+
"id": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"enum": ["uuid", "alphanumeric"],
|
|
156
|
+
"default": "alphanumeric"
|
|
157
|
+
},
|
|
158
|
+
"uuid": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"enum": ["uuid"],
|
|
161
|
+
"default": "uuid"
|
|
162
|
+
},
|
|
163
|
+
"email": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"enum": ["email"],
|
|
166
|
+
"default": "email"
|
|
167
|
+
},
|
|
168
|
+
"url": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"enum": ["url"],
|
|
171
|
+
"default": "url"
|
|
172
|
+
},
|
|
173
|
+
"slug": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"enum": ["slug"],
|
|
176
|
+
"default": "slug"
|
|
177
|
+
},
|
|
178
|
+
"domain": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"enum": ["domain"],
|
|
181
|
+
"default": "domain"
|
|
182
|
+
},
|
|
183
|
+
"ipv4": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"enum": ["ipv4"],
|
|
186
|
+
"default": "ipv4"
|
|
187
|
+
},
|
|
188
|
+
"ipv6": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"enum": ["ipv6"],
|
|
191
|
+
"default": "ipv6"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"environments": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"description": "Environment-specific configurations",
|
|
200
|
+
"properties": {
|
|
201
|
+
"development": {
|
|
202
|
+
"type": "object",
|
|
203
|
+
"properties": {
|
|
204
|
+
"enabled": {
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"default": true
|
|
207
|
+
},
|
|
208
|
+
"throwOnInvalid": {
|
|
209
|
+
"type": "boolean",
|
|
210
|
+
"default": true
|
|
211
|
+
},
|
|
212
|
+
"trackStats": {
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"default": true
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"production": {
|
|
219
|
+
"type": "object",
|
|
220
|
+
"properties": {
|
|
221
|
+
"enabled": {
|
|
222
|
+
"type": "boolean",
|
|
223
|
+
"default": true
|
|
224
|
+
},
|
|
225
|
+
"throwOnInvalid": {
|
|
226
|
+
"type": "boolean",
|
|
227
|
+
"default": false
|
|
228
|
+
},
|
|
229
|
+
"stripInvalid": {
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"default": true
|
|
232
|
+
},
|
|
233
|
+
"trackStats": {
|
|
234
|
+
"type": "boolean",
|
|
235
|
+
"default": true
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"test": {
|
|
240
|
+
"type": "boolean",
|
|
241
|
+
"properties": {
|
|
242
|
+
"enabled": {
|
|
243
|
+
"type": "boolean",
|
|
244
|
+
"default": true
|
|
245
|
+
},
|
|
246
|
+
"enableCache": {
|
|
247
|
+
"type": "boolean",
|
|
248
|
+
"default": false
|
|
249
|
+
},
|
|
250
|
+
"throwOnInvalid": {
|
|
251
|
+
"type": "boolean",
|
|
252
|
+
"default": true
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"examples": [
|
|
260
|
+
{
|
|
261
|
+
"enabled": true,
|
|
262
|
+
"enableCache": true,
|
|
263
|
+
"cacheSize": 2000,
|
|
264
|
+
"cacheTTL": 120000,
|
|
265
|
+
"throwOnInvalid": false,
|
|
266
|
+
"stripInvalid": true,
|
|
267
|
+
"trackStats": true,
|
|
268
|
+
"defaultObjectDepth": 10,
|
|
269
|
+
"fieldRules": {
|
|
270
|
+
"cli": {
|
|
271
|
+
"command": "command",
|
|
272
|
+
"path": "path",
|
|
273
|
+
"file": "path",
|
|
274
|
+
"url": "url",
|
|
275
|
+
"email": "email",
|
|
276
|
+
"string": "xss"
|
|
277
|
+
},
|
|
278
|
+
"api": {
|
|
279
|
+
"query": "xss",
|
|
280
|
+
"body": "xss",
|
|
281
|
+
"headers": "html",
|
|
282
|
+
"url": "url"
|
|
283
|
+
},
|
|
284
|
+
"database": {
|
|
285
|
+
"query": "sql",
|
|
286
|
+
"text": "xss"
|
|
287
|
+
},
|
|
288
|
+
"filesystem": {
|
|
289
|
+
"path": "path",
|
|
290
|
+
"filename": "slug"
|
|
291
|
+
},
|
|
292
|
+
"common": {
|
|
293
|
+
"id": "alphanumeric",
|
|
294
|
+
"uuid": "uuid",
|
|
295
|
+
"email": "email",
|
|
296
|
+
"url": "url",
|
|
297
|
+
"slug": "slug",
|
|
298
|
+
"domain": "domain",
|
|
299
|
+
"ipv4": "ipv4",
|
|
300
|
+
"ipv6": "ipv6"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"environments": {
|
|
304
|
+
"development": {
|
|
305
|
+
"enabled": true,
|
|
306
|
+
"throwOnInvalid": true,
|
|
307
|
+
"trackStats": true
|
|
308
|
+
},
|
|
309
|
+
"production": {
|
|
310
|
+
"enabled": true,
|
|
311
|
+
"throwOnInvalid": false,
|
|
312
|
+
"stripInvalid": true,
|
|
313
|
+
"trackStats": true
|
|
314
|
+
},
|
|
315
|
+
"test": {
|
|
316
|
+
"enabled": true,
|
|
317
|
+
"enableCache": false,
|
|
318
|
+
"throwOnInvalid": true
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|