Route MCP existence-only probes through existing CBM file and directory helpers instead of raw access/stat checks. Reuse project_db_path for QN cold-start DB lookup, length-check ADR probes, and keep metadata-dependent stat calls unchanged.
Extend source-safety to block newly added raw access() and strndup() in production diffs, with self-tests for both guard paths.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add cbm_str_copy() as the shared allocation-free fixed-buffer copy helper and use it in httplink, envscan, and store file-tree code.
Remove guarded production strncpy() sites, add a source-safety rule and self-test for future strncpy regressions, and tighten the logging thread-safety comment to match the implementation.
Validation: make -f Makefile.cbm lint-source-safety; CBM_ONLY_SUITE=httplink make -f Makefile.cbm test; CBM_ONLY_SUITE=str_util build/c/test-runner; CBM_ONLY_SUITE=pipeline CBM_ONLY_TEST=envscan build/c/test-runner; CBM_ONLY_SUITE=store_arch build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Extend the source-safety self-test to prove fprintf(stdout, ...) is rejected in MCP/pipeline code, matching the existing protocol-output guard.
Reuse store.c's heap_strdup helper for neighbor-name and LIKE-hint allocations instead of direct strdup calls. This keeps ownership behavior unchanged while reducing allocator-wrapper drift in touched store paths.
Validation: make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_search ./build/c/test-runner; CBM_ONLY_SUITE=mcp ./build/c/test-runner; bash scripts/check-source-safety.sh; bash scripts/test-source-safety.sh; git diff --check.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Replace raw strdup calls in the incremental inbound-edge snapshot with cbm_strdup so the touched path follows the repository portability wrapper convention. Add a source-safety diff guard and self-test that reject newly introduced raw strdup calls in production code without failing historical existing uses.
Validation: git diff --check; make -j8 -f Makefile.cbm build/c/test-runner; make -f Makefile.cbm lint-source-safety; CBM_ONLY_SUITE=pipeline ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Add a root-overridable self-test harness for scripts/check-source-safety.sh so the guard can be tested against synthetic trees without scanning the real repository.
Cover clean input, MCP/server stdout writes, unsafe string APIs, and new raw filesystem APIs in production diffs. Add a dedicated lint-source-safety target because the broader lint-no-suppress path is currently blocked by existing NOLINT audit failures before this guard can run.
Validation: bash scripts/test-source-safety.sh; bash scripts/check-source-safety.sh; git diff --check; make -f Makefile.cbm lint-source-safety.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>