libgit2 / libgit2/libgit2sharp

Capture error details of "remote unpack failed"

Aperta
#2,105 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
3.5k
Fork
925
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Iniziate dal callback PushOptions.OnPushStatusError e dal percorso dell’errore di remote unpack descritto nell’issue. Riproducete il rifiuto della scansione dei segreti di Azure DevOps e tracciate il punto in cui il messaggio remoto dettagliato viene perso. Il lavoro è completato quando i chiamanti possono ricevere i dettagli dell’errore di remote unpack, incluso il messaggio VS403654, invece della sola eccezione generica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, git
Ambito
developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.