libgit2 / libgit2/libgit2sharp

libgit2sharp is agnostic of GitHub Personal Access Token related errors

Aperta
#1,940 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

Introduction

It's been a while since github deprecated the use of password on CLIs and applications. Personal access token is the way to get authenticated on these apps. libgit2sharp is quiet on errors and warnings pertinent to PATs.

For example,
access tokens can be created with only repository access. Which is restricted to do modifications outside the repository i.e., workflows, wikis and projects. Hence, trying to modify a workflow file using this token should outcome an access exception.

However, libgit2sharp behaves as if nothing happened when that event does occur. Nothing is performed, push fails, however, there is no error/warning report from libgit2sharp.

Reproduction steps

Create a PAT with only repository access. Now try to push a commit that modifies a workflow file.

Expected behavior

Show throw an exception or report an error.

Actual behavior

Does not throw an exception, behaves as if push was successful. However, push actually failed.

to mimic the behavior of git, behavior of libgit2sharp should look like following,

I created an example commit that modified following github workflow file: D:\Code\MyBlog\.github\workflows\deploy.yml

git properly reports the error,

$ git push origin dev
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (9/9), 804 bytes | 268.00 KiB/s, done.
Total 9 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/matrix/blog.git
 ! [remote rejected] dev -> dev (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/deploy.yml` without `workflow` scope)
error: failed to push some refs to 'https://github.com/matrix/blog.git'
Version of LibGit2Sharp (release number or SHA1)

Latest

Operating system(s) tested; .NET runtime tested

Win 10, net sdk: 6.0.101

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

Riproduci il push verso un repository usando un PAT senza lo scope workflow, modificando .github/workflows/deploy.yml, e confronta il risultato con il comando Git mostrato nell’issue. Traccia l’operazione di push e gli errori segnalati nel codice sorgente di libgit2sharp; il lavoro è completato quando un push del workflow rifiutato genera un’eccezione o segnala l’errore remoto invece di apparire riuscito.

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

Valutazione

Stack tecnologico
csharp, git
Ambito
authentication, tooling
Tipo di issue
Bug
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.