Skip to content

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.

Fix Windows build: guard POSIX-only tests with #ifndef _WIN32

Martin Vogelda7e77580f6d
diff --git a/tests/test_security.c b/tests/test_security.c
index cce8a155d..09c4bb7f3 100644
--- a/tests/test_security.c
+++ b/tests/test_security.c
@@ -231,9 +231,11 @@ TEST(cypher_rejects_union_injection) {
}
/* ══════════════════════════════════════════════════════════════════
- * PATH CONTAINMENT
+ * PATH CONTAINMENT (POSIX only — realpath() not available on Windows)
* ══════════════════════════════════════════════════════════════════ */
+#ifndef _WIN32
+
TEST(path_traversal_blocked) {
/* The get_code_snippet handler uses realpath() to verify that the
* resolved file path starts with the project root. We test this
@@ -282,6 +284,8 @@ TEST(path_within_root_allowed) {
PASS();
}
+#endif /* _WIN32 — path containment */
+
/* ══════════════════════════════════════════════════════════════════
* SHELL-FREE SUBPROCESS EXECUTION (cbm_exec_no_shell)
*
@@ -374,9 +378,11 @@ SUITE(security) {
RUN_TEST(cypher_rejects_sql_injection_in_string);
RUN_TEST(cypher_rejects_union_injection);
- /* Path containment */
+ /* Path containment (POSIX only) */
+#ifndef _WIN32
RUN_TEST(path_traversal_blocked);
RUN_TEST(path_within_root_allowed);
+#endif
#ifndef _WIN32
/* Shell-free subprocess execution */