Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

http: classify missing token, invalid token, and insufficient scope distinctly

Đang mở
#2,213 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.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
api, authentication, backend

Hướng nghiên cứu

Bắt đầu với các đường dẫn middleware trong pkg/http/middleware/token.go, pat_scope.go và scope_challenge.go, sau đó kiểm tra các định nghĩa lỗi trong pkg/errors/error.go và hướng dẫn hiện có trong docs/error-handling.md. Chạy các bài kiểm thử middleware HTTP và lỗi của Go với các yêu cầu sử dụng thông tin xác thực bị thiếu, không hợp lệ hoặc hết hạn, cũng như thông tin xác thực không có đủ scope. Công việc được xem là hoàn tất khi mỗi đường dẫn có một mã riêng biệt mà máy có thể đọc được, hành vi WWW-Authenticate áp dụng được vẫn được giữ nguyên, các bài kiểm thử mục tiêu đều đạt và các mã đã được ghi lại.

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

Mô tả

Problem

Authentication and authorization failures currently collapse into generic HTTP errors even though missing credentials, invalid/expired credentials, and insufficient scopes require different remediation. That weakens machine-readable diagnostics for hosts and operators.

Why now

This server sits directly on GitHub token-policy boundaries. Clients and wrappers need explicit failure classification to decide whether to prompt for auth, refresh a token, or request additional scopes.

Expected behavior

Missing token, invalid/expired token, and insufficient scope paths should each expose a distinct machine-readable error code while preserving the existing auth challenge semantics.

Claim-to-codepath map

  • pkg/http/middleware/token.go
  • pkg/http/middleware/pat_scope.go
  • pkg/http/middleware/scope_challenge.go
  • pkg/errors/error.go
  • docs/error-handling.md

Evidence packet

  • Commit under test: fa87e4fc9e4cd1f514cf4c236b9135987a328512
  • Runtime: Go HTTP middleware tests on macOS
  • Repro concept: exercise requests with no token, malformed/invalid token, and OAuth requests lacking required scopes.

Validation requirements

  • Add targeted middleware/error tests for each classification.
  • Preserve WWW-Authenticate challenge behavior where applicable.
  • Document the new machine-readable codes.
Ngôn ngữ chính
Go
Star
33.1k
Fork
5k
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
25

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.

Issue khác của github/github-mcp-server

Tất cả issue của github/github-mcp-server

Issue tương tự

Thêm issue về Go

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.