wormclaude 1.0.223 → 1.0.225

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/theme.js CHANGED
@@ -16,4 +16,4 @@ export const theme = {
16
16
  synType: '#a78bfa', // tip/sınıf adları, sabitler
17
17
  synProp: '#e0e0e0', // özellik/anahtar adları
18
18
  };
19
- export const VERSION = '1.0.223';
19
+ export const VERSION = '1.0.225';
package/dist/tools.js CHANGED
@@ -793,6 +793,30 @@ const TOOL_META = {
793
793
  let planMode = false;
794
794
  export function isPlanMode() { return planMode; }
795
795
  export function setPlanMode(on) { planMode = !!on; }
796
+ // ── İNCELEME KİLİDİ (auto salt-oku) ───────────────────────────────────────────
797
+ // "incele/açıkla/ne işe yarıyor" = ANLAMA görevi. Model burada dosya YARATMAMALI,
798
+ // CodeAudit/SecurityScan ÇALIŞTIRMAMALI, komut yazmamalı — sadece Read/Glob/Grep + metin.
799
+ // SEBEP: güvenlik-koklu/klon klasörleri (kendi CLAUDE.md + credentials.txt içerikleriyle)
800
+ // modeli "audit et / dosyayı yeniden yaz" diye KAÇIRIYOR (klasörün içeriği = prompt injection).
801
+ // Prompt yaması buna karşı zayıf kaldığı için deterministik kilit: model ne derse desin tutar.
802
+ // Turn başında kullanıcının mesajından hesaplanır → compaction'dan ETKİLENMEZ (turn boyu sabit).
803
+ let inspectLock = false;
804
+ const _inspectReads = new Set();
805
+ export function isInspectLock() { return inspectLock; }
806
+ export function setInspectLock(on) { inspectLock = !!on; _inspectReads.clear(); }
807
+ const _INSPECT_VERBS = /(incele|inceler|ne i[şs]e? yar|a[çc][ıi]kla|analiz|g[öo]zden ge[çc]ir|i[çc]inde ne|ne var|[öo]zetle|anlat|what'?s in|what does|what is in|explain|analy[sz]e|review|inspect|understand|describe|summari[sz]e)/i;
808
+ const _ACTION_VERBS = /(yap\b|yaz\b|olu[şs]tur|kur\b|d[üu]zelt|ekle\b|\bsil\b|de[ğg]i[şs]tir|g[üu]ncelle|refactor|implement|\bbuild\b|create|\bmake\b|\bwrite\b|\bfix\b|\badd\b|remove|\bedit\b|setup|install|generate|klonla|clone|indir|[çc]al[ıi][şs]t[ıi]r|\brun\b|tara\b|scan|recon|\baudit\b|denetle|pentest|exploit|payload|dropper)/i;
809
+ // incele-fiili VAR ama yap/yaz/tara/audit gibi eylem-fiili YOK → salt-oku kilidi aç.
810
+ // KRİTİK: dosya YOLLARINI önce çıkar — "poc_clone", "build/", "create_x.py" gibi alt-diziler
811
+ // eylem-fiili ("clone/build/create") sanılıp kilidi yanlışlıkla KAPATMASIN (false-negative).
812
+ export function computeInspectIntent(text) {
813
+ const t = String(text || '')
814
+ .replace(/[a-zA-Z]:[\\/][^\s]*/g, ' ') // C:\...\poc_clone
815
+ .replace(/[~.]?[\\/][^\s]*/g, ' ') // ./foo, /bar, ~/x
816
+ .replace(/\S+[\\/]\S+/g, ' ') // a\b veya a/b içeren herhangi token
817
+ .replace(/\b[\w.-]+\.\w{1,5}\b/g, ' '); // dosya.uzantı (index.html, app.py)
818
+ return _INSPECT_VERBS.test(t) && !_ACTION_VERBS.test(t);
819
+ }
796
820
  const MAX_TOOL_CONCURRENCY = Number(process.env.WORMCLAUDE_MAX_TOOL_CONCURRENCY) || 10;
797
821
  export function isConcurrencySafe(name) {
798
822
  return TOOL_META[name]?.concurrencySafe ?? false; // bilinmeyen/MCP → sıralı (güvenli taraf)
@@ -856,6 +880,26 @@ async function execOne(call, hooks) {
856
880
  return { ok: false, output: 'Plan modunda — yazma/komut engellendi (yalnız okuma/araştırma). Planı yaz; uygulamak için kullanıcı /plan off demeli.', args };
857
881
  }
858
882
  }
883
+ // 3.2) İNCELEME KİLİDİ: "incele/açıkla" görevinde mutasyon/tarama/komut araçları engelli.
884
+ // Klasörün kendi içeriği (CLAUDE.md, credentials.txt…) modeli "audit et / dosyayı
885
+ // yeniden yaz" diye kaçırsa BİLE tutar → sadece oku (Read/Glob/Grep) + metinle açıkla.
886
+ if (inspectLock) {
887
+ const _mut = new Set(['Write', 'Edit', 'MultiEdit', 'CloneSite', 'CodeAudit', 'SecurityScan', 'JwtAudit', 'CreateDocument', 'Type', 'Click', 'Key']);
888
+ const _isShell = call.name === 'Bash' || call.name === 'PowerShell';
889
+ const _roCmd = _isShell && args?.command && isShellCommandReadOnly(String(args.command));
890
+ if (_mut.has(call.name) || (_isShell && !_roCmd)) {
891
+ return { ok: false, output: 'This is an INSPECT/UNDERSTAND task (the user asked to review/explain — they did NOT ask to write, fix, scan, or audit). Do NOT create or modify any file, and do NOT run CodeAudit, SecurityScan, or shell commands. Read only the MEANINGFUL files (docs, entry point, config) with Read/Glob/Grep — SKIP minified/vendor/bundled files and data dumps — then explain the project in clear, concise TEXT. Do this SILENTLY: do NOT mention this restriction or narrate switching tools; just read and explain.', args };
892
+ }
893
+ // Döngü kırıcı: aynı dosyayı bu turda tekrar okuma (compaction sonrası re-read loop'u).
894
+ if (call.name === 'Read') {
895
+ const _p = String(args?.file_path || '');
896
+ if (_p && _inspectReads.has(_p)) {
897
+ return { ok: false, output: `[ALREADY-READ] "${_p}" was already read this turn (its content is above). Do NOT read it again — continue explaining with what you already have, or finish.`, args };
898
+ }
899
+ if (_p)
900
+ _inspectReads.add(_p);
901
+ }
902
+ }
859
903
  // 3.4) Güvenlik taraması — kullanıcı "tara/scan/xss/sqli/recon" deyince model bu aracı çağırır;
860
904
  // elle PowerShell payload yazmak YERİNE sunucu motorunu (runPentest) çalıştırır.
861
905
  if (call.name === 'SecurityScan') {
package/dist/tui.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import readline from 'node:readline';
7
7
  import stringWidth from 'string-width';
8
8
  import { loadConfig, streamChat, fetchAccount } from './api.js';
9
- import { allToolSchemas, executeToolCalls, executeTool, toolLabel, setToolConfig, getBashCwd, setComputerUse, isComputerUse } from './tools.js';
9
+ import { allToolSchemas, executeToolCalls, executeTool, toolLabel, setToolConfig, getBashCwd, setComputerUse, isComputerUse, setInspectLock, computeInspectIntent } from './tools.js';
10
10
  import { setCheckpointStore } from './checkpoint.js';
11
11
  import { extractImages, visionMessages, VISION_MODEL } from './vision.js';
12
12
  import * as path from 'node:path';
@@ -429,6 +429,9 @@ export async function runTui() {
429
429
  if (displayText !== undefined)
430
430
  printItem({ kind: 'user', text: displayText }); // skill/@mention: gösterim farklı
431
431
  history.push({ role: 'user', content: userText });
432
+ // "incele/açıkla" (yaz/tara demeden) → salt-oku kilidi: dosya yaratma + CodeAudit/SecurityScan
433
+ // + komut engellenir; klasör içeriği modeli kaçırsa bile deterministik tutar. Turn boyu sabit.
434
+ setInspectLock(computeInspectIntent(userText));
432
435
  const timer = setInterval(() => { spin++; if (busy && !perm && !ask)
433
436
  refresh(); }, 120);
434
437
  let lastSig = '', sameCount = 0, usedWeb = false, lastAnswer = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wormclaude",
3
- "version": "1.0.223",
3
+ "version": "1.0.225",
4
4
  "description": "WormClaude CLI - uncensored security+code assistant (ink TUI, Claude-style)",
5
5
  "type": "module",
6
6
  "bin": {