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

Function cbm_validate_project_name

src/foundation/str_util.c:291–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291bool cbm_validate_project_name(const char *name) {
292 if (!name || !*name)
293 return false;
294 /* Reject directory traversal */
295 if (strcmp(name, "..") == 0 || strstr(name, "..") != NULL)
296 return false;
297 /* Reject path separators */
298 if (strchr(name, '/') || strchr(name, '\\'))
299 return false;
300 /* Reject leading dot (hidden files / relative refs) */
301 if (name[0] == '.')
302 return false;
303 /* Allow only alphanumeric, dash, underscore, dot */
304 for (const char *p = name; *p; p++) {
305 if (!(((*p >= 'a') && (*p <= 'z')) || ((*p >= 'A') && (*p <= 'Z')) ||
306 ((*p >= '0') && (*p <= '9')) || *p == '-' || *p == '_' || *p == '.')) {
307 return false;
308 }
309 }
310 return true;
311}
312
313int cbm_json_escape(char *buf, int bufsize, const char *src) {
314 if (!buf || bufsize <= 0) {

Callers 12

cbm_store_openFunction · 0.85
delete_cached_project_dbFunction · 0.85
resolve_project_tailFunction · 0.85
project_db_pathFunction · 0.85
handle_cross_repo_modeFunction · 0.85
db_path_for_projectFunction · 0.85
cr_db_pathFunction · 0.85
collect_all_projectsFunction · 0.85
collect_named_projectsFunction · 0.85
test_fqn.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected