Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture error details of "remote unpack failed" #2105

Open
pavelsavara opened this issue Jun 17, 2024 · 0 comments
Open

Capture error details of "remote unpack failed" #2105

pavelsavara opened this issue Jun 17, 2024 · 0 comments

Comments

@pavelsavara
Copy link

pavelsavara commented Jun 17, 2024

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
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

No branches or pull requests

1 participant