micro-models-agent 0.16.3 → 0.16.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/dist/config/config.js
CHANGED
|
@@ -7,13 +7,6 @@ import { MigrationDetector } from '../migration/detect';
|
|
|
7
7
|
import { BackupManager } from '../migration/backup';
|
|
8
8
|
import { validateExpertConfig } from './experts';
|
|
9
9
|
import { ConfigEncryptor } from '../modules/security/encryption';
|
|
10
|
-
/**
|
|
11
|
-
* When the user's config version is older than this, force-overwrite
|
|
12
|
-
* the security bash settings with the current defaults.
|
|
13
|
-
* This ensures critical security changes (like operator allowlists)
|
|
14
|
-
* are applied even if the user has a saved config.
|
|
15
|
-
*/
|
|
16
|
-
const FORCE_SECURITY_UPDATE_VERSION = '2.1.0';
|
|
17
10
|
/**
|
|
18
11
|
* Restore RegExp instances in dangerousPatterns that were serialized as {}
|
|
19
12
|
* (pre-0.8.0 configs) or as {__regex, source, flags} (new format).
|
|
@@ -122,42 +115,6 @@ function applyEnvVars(config) {
|
|
|
122
115
|
result.moe = { ...result.moe, enabled: env.MMA_MOE_ENABLED === 'true' };
|
|
123
116
|
return result;
|
|
124
117
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Force-update security settings when upgrading from an older version.
|
|
127
|
-
* This overrides user config for critical security fields that must
|
|
128
|
-
* match the current code defaults (e.g. dangerousOperators).
|
|
129
|
-
*/
|
|
130
|
-
function forceSecurityUpdate(config) {
|
|
131
|
-
const userVersion = config.version || '0.0.0';
|
|
132
|
-
if (userVersion >= FORCE_SECURITY_UPDATE_VERSION)
|
|
133
|
-
return config;
|
|
134
|
-
// Force-overwrite bash security with current defaults
|
|
135
|
-
const security = config.security || {};
|
|
136
|
-
const userBash = security.bash || {};
|
|
137
|
-
security.bash = {
|
|
138
|
-
...DEFAULT_SECURITY_CONFIG.bash,
|
|
139
|
-
// Keep user's custom blacklist additions, but ensure defaults are present
|
|
140
|
-
blacklist: [...new Set([
|
|
141
|
-
...DEFAULT_SECURITY_CONFIG.bash.blacklist,
|
|
142
|
-
...(userBash.blacklist || []),
|
|
143
|
-
])],
|
|
144
|
-
whitelist: userBash.whitelist || DEFAULT_SECURITY_CONFIG.bash.whitelist,
|
|
145
|
-
dangerousFlags: [...new Set([
|
|
146
|
-
...DEFAULT_SECURITY_CONFIG.bash.dangerousFlags,
|
|
147
|
-
...(userBash.dangerousFlags || []),
|
|
148
|
-
])],
|
|
149
|
-
// dangerousOperators: merge user's additions with defaults (user can add but not remove critical ones)
|
|
150
|
-
dangerousOperators: [...new Set([
|
|
151
|
-
...DEFAULT_SECURITY_CONFIG.bash.dangerousOperators,
|
|
152
|
-
...(userBash.dangerousOperators || []),
|
|
153
|
-
])],
|
|
154
|
-
blockDangerousFlags: DEFAULT_SECURITY_CONFIG.bash.blockDangerousFlags,
|
|
155
|
-
logCommands: DEFAULT_SECURITY_CONFIG.bash.logCommands,
|
|
156
|
-
};
|
|
157
|
-
config.security = security;
|
|
158
|
-
console.log(t('migration.security_updated', { from: userVersion, to: FORCE_SECURITY_UPDATE_VERSION }));
|
|
159
|
-
return config;
|
|
160
|
-
}
|
|
161
118
|
export function loadConfig(options) {
|
|
162
119
|
const globalPath = join(options.configDir, 'config.json');
|
|
163
120
|
mkdirSync(options.configDir, { recursive: true });
|
|
@@ -189,8 +146,6 @@ export function loadConfig(options) {
|
|
|
189
146
|
if (config.security?.contentScan?.dangerousPatterns) {
|
|
190
147
|
config.security.contentScan.dangerousPatterns = restoreDangerousPatterns(config.security.contentScan.dangerousPatterns, DEFAULT_SECURITY_CONFIG.contentScan.dangerousPatterns);
|
|
191
148
|
}
|
|
192
|
-
// Force-update security settings when upgrading from older version
|
|
193
|
-
config = forceSecurityUpdate(config);
|
|
194
149
|
config = applyEnvVars(config);
|
|
195
150
|
// Decrypt sensitive fields in the loaded config
|
|
196
151
|
try {
|
package/dist/config/security.js
CHANGED
package/dist/i18n/en.json
CHANGED
|
@@ -419,7 +419,6 @@
|
|
|
419
419
|
"migration.dir_bak": "- .mma/ \u2192 .mma.bak/ ({count} files)",
|
|
420
420
|
"migration.migrated": "Migrated:",
|
|
421
421
|
"migration.not_needed": "No migration needed",
|
|
422
|
-
"migration.security_updated": "[MMA] Security config force-updated from v{from} to v{to} (dangerous operators reset to defaults)",
|
|
423
422
|
"ui.error_prefix": "Error: ",
|
|
424
423
|
"ui.success_prefix": "\u2713 ",
|
|
425
424
|
"ui.warning_prefix": "\u26a0 ",
|
package/dist/i18n/ru.json
CHANGED
|
@@ -419,7 +419,6 @@
|
|
|
419
419
|
"migration.dir_bak": "- .mma/ → .mma.bak/ ({count} файлов)",
|
|
420
420
|
"migration.migrated": "Мигрировано:",
|
|
421
421
|
"migration.not_needed": "Миграция не требуется",
|
|
422
|
-
"migration.security_updated": "[MMA] Конфигурация безопасности принудительно обновлена с v{from} до v{to} (опасные операторы сброшены)",
|
|
423
422
|
"ui.error_prefix": "Ошибка: ",
|
|
424
423
|
"ui.success_prefix": "✓ ",
|
|
425
424
|
"ui.warning_prefix": "⚠ ",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_SECURITY_CONFIG } from "../../config/security";
|
|
2
2
|
// Fallback in case DEFAULT_SECURITY_CONFIG is not available
|
|
3
3
|
const FALLBACK_BASH_CONFIG = {
|
|
4
|
-
blacklist: ['rm', 'dd', 'chmod', 'wget', 'curl', 'scp', 'ssh', 'nc', 'netcat'],
|
|
4
|
+
blacklist: ['rm', 'dd', 'chmod', 'wget', 'curl', 'scp', 'ssh', 'nc', 'netcat', 'powershell', 'pwsh', 'cmd'],
|
|
5
5
|
whitelist: [],
|
|
6
6
|
blockDangerousFlags: false,
|
|
7
7
|
dangerousFlags: ['--force', '-rf', '--no-preserve-root'],
|
|
@@ -32,8 +32,7 @@ function extractBaseCommand(trimmed) {
|
|
|
32
32
|
i++;
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
|
-
if (tok === "sudo" || tok === "env" || tok === "command" || tok === "exec" || tok === "nohup"
|
|
36
|
-
tok === "powershell" || tok === "pwsh" || tok === "cmd") {
|
|
35
|
+
if (tok === "sudo" || tok === "env" || tok === "command" || tok === "exec" || tok === "nohup") {
|
|
37
36
|
i++;
|
|
38
37
|
continue;
|
|
39
38
|
}
|