Skip to content

Windows: valid Git worktree scans fail for non-ASCII target paths #192

Description

@pradigmaz

Environment

  • Windows
  • Codex Security plugin: 0.1.11
  • Security workspace UI: 0.1.63
  • Python default locale encoding: cp1251
  • Target: <Windows path containing Cyrillic characters>

Reproduction

  1. Use a valid Git worktree whose path contains non-ASCII characters.
  2. Start a standard scan for the worktree.

Workspace setup reports:

{
  "isGit": true,
  "isWorktree": true,
  "hasHead": true
}

Observed

The scan fails with:

Scan target must stay inside its Git working tree.

git rev-parse --show-toplevel returns the correct UTF-8 path, but Python decodes the output using the Windows locale. The resulting path is corrupted, so Path.relative_to() raises ValueError.

Setting PYTHONUTF8=1 makes the helper pass, confirming the decoding issue.

Validation

The issue was reproduced and verified with temporary Git repositories using root and nested targets. Tested path components included:

  • Cyrillic
  • Simplified and Traditional Chinese
  • Japanese
  • Arabic
  • Korean
  • Thai
  • Lao
  • Khmer
  • Burmese
  • Georgian
  • Armenian
  • Indic scripts
  • Persian and Urdu
  • Amharic
  • Mongolian
  • Tibetan
  • Ukrainian and Serbian
  • Latin diacritics
  • Combining characters
  • Emoji

After decoding text-mode Git output as UTF-8, all cases passed and returned the correct pathspec. Binary Git output remained unchanged.

Suggested fix

Set an explicit encoding for text-mode Git subprocess calls:

encoding="utf-8" if text else None,

The scan-start waiter also remains pending after this startup error. A retry returns:

A scan-start waiter already exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions