micro-models-agent 0.55.0 → 0.55.1
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 +358 -358
- package/dist/certification/certifications.json +493 -493
- package/dist/main.js +122 -55
- package/dist/modules/browser/bridge-server.mjs +202 -202
- package/dist/skills/builtin/git.md +36 -36
- package/dist/skills/builtin/typescript.md +35 -35
- package/package.json +1 -1
- package/dist/cli/commands.js +0 -447
- package/dist/cli/completer.js +0 -167
- package/dist/cli/index.js +0 -2
- package/dist/cli/main.js +0 -153
- package/dist/cli/plugin-commands.js +0 -36
- package/dist/cli/repl-commands.js +0 -761
- package/dist/cli/repl.js +0 -702
- package/dist/cli/run-result.js +0 -33
- package/dist/cli/security-commands.js +0 -164
- package/dist/cli/setup.js +0 -237
- package/dist/config/config.js +0 -276
- package/dist/config/defaults.js +0 -141
- package/dist/config/domains.js +0 -179
- package/dist/config/experts.js +0 -15
- package/dist/config/index.js +0 -4
- package/dist/config/security.js +0 -213
- package/dist/config/types.js +0 -1
- package/dist/core/agent-moe.js +0 -102
- package/dist/core/agent.js +0 -1018
- package/dist/core/bootstrap.js +0 -481
- package/dist/core/crash-handler.js +0 -51
- package/dist/core/environment.js +0 -199
- package/dist/core/index.js +0 -2
- package/dist/core/prompt-builder.js +0 -76
- package/dist/core/session-logger.js +0 -251
- package/dist/core/types.js +0 -1
- package/dist/core/version.js +0 -26
- package/dist/core/workspace.js +0 -76
- package/dist/i18n/en.json +0 -679
- package/dist/i18n/index.js +0 -46
- package/dist/i18n/ru.json +0 -679
- package/dist/index.js +0 -22
- package/dist/llm/image-utils.js +0 -143
- package/dist/llm/index.js +0 -4
- package/dist/llm/model-loader.js +0 -78
- package/dist/llm/openai-compat.js +0 -497
- package/dist/llm/orchestrator.js +0 -200
- package/dist/llm/provider.js +0 -10
- package/dist/llm/response.js +0 -39
- package/dist/llm/token-counter.js +0 -39
- package/dist/llm/types.js +0 -1
- package/dist/logger/app-logger.js +0 -189
- package/dist/logger/file-log.js +0 -151
- package/dist/logger/index.js +0 -1
- package/dist/migration/backup.js +0 -45
- package/dist/migration/detect.js +0 -50
- package/dist/migration/index.js +0 -2
- package/dist/modules/artifacts/store.js +0 -61
- package/dist/modules/browser/actions.js +0 -76
- package/dist/modules/browser/bridge-client.js +0 -199
- package/dist/modules/browser/bridge-path.js +0 -10
- package/dist/modules/browser/cookie-store.js +0 -24
- package/dist/modules/browser/driver.js +0 -136
- package/dist/modules/browser/index.js +0 -7
- package/dist/modules/browser/module.js +0 -29
- package/dist/modules/browser/session.js +0 -342
- package/dist/modules/browser/snapshot.js +0 -148
- package/dist/modules/browser/types.js +0 -12
- package/dist/modules/certification/cli.js +0 -213
- package/dist/modules/certification/fact-checker.js +0 -82
- package/dist/modules/certification/loader.js +0 -106
- package/dist/modules/certification/manifest.js +0 -58
- package/dist/modules/certification/runner.js +0 -245
- package/dist/modules/certification/scenarios.js +0 -407
- package/dist/modules/certification/types.js +0 -1
- package/dist/modules/context/chunk-query.js +0 -100
- package/dist/modules/context/fact-extractor.js +0 -168
- package/dist/modules/context/history.js +0 -15
- package/dist/modules/context/index.js +0 -1
- package/dist/modules/context/manager.js +0 -440
- package/dist/modules/execution/audit-runners.js +0 -206
- package/dist/modules/execution/auditor.js +0 -218
- package/dist/modules/execution/execution-plugin.js +0 -431
- package/dist/modules/execution/index.js +0 -8
- package/dist/modules/execution/module.js +0 -625
- package/dist/modules/execution/moe-executor.js +0 -304
- package/dist/modules/execution/plan-coverage.js +0 -68
- package/dist/modules/execution/plan-persister.js +0 -46
- package/dist/modules/execution/plan-store.js +0 -196
- package/dist/modules/execution/plan-tool.js +0 -677
- package/dist/modules/execution/plan-validator.js +0 -153
- package/dist/modules/execution/planner.js +0 -94
- package/dist/modules/execution/stuck-detector.js +0 -746
- package/dist/modules/execution/tracker.js +0 -69
- package/dist/modules/execution/types.js +0 -1
- package/dist/modules/execution/verifier.js +0 -235
- package/dist/modules/execution/windows-commands.js +0 -41
- package/dist/modules/hallucination/confidence.js +0 -66
- package/dist/modules/hallucination/consistency.js +0 -26
- package/dist/modules/hallucination/detector.js +0 -47
- package/dist/modules/hallucination/factual.js +0 -169
- package/dist/modules/hallucination/index.js +0 -5
- package/dist/modules/hallucination/js-identifiers.js +0 -262
- package/dist/modules/hallucination/llm-judge.js +0 -101
- package/dist/modules/index.js +0 -5
- package/dist/modules/indexer/cache.js +0 -40
- package/dist/modules/indexer/index.js +0 -3
- package/dist/modules/indexer/module.js +0 -246
- package/dist/modules/indexer/project-profile.js +0 -183
- package/dist/modules/indexer/walker.js +0 -101
- package/dist/modules/lsp/check-tool.js +0 -58
- package/dist/modules/lsp/client.js +0 -389
- package/dist/modules/lsp/command.js +0 -60
- package/dist/modules/lsp/config.js +0 -135
- package/dist/modules/lsp/index.js +0 -3
- package/dist/modules/lsp/module.js +0 -260
- package/dist/modules/lsp/probe.js +0 -86
- package/dist/modules/lsp/project-root.js +0 -32
- package/dist/modules/lsp/startup-check.js +0 -144
- package/dist/modules/lsp/types.js +0 -1
- package/dist/modules/mcp/client.js +0 -399
- package/dist/modules/mcp/index.js +0 -3
- package/dist/modules/mcp/module.js +0 -142
- package/dist/modules/mcp/registry.js +0 -15
- package/dist/modules/memory/index.js +0 -1
- package/dist/modules/memory/module.js +0 -96
- package/dist/modules/memory/search.js +0 -42
- package/dist/modules/memory/store.js +0 -69
- package/dist/modules/pipelines/engine.js +0 -60
- package/dist/modules/pipelines/index.js +0 -3
- package/dist/modules/pipelines/parser.js +0 -56
- package/dist/modules/pipelines/template.js +0 -14
- package/dist/modules/plugins/builtin/lint-on-write.js +0 -334
- package/dist/modules/plugins/builtin/notify.js +0 -9
- package/dist/modules/plugins/index.js +0 -1
- package/dist/modules/plugins/loader.js +0 -70
- package/dist/modules/plugins/manager.js +0 -261
- package/dist/modules/plugins/types.js +0 -1
- package/dist/modules/pricing/index.js +0 -61
- package/dist/modules/pricing/prices.js +0 -129
- package/dist/modules/processes/detect.js +0 -34
- package/dist/modules/processes/index.js +0 -2
- package/dist/modules/processes/registry.js +0 -327
- package/dist/modules/processes/runner.js +0 -23
- package/dist/modules/providers/create.js +0 -22
- package/dist/modules/providers/fallback.js +0 -79
- package/dist/modules/providers/health.js +0 -46
- package/dist/modules/providers/index.js +0 -5
- package/dist/modules/providers/manager.js +0 -161
- package/dist/modules/providers/presets.js +0 -128
- package/dist/modules/providers/registry.js +0 -22
- package/dist/modules/providers/types.js +0 -1
- package/dist/modules/registry.js +0 -48
- package/dist/modules/security/audit-log.js +0 -136
- package/dist/modules/security/audit-notifier.js +0 -292
- package/dist/modules/security/command-validator.js +0 -219
- package/dist/modules/security/content-scanner.js +0 -53
- package/dist/modules/security/data-sanitizer.js +0 -89
- package/dist/modules/security/encryption.js +0 -242
- package/dist/modules/security/index.js +0 -14
- package/dist/modules/security/network-validator.js +0 -88
- package/dist/modules/security/path-validator.js +0 -203
- package/dist/modules/security/rate-limiter.js +0 -119
- package/dist/modules/security/security-policies.js +0 -531
- package/dist/modules/security/session-encryption.js +0 -210
- package/dist/modules/security/session-isolation.js +0 -95
- package/dist/modules/session/index.js +0 -3
- package/dist/modules/session/manager.js +0 -172
- package/dist/modules/session/module.js +0 -24
- package/dist/modules/session/store.js +0 -222
- package/dist/modules/session/types.js +0 -1
- package/dist/modules/skills/index.js +0 -2
- package/dist/modules/skills/loader.js +0 -72
- package/dist/modules/skills/matcher.js +0 -27
- package/dist/modules/skills/module.js +0 -129
- package/dist/modules/types.js +0 -1
- package/dist/modules/updater/checker.js +0 -96
- package/dist/modules/updater/index.js +0 -2
- package/dist/modules/updater/module.js +0 -116
- package/dist/modules/user-profile/compressor.js +0 -16
- package/dist/modules/user-profile/index.js +0 -1
- package/dist/modules/user-profile/profile.js +0 -68
- package/dist/tools/approve.js +0 -33
- package/dist/tools/attach-image.js +0 -101
- package/dist/tools/bash.js +0 -519
- package/dist/tools/browser.js +0 -115
- package/dist/tools/chunk-query.js +0 -100
- package/dist/tools/create-dir.js +0 -56
- package/dist/tools/delete-file.js +0 -63
- package/dist/tools/download-file.js +0 -117
- package/dist/tools/edit-file.js +0 -80
- package/dist/tools/enable-tools.js +0 -59
- package/dist/tools/executor.js +0 -154
- package/dist/tools/file-info.js +0 -47
- package/dist/tools/filter-tools.js +0 -17
- package/dist/tools/glob-tool.js +0 -27
- package/dist/tools/grep-tool.js +0 -125
- package/dist/tools/hidden-tools-block.js +0 -37
- package/dist/tools/index.js +0 -78
- package/dist/tools/list-dir.js +0 -49
- package/dist/tools/load-skill.js +0 -43
- package/dist/tools/mcp-call.js +0 -69
- package/dist/tools/move-file.js +0 -86
- package/dist/tools/path-utils.js +0 -101
- package/dist/tools/pipeline-run.js +0 -145
- package/dist/tools/preview.js +0 -2
- package/dist/tools/process-kill.js +0 -40
- package/dist/tools/process-list.js +0 -37
- package/dist/tools/process-log.js +0 -54
- package/dist/tools/question.js +0 -141
- package/dist/tools/read-file.js +0 -179
- package/dist/tools/recall.js +0 -118
- package/dist/tools/registry.js +0 -47
- package/dist/tools/remember.js +0 -68
- package/dist/tools/scope-check.js +0 -32
- package/dist/tools/search-history.js +0 -85
- package/dist/tools/subagent.js +0 -196
- package/dist/tools/types.js +0 -1
- package/dist/tools/user-input.js +0 -123
- package/dist/tools/web-browse.js +0 -87
- package/dist/tools/web-fetch.js +0 -119
- package/dist/tools/web-search.js +0 -105
- package/dist/tools/write-file.js +0 -82
- package/dist/ui/box.js +0 -77
- package/dist/ui/colors.js +0 -4
- package/dist/ui/diff.js +0 -178
- package/dist/ui/index.js +0 -6
- package/dist/ui/line-editor.js +0 -822
- package/dist/ui/line-math.js +0 -73
- package/dist/ui/md-formatter.js +0 -212
- package/dist/ui/output.js +0 -13
- package/dist/ui/plan-view.js +0 -103
- package/dist/ui/renderer.js +0 -259
- package/dist/ui/spinner.js +0 -70
- package/dist/ui/table.js +0 -144
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
import { mergeSecurityConfig } from "../../config/security";
|
|
2
|
-
/**
|
|
3
|
-
* Strict security policy - maximum security, minimum flexibility
|
|
4
|
-
* Recommended for: production environments, sensitive data, multi-user systems
|
|
5
|
-
*/
|
|
6
|
-
export const STRICT_POLICY = {
|
|
7
|
-
name: "Strict",
|
|
8
|
-
description: "Maximum security with minimal flexibility. Blocks most dangerous operations.",
|
|
9
|
-
preset: "strict",
|
|
10
|
-
recommendedFor: ["production", "sensitive-data", "multi-user", "enterprise"],
|
|
11
|
-
config: {
|
|
12
|
-
enabled: true,
|
|
13
|
-
bash: {
|
|
14
|
-
enabled: true,
|
|
15
|
-
blacklist: [
|
|
16
|
-
"rm",
|
|
17
|
-
"dd",
|
|
18
|
-
"chmod",
|
|
19
|
-
"wget",
|
|
20
|
-
"curl",
|
|
21
|
-
"scp",
|
|
22
|
-
"ssh",
|
|
23
|
-
"nc",
|
|
24
|
-
"netcat",
|
|
25
|
-
"mknod",
|
|
26
|
-
"mkfifo",
|
|
27
|
-
"ln",
|
|
28
|
-
"chown",
|
|
29
|
-
"chgrp",
|
|
30
|
-
"useradd",
|
|
31
|
-
"usermod",
|
|
32
|
-
"passwd",
|
|
33
|
-
"sudo",
|
|
34
|
-
"su",
|
|
35
|
-
"exec",
|
|
36
|
-
"eval",
|
|
37
|
-
"source",
|
|
38
|
-
"kill",
|
|
39
|
-
"pkill",
|
|
40
|
-
"killall",
|
|
41
|
-
"shutdown",
|
|
42
|
-
"reboot",
|
|
43
|
-
"halt",
|
|
44
|
-
"poweroff",
|
|
45
|
-
"format",
|
|
46
|
-
"fdisk",
|
|
47
|
-
"parted",
|
|
48
|
-
"mkfs",
|
|
49
|
-
"mount",
|
|
50
|
-
"umount",
|
|
51
|
-
"mv",
|
|
52
|
-
"cp",
|
|
53
|
-
],
|
|
54
|
-
whitelist: ["ls", "cat", "echo", "grep", "find", "pwd", "whoami", "date"],
|
|
55
|
-
blockDangerousFlags: true,
|
|
56
|
-
dangerousFlags: [
|
|
57
|
-
"--force",
|
|
58
|
-
"-rf",
|
|
59
|
-
"--no-preserve-root",
|
|
60
|
-
"--recursive",
|
|
61
|
-
"--all",
|
|
62
|
-
"-x",
|
|
63
|
-
"-e",
|
|
64
|
-
"--delete",
|
|
65
|
-
"--remove",
|
|
66
|
-
"--dangerous",
|
|
67
|
-
"--yes",
|
|
68
|
-
"-y",
|
|
69
|
-
"--no-confirm",
|
|
70
|
-
"-R",
|
|
71
|
-
"--no-clobber",
|
|
72
|
-
],
|
|
73
|
-
dangerousOperators: [">", ">>", "2>", "2>>", "|", "&&", "||", ";", "&", "`"],
|
|
74
|
-
logCommands: true,
|
|
75
|
-
},
|
|
76
|
-
paths: {
|
|
77
|
-
enabled: true,
|
|
78
|
-
denied: [
|
|
79
|
-
".git/",
|
|
80
|
-
"node_modules/",
|
|
81
|
-
".env",
|
|
82
|
-
"*.key",
|
|
83
|
-
"*.pem",
|
|
84
|
-
"*.crt",
|
|
85
|
-
"*.p12",
|
|
86
|
-
"*.pfx",
|
|
87
|
-
"*.secret",
|
|
88
|
-
"*.token",
|
|
89
|
-
"package-lock.json",
|
|
90
|
-
"bun.lock",
|
|
91
|
-
"yarn.lock",
|
|
92
|
-
"pnpm-lock.yaml",
|
|
93
|
-
".ssh/",
|
|
94
|
-
".config/",
|
|
95
|
-
".bashrc",
|
|
96
|
-
".bash_profile",
|
|
97
|
-
".zshrc",
|
|
98
|
-
".profile",
|
|
99
|
-
"/etc/",
|
|
100
|
-
"/usr/",
|
|
101
|
-
"/var/",
|
|
102
|
-
"/bin/",
|
|
103
|
-
"/sbin/",
|
|
104
|
-
"/root/",
|
|
105
|
-
"/home/",
|
|
106
|
-
],
|
|
107
|
-
allowed: [],
|
|
108
|
-
},
|
|
109
|
-
network: {
|
|
110
|
-
enabled: true,
|
|
111
|
-
deniedDomains: [
|
|
112
|
-
"localhost",
|
|
113
|
-
"127.0.0.1",
|
|
114
|
-
"0.0.0.0",
|
|
115
|
-
"::1",
|
|
116
|
-
"*.internal",
|
|
117
|
-
"*.local",
|
|
118
|
-
"192.168.*",
|
|
119
|
-
"10.*",
|
|
120
|
-
"172.16.*",
|
|
121
|
-
],
|
|
122
|
-
allowedDomains: [],
|
|
123
|
-
requestTimeout: 10000,
|
|
124
|
-
maxResponseSize: 10000,
|
|
125
|
-
},
|
|
126
|
-
maxRecursionDepth: 2,
|
|
127
|
-
maxFileOperations: 50,
|
|
128
|
-
rateLimits: {
|
|
129
|
-
maxRequestsPerMinute: 30,
|
|
130
|
-
maxParallelTasks: 3,
|
|
131
|
-
},
|
|
132
|
-
contentScan: {
|
|
133
|
-
enabled: true,
|
|
134
|
-
dangerousPatterns: [
|
|
135
|
-
/eval\(/,
|
|
136
|
-
/new Function\(/,
|
|
137
|
-
/child_process\.exec\(/,
|
|
138
|
-
/child_process\.spawn\(/,
|
|
139
|
-
/require\('child_process'\)/,
|
|
140
|
-
/require\('http'\)\.createServer/,
|
|
141
|
-
/require\('net'\)\.createServer/,
|
|
142
|
-
/process\.exit\(/,
|
|
143
|
-
/while\(true\)/,
|
|
144
|
-
/for\(\;\;\)/,
|
|
145
|
-
/rm -rf/,
|
|
146
|
-
/dd if=/,
|
|
147
|
-
/chmod 777/,
|
|
148
|
-
/wget /,
|
|
149
|
-
/curl /,
|
|
150
|
-
/ssh /,
|
|
151
|
-
/scp /,
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
sessionEncryption: {
|
|
155
|
-
enabled: true,
|
|
156
|
-
encryptHistory: true,
|
|
157
|
-
encryptSessionLog: true,
|
|
158
|
-
},
|
|
159
|
-
auditNotifier: {
|
|
160
|
-
enabled: true,
|
|
161
|
-
minSeverity: "low",
|
|
162
|
-
eventTypes: [
|
|
163
|
-
"security_block",
|
|
164
|
-
"bash_command",
|
|
165
|
-
"file_operation",
|
|
166
|
-
"network_request",
|
|
167
|
-
"authentication",
|
|
168
|
-
"configuration_change",
|
|
169
|
-
"session_start",
|
|
170
|
-
"session_end",
|
|
171
|
-
],
|
|
172
|
-
maxRetries: 3,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* Balanced security policy - good security with reasonable flexibility
|
|
178
|
-
* Recommended for: development, single-user systems, general use
|
|
179
|
-
*/
|
|
180
|
-
export const BALANCED_POLICY = {
|
|
181
|
-
name: "Balanced",
|
|
182
|
-
description: "Good security with reasonable flexibility. Default policy.",
|
|
183
|
-
preset: "balanced",
|
|
184
|
-
recommendedFor: ["development", "single-user", "general-use", "testing"],
|
|
185
|
-
config: {
|
|
186
|
-
enabled: true,
|
|
187
|
-
bash: {
|
|
188
|
-
enabled: true,
|
|
189
|
-
blacklist: [
|
|
190
|
-
"rm",
|
|
191
|
-
"dd",
|
|
192
|
-
"chmod",
|
|
193
|
-
"wget",
|
|
194
|
-
"curl",
|
|
195
|
-
"scp",
|
|
196
|
-
"ssh",
|
|
197
|
-
"nc",
|
|
198
|
-
"netcat",
|
|
199
|
-
"mknod",
|
|
200
|
-
"mkfifo",
|
|
201
|
-
"useradd",
|
|
202
|
-
"usermod",
|
|
203
|
-
"passwd",
|
|
204
|
-
"sudo",
|
|
205
|
-
"su",
|
|
206
|
-
"shutdown",
|
|
207
|
-
"reboot",
|
|
208
|
-
"halt",
|
|
209
|
-
"poweroff",
|
|
210
|
-
"format",
|
|
211
|
-
"fdisk",
|
|
212
|
-
"parted",
|
|
213
|
-
"mkfs",
|
|
214
|
-
],
|
|
215
|
-
whitelist: [],
|
|
216
|
-
blockDangerousFlags: true,
|
|
217
|
-
dangerousFlags: [
|
|
218
|
-
"--force",
|
|
219
|
-
"-rf",
|
|
220
|
-
"--no-preserve-root",
|
|
221
|
-
"--recursive",
|
|
222
|
-
"--all",
|
|
223
|
-
"--delete",
|
|
224
|
-
"--remove",
|
|
225
|
-
"--dangerous",
|
|
226
|
-
"--yes",
|
|
227
|
-
"-y",
|
|
228
|
-
"--no-confirm",
|
|
229
|
-
],
|
|
230
|
-
dangerousOperators: ["|", "&&", "||", ";", "&", "`"],
|
|
231
|
-
logCommands: true,
|
|
232
|
-
},
|
|
233
|
-
paths: {
|
|
234
|
-
enabled: true,
|
|
235
|
-
denied: [
|
|
236
|
-
".git/",
|
|
237
|
-
"node_modules/",
|
|
238
|
-
".env",
|
|
239
|
-
"*.key",
|
|
240
|
-
"*.pem",
|
|
241
|
-
"*.crt",
|
|
242
|
-
"*.p12",
|
|
243
|
-
"*.pfx",
|
|
244
|
-
"*.secret",
|
|
245
|
-
"*.token",
|
|
246
|
-
"package-lock.json",
|
|
247
|
-
"bun.lock",
|
|
248
|
-
"yarn.lock",
|
|
249
|
-
"pnpm-lock.yaml",
|
|
250
|
-
".ssh/",
|
|
251
|
-
],
|
|
252
|
-
allowed: [],
|
|
253
|
-
},
|
|
254
|
-
network: {
|
|
255
|
-
enabled: true,
|
|
256
|
-
deniedDomains: [],
|
|
257
|
-
allowedDomains: [],
|
|
258
|
-
requestTimeout: 15000,
|
|
259
|
-
maxResponseSize: 15000,
|
|
260
|
-
},
|
|
261
|
-
maxRecursionDepth: 3,
|
|
262
|
-
maxFileOperations: 100,
|
|
263
|
-
rateLimits: {
|
|
264
|
-
maxRequestsPerMinute: 60,
|
|
265
|
-
maxParallelTasks: 5,
|
|
266
|
-
},
|
|
267
|
-
contentScan: {
|
|
268
|
-
enabled: true,
|
|
269
|
-
dangerousPatterns: [
|
|
270
|
-
/eval\(/,
|
|
271
|
-
/new Function\(/,
|
|
272
|
-
/child_process\.exec\(/,
|
|
273
|
-
/child_process\.spawn\(/,
|
|
274
|
-
/require\('child_process'\)/,
|
|
275
|
-
/process\.exit\(/,
|
|
276
|
-
/while\(true\)/,
|
|
277
|
-
/for\(\;\;\)/,
|
|
278
|
-
/rm -rf/,
|
|
279
|
-
/dd if=/,
|
|
280
|
-
/chmod 777/,
|
|
281
|
-
],
|
|
282
|
-
},
|
|
283
|
-
sessionEncryption: {
|
|
284
|
-
enabled: false,
|
|
285
|
-
encryptHistory: true,
|
|
286
|
-
encryptSessionLog: true,
|
|
287
|
-
},
|
|
288
|
-
auditNotifier: {
|
|
289
|
-
enabled: false,
|
|
290
|
-
minSeverity: "medium",
|
|
291
|
-
eventTypes: ["security_block", "bash_command", "file_operation", "network_request"],
|
|
292
|
-
maxRetries: 3,
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* Permissive security policy - minimal security, maximum flexibility
|
|
298
|
-
* Recommended for: trusted environments, local development, testing
|
|
299
|
-
*/
|
|
300
|
-
export const PERMISSIVE_POLICY = {
|
|
301
|
-
name: "Permissive",
|
|
302
|
-
description: "Minimal security with maximum flexibility. Use with caution.",
|
|
303
|
-
preset: "permissive",
|
|
304
|
-
recommendedFor: ["trusted-environment", "local-dev", "testing", "sandbox"],
|
|
305
|
-
config: {
|
|
306
|
-
enabled: true,
|
|
307
|
-
bash: {
|
|
308
|
-
enabled: true,
|
|
309
|
-
blacklist: [
|
|
310
|
-
"rm",
|
|
311
|
-
"dd",
|
|
312
|
-
"shutdown",
|
|
313
|
-
"reboot",
|
|
314
|
-
"halt",
|
|
315
|
-
"poweroff",
|
|
316
|
-
"format",
|
|
317
|
-
"fdisk",
|
|
318
|
-
"parted",
|
|
319
|
-
"mkfs",
|
|
320
|
-
],
|
|
321
|
-
whitelist: [],
|
|
322
|
-
blockDangerousFlags: false,
|
|
323
|
-
dangerousFlags: ["--force", "-rf", "--no-preserve-root"],
|
|
324
|
-
dangerousOperators: [],
|
|
325
|
-
logCommands: true,
|
|
326
|
-
},
|
|
327
|
-
paths: {
|
|
328
|
-
enabled: true,
|
|
329
|
-
denied: [".env", "*.key", "*.pem", "*.crt", "*.p12", "*.pfx"],
|
|
330
|
-
allowed: [],
|
|
331
|
-
},
|
|
332
|
-
network: {
|
|
333
|
-
enabled: true,
|
|
334
|
-
deniedDomains: [],
|
|
335
|
-
allowedDomains: [],
|
|
336
|
-
requestTimeout: 30000,
|
|
337
|
-
maxResponseSize: 30000,
|
|
338
|
-
},
|
|
339
|
-
maxRecursionDepth: 5,
|
|
340
|
-
maxFileOperations: 200,
|
|
341
|
-
rateLimits: {
|
|
342
|
-
maxRequestsPerMinute: 120,
|
|
343
|
-
maxParallelTasks: 10,
|
|
344
|
-
},
|
|
345
|
-
contentScan: {
|
|
346
|
-
enabled: true,
|
|
347
|
-
dangerousPatterns: [
|
|
348
|
-
/eval\(/,
|
|
349
|
-
/new Function\(/,
|
|
350
|
-
/while\(true\)/,
|
|
351
|
-
/for\(\;\;\)/,
|
|
352
|
-
/rm -rf/,
|
|
353
|
-
/dd if=/,
|
|
354
|
-
],
|
|
355
|
-
},
|
|
356
|
-
sessionEncryption: {
|
|
357
|
-
enabled: false,
|
|
358
|
-
encryptHistory: false,
|
|
359
|
-
encryptSessionLog: false,
|
|
360
|
-
},
|
|
361
|
-
auditNotifier: {
|
|
362
|
-
enabled: false,
|
|
363
|
-
minSeverity: "high",
|
|
364
|
-
eventTypes: ["security_block"],
|
|
365
|
-
maxRetries: 2,
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
};
|
|
369
|
-
/**
|
|
370
|
-
* All available security policies
|
|
371
|
-
*/
|
|
372
|
-
export const SECURITY_POLICIES = {
|
|
373
|
-
strict: STRICT_POLICY,
|
|
374
|
-
balanced: BALANCED_POLICY,
|
|
375
|
-
permissive: PERMISSIVE_POLICY,
|
|
376
|
-
custom: {
|
|
377
|
-
name: "Custom",
|
|
378
|
-
description: "Custom security configuration",
|
|
379
|
-
preset: "custom",
|
|
380
|
-
recommendedFor: [],
|
|
381
|
-
config: {},
|
|
382
|
-
},
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
* Security policy manager
|
|
386
|
-
*/
|
|
387
|
-
export class SecurityPolicyManager {
|
|
388
|
-
currentPolicy = "balanced";
|
|
389
|
-
customConfig = {};
|
|
390
|
-
/**
|
|
391
|
-
* Get all available policies
|
|
392
|
-
*/
|
|
393
|
-
getPolicies() {
|
|
394
|
-
return Object.values(SECURITY_POLICIES);
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Get a specific policy by name
|
|
398
|
-
*/
|
|
399
|
-
getPolicy(preset) {
|
|
400
|
-
return SECURITY_POLICIES[preset] || SECURITY_POLICIES.balanced;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Get the current policy
|
|
404
|
-
*/
|
|
405
|
-
getCurrentPolicy() {
|
|
406
|
-
if (this.currentPolicy === "custom") {
|
|
407
|
-
return {
|
|
408
|
-
...SECURITY_POLICIES.custom,
|
|
409
|
-
config: this.customConfig,
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
return this.getPolicy(this.currentPolicy);
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Set the current policy
|
|
416
|
-
*/
|
|
417
|
-
setPolicy(preset) {
|
|
418
|
-
this.currentPolicy = preset;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Set custom configuration (for 'custom' preset)
|
|
422
|
-
*/
|
|
423
|
-
setCustomConfig(config) {
|
|
424
|
-
this.customConfig = config;
|
|
425
|
-
this.currentPolicy = "custom";
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Get the current security configuration
|
|
429
|
-
*/
|
|
430
|
-
getConfig() {
|
|
431
|
-
const policy = this.getCurrentPolicy();
|
|
432
|
-
return mergeSecurityConfig({
|
|
433
|
-
...policy.config,
|
|
434
|
-
...(this.currentPolicy === "custom" ? this.customConfig : {}),
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Apply a policy and return the merged configuration
|
|
439
|
-
*/
|
|
440
|
-
applyPolicy(preset, customOverrides) {
|
|
441
|
-
this.setPolicy(preset);
|
|
442
|
-
if (customOverrides) {
|
|
443
|
-
this.customConfig = customOverrides;
|
|
444
|
-
this.currentPolicy = "custom";
|
|
445
|
-
}
|
|
446
|
-
return this.getConfig();
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Get policy recommendation for a use case
|
|
450
|
-
*/
|
|
451
|
-
getRecommendation(useCase) {
|
|
452
|
-
for (const policy of this.getPolicies()) {
|
|
453
|
-
if (policy.recommendedFor.includes(useCase)) {
|
|
454
|
-
return policy;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
return BALANCED_POLICY;
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Check if current policy allows a specific action
|
|
461
|
-
*/
|
|
462
|
-
allowsAction(action, context) {
|
|
463
|
-
const config = this.getConfig();
|
|
464
|
-
switch (action) {
|
|
465
|
-
case "bash":
|
|
466
|
-
if (context?.command) {
|
|
467
|
-
const cmd = context.command.split(" ")[0];
|
|
468
|
-
return !config.bash.blacklist.includes(cmd);
|
|
469
|
-
}
|
|
470
|
-
return true;
|
|
471
|
-
case "file_access":
|
|
472
|
-
if (context?.path) {
|
|
473
|
-
for (const denied of config.paths.denied) {
|
|
474
|
-
if (context.path.includes(denied.replace("*", ""))) {
|
|
475
|
-
return false;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
return true;
|
|
480
|
-
case "network":
|
|
481
|
-
if (context?.path) {
|
|
482
|
-
for (const denied of config.network.deniedDomains) {
|
|
483
|
-
if (context.path.includes(denied.replace("*", ""))) {
|
|
484
|
-
return false;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
return true;
|
|
489
|
-
default:
|
|
490
|
-
return true;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Get policy comparison
|
|
495
|
-
*/
|
|
496
|
-
comparePolicies(policy1, policy2) {
|
|
497
|
-
const config1 = this.getPolicy(policy1).config;
|
|
498
|
-
const config2 = this.getPolicy(policy2).config;
|
|
499
|
-
const comparison = {};
|
|
500
|
-
const keys = new Set([...Object.keys(config1), ...Object.keys(config2)]);
|
|
501
|
-
for (const key of keys) {
|
|
502
|
-
comparison[key] = {
|
|
503
|
-
policy1: config1[key],
|
|
504
|
-
policy2: config2[key],
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
return comparison;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Global security policy manager instance
|
|
512
|
-
*/
|
|
513
|
-
export const globalSecurityPolicyManager = new SecurityPolicyManager();
|
|
514
|
-
/**
|
|
515
|
-
* Create a security policy manager with custom configuration
|
|
516
|
-
*/
|
|
517
|
-
export function createSecurityPolicyManager() {
|
|
518
|
-
return new SecurityPolicyManager();
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Get a policy by name
|
|
522
|
-
*/
|
|
523
|
-
export function getSecurityPolicy(preset) {
|
|
524
|
-
return globalSecurityPolicyManager.getPolicy(preset);
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Apply a security policy
|
|
528
|
-
*/
|
|
529
|
-
export function applySecurityPolicy(preset, customOverrides) {
|
|
530
|
-
return globalSecurityPolicyManager.applyPolicy(preset, customOverrides);
|
|
531
|
-
}
|