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 CodeQL TOCTOU: use fchmod before fclose on gate script
Martin Vogelfa97ea5b0905
diff --git a/src/cli/cli.c b/src/cli/cli.cindex cce79c731..6ff95c9a8 100644--- a/src/cli/cli.c+++ b/src/cli/cli.c@@ -1559,8 +1559,14 @@ static void cbm_install_hook_gate_script(const char *home) {"is not indexed yet, call index_repository first. Fall back to Grep/Glob/Read ""only for text content search. If you need Grep, retry.' >&2\n""exit 2\n");+ /* fchmod before close to avoid TOCTOU race (CodeQL cpp/toctou-race-condition) */+#ifndef _WIN32+ fchmod(fileno(f), 0755);+#endiffclose(f);+#ifdef _WIN32chmod(script_path, 0755);+#endif}#define GEMINI_HOOK_MATCHER "google_search|read_file|grep_search"