Skip to content

Harden workspace git indexing against repo-configured fsmonitor execution#1873

Merged
juliusmarminge merged 2 commits intomainfrom
codex/fix-git-based-indexing-vulnerability
Apr 10, 2026
Merged

Harden workspace git indexing against repo-configured fsmonitor execution#1873
juliusmarminge merged 2 commits intomainfrom
codex/fix-git-based-indexing-vulnerability

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 10, 2026

Motivation

  • Workspace indexing invoked git ls-files and git check-ignore inside repositories which allowed repo-configured helpers like core.fsmonitor to execute attacker-supplied code in untrusted repos.
  • The change aims to remove that local RCE vector while preserving the intended workspace-indexing semantics and ignore filtering.

Description

  • Add a WORKSPACE_GIT_HARDENED_CONFIG_ARGS constant with -c core.fsmonitor=false and -c core.untrackedCache=false to explicitly disable repo-configured fsmonitor/untracked-cache helpers.
  • Prepend the hardened config args to the git ls-files ... -z invocation in listWorkspaceFiles so workspace file enumeration no longer honors repo helpers.
  • Prepend the same hardened config args to the git check-ignore --no-index -z --stdin invocations used by filterIgnoredPaths so ignore filtering also cannot trigger repo helpers.
  • Update GitCore unit tests to expect the hardened args for the check-ignore path and add an additional test asserting the hardened args are passed to ls-files while verifying returned paths remain unchanged.

Testing

  • Modified and added unit tests in apps/server/src/git/Layers/GitCore.test.ts to assert the hardened git args are used; these tests were committed with the change.
  • Attempted to run required repository checks bun fmt, bun lint, and bun typecheck, but they could not be executed in this environment because bun is not installed (/bin/bash: bun: command not found).
  • No automated test runner (bun run test / Vitest) was executed here due to the same missing bun runtime, so test execution results are not available in this environment.

Codex Task


Note

Medium Risk
Changes the arguments used for workspace file enumeration and ignore filtering, which could affect performance/behavior in some repos despite being a targeted hardening change. Main risk is unexpected differences in git ls-files/git check-ignore output or timing on edge-case configurations.

Overview
Hardens workspace indexing against repo-configured helper execution. Workspace indexing now prepends -c core.fsmonitor=false -c core.untrackedCache=false to the git commands used by listWorkspaceFiles (git ls-files …) and filterIgnoredPaths (git check-ignore …) to prevent repository config from triggering fsmonitor/untracked-cache helpers.

Tests were updated to expect the hardened args for check-ignore, and a new unit test asserts listWorkspaceFiles passes the hardened config while preserving parsed path output.

Reviewed by Cursor Bugbot for commit 9b14396. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Disable fsmonitor and untracked cache for workspace git indexing commands

Adds a shared WORKSPACE_GIT_HARDENED_CONFIG_ARGS constant (-c core.fsmonitor=false -c core.untrackedCache=false) and prepends it to the git invocations in GitCore.listWorkspaceFiles and GitCore.filterIgnoredPaths. This prevents repo-configured fsmonitor hooks from interfering with workspace file indexing and ignore filtering.

Macroscope summarized 9b14396.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 881d68e2-5da7-4196-bfa5-eb3ee8147ddc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-git-based-indexing-vulnerability

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 10, 2026
macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 10, 2026

Approvability

Verdict: Approved

Security hardening change that disables fsmonitor and untrackedCache git options when indexing workspace files, preventing potential arbitrary code execution from malicious repo configurations. The changes are defensive, well-tested, and limited in scope.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp bot dismissed their stale review April 10, 2026 07:57

Dismissing prior approval to re-evaluate 9b14396

@juliusmarminge juliusmarminge merged commit 1cba2f6 into main Apr 10, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the codex/fix-git-based-indexing-vulnerability branch April 10, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark codex size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant