get_file_contents directory listings put tokenised private-repo download URLs in model context
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 67/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- github, go
- Lĩnh vực
- backend-api-design, security
Hướng nghiên cứu
Start in pkg/github/repositories.go and trace how directory entries are rendered, including how the fields parameter uses fileContentFieldEnum. Check the large-file message that explicitly tells callers to use the download URL. Done when directory listings omit or strip the tokenized URL by default, explicit field requests can still include it, and the large-file path retains its download URL.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the feature or problem you’d like to solve
Low-severity hardening suggestion (not a vulnerability report).
In v2.1.0, get_file_contents on a directory of a private repository returns, for every entry, a download_url of the form https://raw.githubusercontent.com/<owner>/<repo>/<sha>/<path>?token=… in the model-visible text. That URL fetches the file with no other authentication for a short time (a few minutes in my tests, and it worked more than once); without the token parameter it returns 404.
The REST contents API itself returns this URL, so the server is passing it through rather than creating it. But for a directory listing the model rarely needs a credential-bearing URL for every file, and it is the one field in the listing that grants access on its own. If an agent is steered by untrusted content (prompt injection) into copying it somewhere public, anyone can fetch that private file for the next few minutes. The marginal risk is small, since a hijacked agent could also read and paste the file, but the URL is a bearer credential the model doesn’t need.
For files of 1 MB or more, get_file_contents also tells the model to use the download URL (pkg/github/repositories.go, the File %s is too large to display … Use the download URL message), which is a reasonable place to keep it.
Proposed solution
- Omit
download_url(or strip itstokenquery parameter) from directory listings by default; callers that need it can already ask for it through thefieldsparameter (download_urlis infileContentFieldEnum). - Keep the explicit download URL for the large-file path, where the model is meant to use it.
Benefit: one less bearer credential in model context and in client logs/transcripts, with no loss of function.
Example prompts or workflows (for tools/toolsets only)
- "List the files in
src/of my private repo" — needs names, paths, sizes, SHAs; not per-file signed URLs. - "Find the config file in this private repo and summarise it" — the agent lists the directory, then reads the file through the tool, never through the raw URL.
- Agent transcripts and MCP client logs that record tool output no longer contain short-lived access tokens for private files.
Additional context
- Reproduced on v2.1.0 (
ghcr.io/github/github-mcp-server@sha256:f6056fc10bfffcc8c81a6417a2e9ca12808647e8dd6049642a4feaadee0e0f8a),--read-only, fine-grained read-only token, against a throwaway private repo in an org I own. Asrc/listing returned 4 entries, all with tokeniseddownload_urls; an unauthenticated GET of one returned 200, the same URL without the token 404. - Found during an independent, AI-assisted review of v2.1.0; reproduced by hand.
- Ngôn ngữ chính
- Go
- Star
- 34.2k
- Fork
- 5.3k
- Merge trung bình
- 5 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/github-mcp-server
-
update_issue_labels is annotated destructiveHint: false but replaces (removes) existing labelsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
github/github-mcp-server#3760 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
docs(install-claude): "environment variable" examples put the PAT in argv and the saved configĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
github/github-mcp-server#3758 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
github/github-mcp-server#3729 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
github/github-mcp-server#3722 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Insiders Feedback: PR created UI doesn't link to the PRCó thể đã có người làm @genius-0963 đã nhận 5 ngày trước. Đang mởbug insiders user-experience
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
github/github-mcp-server#3658 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của github/github-mcp-server
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
prime-radiant-inc/evener#5901 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
-
kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
kyma-project/serverless#2769 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update the mise toolsĐang mởready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
hexlet-basics/hexlet-basics#962 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
imapproxy closeForMaintenance grace timer calls clientConn.Close() before closeMaintenanceTransportCó thể đã có người làm @dejanstrbac đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày