[codex] Fix macOS path and symlink edge cases#601
Open
Ununp3ntium115 wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the macOS/path-related issue reports by hardening path handling and documenting the local development trap around FTS5:
validatePathWithinRootso symlinked files and symlinked parent directories cannot escape the project root.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.resolvechecks. A path likesrc/secret.tscould pass because it was textually inside the project, even ifsrc/secret.tswas a symlink to a file outside the root. The fix keeps the lexical check, then verifies existing targets and nearest existing parents withrealpathso 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.tsnpm run buildgit diff --checkNotes
This PR is split from the Claude installer/MCP guidance fixes so the path/security changes can be reviewed independently.