Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#2,213 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
55/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
go

研究方向

先從 pkg/http/middleware/token.go、pat_scope.go 和 scope_challenge.go 中的 middleware 路徑開始,接著檢查 pkg/errors/error.go 中的錯誤定義,以及 docs/error-handling.md 中現有的指南。使用憑證缺少、無效或已過期,以及 scope 不足的請求,執行 Go HTTP middleware 和錯誤測試。完成的標準是每條路徑都有不同的機器可讀取代碼,適用的 WWW-Authenticate 行為維持不變,目標測試通過,且代碼已完成文件化。

由索引模型根據 Issue 內容生成。

描述

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.
主要語言
Go
星號
33.1k
分支
5k
平均合併
2 天 1 小時
30 天內合併 PR
25

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/github-mcp-server 的其他 Issue

查看 github/github-mcp-server 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。