Skip to content

[codex] Fix macOS path and symlink edge cases#601

Open
Ununp3ntium115 wants to merge 1 commit into
colbymchenry:mainfrom
Ununp3ntium115:codex/fix-macos-path-issues
Open

[codex] Fix macOS path and symlink edge cases#601
Ununp3ntium115 wants to merge 1 commit into
colbymchenry:mainfrom
Ununp3ntium115:codex/fix-macos-path-issues

Conversation

@Ununp3ntium115
Copy link
Copy Markdown

Summary

This PR fixes the macOS/path-related issue reports by hardening path handling and documenting the local development trap around FTS5:

  • Disable Git path quoting for path-emitting commands so tracked and changed files under non-ASCII/CJK directories are parsed as UTF-8 paths.
  • Preserve path bytes except the final record separator, so valid path names with spaces are not accidentally trimmed while parsing Git output.
  • Add realpath containment checks to validatePathWithinRoot so symlinked files and symlinked parent directories cannot escape the project root.
  • Skip symlink targets that resolve outside the root during filesystem scanning before they can be queued for indexing.
  • Add README contributor setup docs, including npm link, focused test commands, and the macOS Node/FTS5 source-build workaround.

Issue Mapping

Root Cause

Git quotes non-ASCII path bytes by default (core.quotePath=true), returning quoted octal escapes for CJK path segments. CodeGraph parsed that output as normal UTF-8 file paths, so extension checks could silently reject otherwise supported source files.

Path containment also relied on lexical path.resolve checks. A path like src/secret.ts could pass because it was textually inside the project, even if src/secret.ts was a symlink to a file outside the root. The fix keeps the lexical check, then verifies existing targets and nearest existing parents with realpath so both direct symlink files and symlinked directories are rejected.

For contributors, the README only covered end-user installation. That left macOS source builds with no guidance for the node:sqlite / FTS5 mismatch that can appear on some local Node builds.

Validation

  • npx -y -p node@22 node ./node_modules/vitest/vitest.mjs run __tests__/extraction.test.ts __tests__/security.test.ts
    • 2 files passed, 317 passed, 2 skipped
  • npm run build
  • git diff --check

Notes

This PR is split from the Claude installer/MCP guidance fixes so the path/security changes can be reviewed independently.

Preserve UTF-8 Git path output for non-ASCII directories, reject symlink escapes with realpath containment checks, skip out-of-root symlink targets during scanning, and document the macOS Node/FTS5 source-build workaround.

Refs colbymchenry#541 colbymchenry#527 colbymchenry#305.
@Ununp3ntium115 Ununp3ntium115 marked this pull request as ready for review May 31, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant