mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 17:32:18 +00:00
Security: - Fix command injection in 15+ shell interpolation sites with shellQuote() - Add token-based authentication to MCP TCP server - Fix heredoc delimiter collision in SFTP write fallbacks - Add case-insensitive flag to mcpServerBridge command blocklist - Add exhaustive default case to createModelFromConfig Architecture: - Split aiBridge.cjs (1971→1483 lines) into 4 modules: shellUtils, codexHelpers, claudeHelpers, ptyExec - Split SettingsAITab.tsx (1480→520 lines) into 10 sub-components - Extract shared processCattyStream from AIChatSidePanel.tsx (-168 lines) - Consolidate duplicate PTY execution logic into shared ptyExec.cjs - Consolidate duplicate stripAnsi/toUnpackedAsarPath utilities Code quality: - Remove ~33 debug console.log statements from production code - Remove dead code: terminal_read_output stub, checkToolPermission, isCommandAllowed, READ_ONLY_TOOLS - Unify bridge type accessor in useAIState.ts (eliminate 15 unsafe casts) - Add localStorage session pruning (50 sessions / 200 messages cap) - Fix ModelSelector onBlur race condition (setTimeout → preventDefault) - Fix duplicate getShellEnv() calls in Codex helpers - Remove unused _config param from claudeAgentAdapter - Type claudeAgentAdapter bridge parameter directly as ClaudeBridge Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
10 lines
312 B
TypeScript
10 lines
312 B
TypeScript
/**
|
|
* Safely quote a string for use in a POSIX shell command.
|
|
* Wraps the value in single quotes and escapes any embedded single quotes.
|
|
*
|
|
* Example: shellQuote("hello 'world'") => "'hello '\\''world'\\'''"
|
|
*/
|
|
export function shellQuote(s: string): string {
|
|
return "'" + s.replace(/'/g, "'\\''") + "'";
|
|
}
|