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

HTTP mode: empty `--listen-host` binds all interfaces while CORS is `*` and SDK CrossOriginProtection is left unset |

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

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
55/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
go
領域
api, backend, security

研究方向

Review cmd/github-mcp-server/main.go for the flag definition and pkg/http/server.go for resolveListenAddress. Examine pkg/http/middleware/cors.go for CORS headers and pkg/http/handler.go for cross-origin protection. Understand the interaction of these defaults and propose a change to one or more, ensuring the server still works for browser-based MCP clients. Test by running the server locally and verifying binding and CORS behavior.

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

描述

Static review of public source at commit 85598ba6e125. No traffic was sent to any GitHub MCP environment.

Three HTTP-mode defaults stack toward a wide browser-reachable surface:

  1. Empty listen host binds all interfaces:

cmd/github-mcp-server/main.go:

httpCmd.Flags().String("listen-host", "", "Host the HTTP server binds to (e.g. 127.0.0.1). Empty binds to all interfaces.")

pkg/http/server.go (resolveListenAddress): empty host → ":%d".

  1. CORS always reflects any origin and explicitly allows Authorization:

pkg/http/middleware/cors.go:

w.Header().Set("Access-Control-Allow-Origin", "*")
// ...
// corsAllowedRequestHeaders includes headers.AuthorizationHeader

Comment notes bearer tokens (not cookies). That is fair for ambient-cookie CSRF; it still means any origin can drive credentialed MCP calls if a token is available to page JS.

  1. Streamable HTTP leaves go-sdk cross-origin protection unset (nil = disabled as of go-sdk v1.6.0):

pkg/http/handler.go:

// Cross-origin protection is intentionally left unset: this server
// authenticates via bearer tokens (not cookies), so Sec-Fetch-Site CSRF
// checks are unnecessary and would block browser-based MCP clients.

Suggested change (pick a least-surprise default):

  • Default --listen-host to 127.0.0.1 for local/dev; require an explicit empty/0.0.0.0 for all-interfaces.
  • Or keep all-interfaces for “remote” installs but document/require a non-empty listen host in the HTTP quickstart.
  • Optionally allow configuring ACAO allowlists for non-public deployments; keep * only when intentionally public.

Severity: low–medium / defense-in-depth and insecure default for local HTTP mode. Bearer auth remains the primary control; this is about reducing accidental exposure. No proof-of-concept.

Happy to send a focused PR if this direction is useful.

主要語言
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 摘要。