libgit2 / libgit2/libgit2sharp

libgit2sharp is agnostic of GitHub Personal Access Token related errors

オープン
#1,940 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

workflow スコープのない PAT を使用してリポジトリへの push を再現し、.github/workflows/deploy.yml を変更して、結果を issue に示されている Git コマンドと比較します。libgit2sharp のソースで push 操作と報告されたエラーを追跡します。完了の条件は、拒否された workflow push が成功したように見えるのではなく、例外を発生させるかリモートエラーを報告することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
authentication, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。