Skip to content

Fix git.py logic - #1524

Open
triptijain2112 wants to merge 15 commits into
masterfrom
users/triptijain/msrc-new-fix
Open

triptijain2112 wants to merge 15 commits into
masterfrom
users/triptijain/msrc-new-fix

Conversation

@triptijain2112

@triptijain2112 triptijain2112 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Please make sure the code is following contribution guidelines in CONTRIBUTING.md

  • : This PR has a corresponding issue open in the Repository.
  • : Approach is signed off on the issue.

@triptijain2112 triptijain2112 changed the title Refactor git command execution to use _get_git() MSRC 31000000710912: Fix git.py - Repository-root git.exe planting code execution Oct 7, 2026
@triptijain2112
triptijain2112 requested a balanced review from Copilot October 7, 2026 07:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Repository-boundary detection is incomplete and the mandatory security regression tests are missing.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Hardens Git executable discovery to avoid repository-root executable planting.

Changes:

  • Adds canonical PATH-based Git resolution.
  • Routes Git subprocess calls through the hardened locator.
  • Rejects overlapping paths and non-executable candidates.
File Description
azure-devops/​azext_devops/​dev/​common/​git.py Implements trusted Git executable discovery and updates callers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread azure-devops/azext_devops/dev/common/git.py
This file contains regression tests for the CWD git-planting vulnerability, ensuring that only trusted git binaries are selected and that planted executables in the current working directory or its subdirectories are rejected.
Updated unit tests for the _paths_overlap helper to use os.path.join for cross-platform compatibility.
Added tests to ensure Git remote discovery does not invoke canary executables and does not leak Azure DevOps credentials to subprocesses.
Added environment sanitization for Git subprocesses to remove Azure DevOps CLI credential/config variables.
@triptijain2112 triptijain2112 changed the title MSRC 31000000710912: Fix git.py - Repository-root git.exe planting code execution Fix git.py logic Oct 7, 2026
Removed unnecessary comments and documentation in git.py.
Remove redundant comments and docstrings from test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants