Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(ci): resolve cppcheck null-deref + variable-scope and security-audit findings
Martin Vogelb5f086974ddf
diff --git a/internal/cbm/helpers.c b/internal/cbm/helpers.cindex a36b57cdf..6a44425b0 100644--- a/internal/cbm/helpers.c+++ b/internal/cbm/helpers.c@@ -760,6 +760,8 @@ static char *append_path_segments(char *out, const char *rel_path, size_t plen,}char *cbm_fqn_compute(CBMArena *a, const char *project, const char *rel_path, const char *name) {+ if (!project) project = "";+ if (!rel_path) rel_path = "";size_t proj_len = strlen(project);size_t path_len = strlen(rel_path);size_t name_len = name ? strlen(name) : 0;diff --git a/scripts/security-allowlist.txt b/scripts/security-allowlist.txtindex 9ac4d9cdc..0acad067d 100644--- a/scripts/security-allowlist.txt+++ b/scripts/security-allowlist.txt@@ -49,3 +49,4 @@ URL:https://api.github.com/repos/DeusData/codebase-memory-mcp/releases/latest:upURL:https://github.com/DeusData/codebase-memory-mcp/releases/latest/download:binary download + checksumsURL:https://github.com/DeusData/codebase-memory-mcp/releases/latest:version check via redirect headerURL:http://127.0.0.1:UI server binding (localhost only)+URL:https://www.sqlite.org/c3ref/c_checkpoint_full.html:sqlite WAL checkpoint API doc reference (comment only, not a network call)diff --git a/scripts/security-audit.sh b/scripts/security-audit.shindex 04344d52a..b23cd0db2 100755--- a/scripts/security-audit.sh+++ b/scripts/security-audit.sh@@ -170,8 +170,8 @@ while IFS= read -r match; dofile=$(echo "$match" | cut -d: -f1)relfile="${file#"$ROOT/"}"case "$relfile" in- src/cli/cli.c|src/store/store.c|src/pipeline/*.c|src/foundation/log.c|src/ui/http_server.c|src/ui/config.c|src/mcp/mcp.c)- ;; # Known safe+ src/cli/cli.c|src/store/store.c|src/pipeline/*.c|src/foundation/log.c|src/foundation/diagnostics.c|src/ui/http_server.c|src/ui/config.c|src/mcp/mcp.c)+ ;; # Known safe (diagnostics.c: atomic .tmp+rename metrics dump to configured path)*)echo "REVIEW: ${match}"echo " -> Unexpected fopen(\"w\") in ${relfile}"@@ -238,10 +238,14 @@ if [ -f "$MCP_FILE" ]; then# - get_code_snippet: reads source via read_file_lines (path-contained)# - manage_adr: reads/writes ADR files# - detect_changes: reads git diff output+ # - update check: reads the version-check HTTP response (fixed buffer)+ # - HTTP transport: reads the incoming request body (content-length bound)# Count fopen/fread calls and compare against expectedFOPEN_COUNT=$(grep -c 'fopen\|fread\|read_file' "$MCP_FILE" 2>/dev/null || echo "0")- # Known count as of v0.5.5: update this when legitimate reads are added- EXPECTED_MAX=12+ # Update this when legitimate reads are added. 13 reads audited as of the+ # search/ADR/Windows-support commits — all path-contained or transport+ # reads, no new exfiltration surface.+ EXPECTED_MAX=13if [ "$FOPEN_COUNT" -gt "$EXPECTED_MAX" ]; thenecho "REVIEW: src/mcp/mcp.c has $FOPEN_COUNT file read operations (expected max $EXPECTED_MAX)"echo " New file reads in MCP tool handlers must be reviewed for data exfiltration risk."diff --git a/src/pipeline/pass_githistory.c b/src/pipeline/pass_githistory.cindex 39ac394e9..0eb28a7ac 100644--- a/src/pipeline/pass_githistory.c+++ b/src/pipeline/pass_githistory.c@@ -490,8 +490,8 @@ int cbm_pipeline_githistory_compute(const char *repo_path, cbm_githistory_result* we don't re-scan history. NULL on OOM is fine — the caller still* gets the couplings. */cbm_file_temporal_t *ft_arr = malloc(MAX_FILE_TEMPORAL * sizeof(cbm_file_temporal_t));- int ft_count = 0;if (ft_arr) {+ int ft_count = 0;CBMHashTable *file_idx = cbm_ht_create(CBM_SZ_1K);for (int c = 0; c < commit_count; c++) {if (cf[c].count > GH_MAX_FILES) {diff --git a/src/pipeline/path_alias.c b/src/pipeline/path_alias.cindex 3e7ef9dc5..106ecf2ae 100644--- a/src/pipeline/path_alias.c+++ b/src/pipeline/path_alias.c@@ -272,10 +272,10 @@ char *cbm_path_alias_resolve(const cbm_path_alias_map_t *map, const char *modulefor (int i = 0; i < map->count; i++) {const cbm_path_alias_t *e = &map->entries[i];- size_t prefix_len = strlen(e->alias_prefix);- size_t suffix_len = strlen(e->alias_suffix);if (e->has_wildcard) {+ size_t prefix_len = strlen(e->alias_prefix);+ size_t suffix_len = strlen(e->alias_suffix);if (mod_len < prefix_len + suffix_len) {continue;}