libgit2 / libgit2/libgit2sharp

libgit2sharp is agnostic of GitHub Personal Access Token related errors

Đang mở
#1,940 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C#
Star
3.5k
Fork
925
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện thao tác push lên một repository bằng PAT không có workflow scope, sửa đổi .github/workflows/deploy.yml, và so sánh kết quả với lệnh Git được hiển thị trong issue. Truy vết thao tác push và các lỗi được báo cáo trong mã nguồn libgit2sharp; công việc được xem là hoàn tất khi một workflow push bị từ chối sẽ phát sinh exception hoặc báo cáo lỗi remote thay vì trông như đã thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, git
Lĩnh vực
authentication, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.