T09 · Insecure Skill Coding Practices
- Location
cursor_doctor/fixes/apply.py:25- Finding
Destructive repair operations execute without confirmation and can report false success
- Content
View full analysis
str: steps = [] stdout, stderr, rc = _run_cmd(["pkill", "-f", "Cursor"]) steps.append("✅ Cursor processes terminated") home = os.path.expanduser("~") mcp_dir = os.path.join(home, ".cursor", ".mcp") if os.path.isdir(mcp_dir): try: shutil.rmtree(mcp_dir, ignore_errors=True) steps.append("✅ MCP cache cleared") except Exception: steps.append("⚠️ Unable to clear MCP cache; manual deletion required") ``` ```python def fix_crash_clear_cache() -> str: steps = [] home = os.path.expanduser("~") cache_dirs = [ os.path.join(home, "Library", "Application Support", "Cursor", "Cache"), os.path.join(home, "Library", "Application Support", "Cursor", "CachedData"), os.path.join(home, "Library", "Application Support", "Cursor", "Code Cache"), os.path.join(home, ".cursor", ".mcp"), ] for d in cache_dirs: if os.path.isdir(d): try: shutil.rmtree(d, ignore_errors=True) steps.append(f"✅ Cleared: {os.path.basename(d)}") except Exception: steps.append(f"⚠️ Failed to clear: {os.path.basename(d)}") _run_cmd(["pkill", "-f", "Cursor"]) steps.append("✅ Cursor processes terminated") ``` ```python if os.path.isfile(settings_file): try: shutil.copy2(settings_file, backup_file) steps.append(f"✅ Configuration backed up to {backup_file}") with open(settings_file, "w") as f: json.dump({}, f) steps.append("✅ Configuration reset to defaults") ...[truncated 2920 chars]- Remediation
View remediation
