MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_hook_script_name_safe

Function cbm_hook_script_name_safe

src/cli/cli.c:2641–2654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2639}
2640
2641static bool cbm_hook_script_name_safe(const char *script_name) {
2642 if (!script_name || !script_name[0]) {
2643 return false;
2644 }
2645 for (const unsigned char *cursor = (const unsigned char *)script_name; *cursor; cursor++) {
2646 bool safe = (*cursor >= 'a' && *cursor <= 'z') || (*cursor >= 'A' && *cursor <= 'Z') ||
2647 (*cursor >= '0' && *cursor <= '9') || *cursor == '-' || *cursor == '_' ||
2648 *cursor == '.';
2649 if (!safe) {
2650 return false;
2651 }
2652 }
2653 return true;
2654}
2655
2656/* Build the hook command string written into Claude Code's settings.json.
2657 * POSIX embeds a safely quoted absolute custom config path or a portable $HOME

Calls

no outgoing calls

Tested by

no test coverage detected