libgit2 / libgit2/libgit2sharp

Capture error details of "remote unpack failed"

未關閉
#2,105 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
C#
星號
3.5k
分支
925
PR 合併指標
30 天內沒有已合併 PR

描述

Reproduction steps
  • create Azure DevOps repo with security rules enabled
  • create commit which violates server rules. For example appsettings.json
{
    "Parameters": {
        "note": "this will trigger secret warning in the Azdo push, which is what I'm testing for",
        "secret": "opensesame"
    }
}

I configure the repo.Network.Push this way

var po = new PushOptions()
{
    CredentialsProvider = (_, _, _) => AzdoCreddentials,
                
    OnPushStatusError = (reason) =>
    {
        mainLogger.Log(LogLevel.Error, "Push failed with {}", reason.Message);
    },
};

Expected behavior

Make PushOptions.OnPushStatusError or another callback to receive details of remote unpack failure similar to git CLI

Specifically error: remote unpack failed: error VS403654: The push was rejected because it contains one or more secrets. in the log below.

PS C:\Dev\dotnet-mirroring\sandbox\pavelsavara-runtime> git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 20 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 406 bytes | 406.00 KiB/s, done.
Total 3 (delta 1), reused 3 (delta 1), pack-reused 0 (from 0)
remote: Analyzing objects... (3/3) (27 ms)
remote: Validating commits... (1/1) done (0 ms)
remote: Checking for credentials and other secrets...  done (59 ms)
error: remote unpack failed: error VS403654: The push was rejected because it contains one or more secrets.
To https://dev.azure.com/dnceng/internal/_git/pavelsavara-runtime
 ! [remote rejected]         browser_firefox_shm -> browser_firefox_shm (VS403654: The push was rejected because it contains one or more secrets.

Resolve the following secrets before pushing again. For help, see https://aka.ms/1ESSecretScanning.
Actual behavior

LibGit2Sharp.LibGit2SharpException: unpacking the sent packfile failed on the remote with no more details

Version of LibGit2Sharp (release number or SHA1)

0.29.0

Operating system(s) tested; .NET runtime tested
  • windows 10
  • SDK 9.0.100-preview.1.24101.2

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 PushOptions.OnPushStatusError 回呼和 issue 中描述的遠端 unpack 失敗路徑開始。重現 Azure DevOps 的秘密掃描拒絕,並追蹤詳細遠端訊息遺失的位置。完成的標準是呼叫端能夠接收到遠端 unpack 失敗的詳細資訊,包括 VS403654 訊息,而不只是一般例外。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, git
領域
developer-experience, tooling
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。