Skip to content

Commit da7e775

Browse files
committed
Fix Windows build: guard POSIX-only tests with #ifndef _WIN32
Path containment tests use realpath() and mkdir(path, mode) which are not available on Windows. Shell-free exec tests already guarded.
1 parent 0888726 commit da7e775

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/test_security.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,11 @@ TEST(cypher_rejects_union_injection) {
231231
}
232232

233233
/* ══════════════════════════════════════════════════════════════════
234-
* PATH CONTAINMENT
234+
* PATH CONTAINMENT (POSIX only — realpath() not available on Windows)
235235
* ══════════════════════════════════════════════════════════════════ */
236236

237+
#ifndef _WIN32
238+
237239
TEST(path_traversal_blocked) {
238240
/* The get_code_snippet handler uses realpath() to verify that the
239241
* resolved file path starts with the project root. We test this
@@ -282,6 +284,8 @@ TEST(path_within_root_allowed) {
282284
PASS();
283285
}
284286

287+
#endif /* _WIN32 — path containment */
288+
285289
/* ══════════════════════════════════════════════════════════════════
286290
* SHELL-FREE SUBPROCESS EXECUTION (cbm_exec_no_shell)
287291
*
@@ -374,9 +378,11 @@ SUITE(security) {
374378
RUN_TEST(cypher_rejects_sql_injection_in_string);
375379
RUN_TEST(cypher_rejects_union_injection);
376380

377-
/* Path containment */
381+
/* Path containment (POSIX only) */
382+
#ifndef _WIN32
378383
RUN_TEST(path_traversal_blocked);
379384
RUN_TEST(path_within_root_allowed);
385+
#endif
380386

381387
#ifndef _WIN32
382388
/* Shell-free subprocess execution */

0 commit comments

Comments
 (0)