FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Harden `git ls-remote` invocation against option injection by Copilot · Pull Request #78 · dsp-testing/sourcegraph · GitHub

Harden git ls-remote invocation against option injection - #78

Draft
jf205 with Copilot wants to merge 3 commits into
masterfrom
copilot/fix-code-scanning-alerts-90
Draft

Harden git ls-remote invocation against option injection#78
jf205 with Copilot wants to merge 3 commits into
masterfrom
copilot/fix-code-scanning-alerts-90

Conversation

Copilot AI commented Jun 3, 2026
edited
Loading

Copy link
Copy Markdown

Code scanning alert sourcegraph#90 flagged a user-influenced argument passed to git ls-remote where input could be interpreted as CLI flags. This update applies a minimal argument-boundary fix so repository URLs are always treated as positional input.

  • Alert remediation

    • Updated the git ls-remote call in cmd/gitserver/server/serverutil.go to terminate option parsing before user-controlled URL input.
  • Code change

    // before
    exec.Command("git", "ls-remote", url, prefix+"*")
    
    // after
    exec.Command("git", "ls-remote", "--", url, prefix+"*")
  • Scope

    • Single targeted production-code change.
    • No unrelated refactors or behavior changes beyond safe argument handling.

Test Plan

Code Hosts
  • GitHub
  • GitHub Enterprise
  • Refined GitHub
  • Phabricator
  • Phabricator integration
  • Bitbucket
  • Bitbucket integration
  • Gitlab
Browsers
  • Chrome
  • Firefox

Copilot AI assigned Copilot and jf205 Jun 3, 2026
GitHub Advanced Security started work on behalf of jf205 June 3, 2026 12:44 View session
GitHub Advanced Security finished work on behalf of jf205 June 3, 2026 12:45
GitHub Advanced Security started work on behalf of jf205 June 3, 2026 12:47 View session
GitHub Advanced Security finished work on behalf of jf205 June 3, 2026 12:48
GitHub Advanced Security started work on behalf of jf205 June 3, 2026 12:50 View session
Copilot AI changed the title [WIP] Fix code scanning alert #90 Harden git ls-remote invocation against option injection Jun 3, 2026
Copilot finished work on behalf of jf205 June 3, 2026 12:51
Copilot AI requested a review from jf205 June 3, 2026 12:51
GitHub Advanced Security finished work on behalf of jf205 June 3, 2026 12:51
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL