René's URL Explorer Experiment


Title: delete_file: no sha precondition, and a directory path deletes the whole subtree · Issue #3757 · github/github-mcp-server · GitHub

Open Graph Title: delete_file: no sha precondition, and a directory path deletes the whole subtree · Issue #3757 · github/github-mcp-server

X Title: delete_file: no sha precondition, and a directory path deletes the whole subtree · Issue #3757 · github/github-mcp-server

Description: Describe the bug delete_file does not use DELETE /repos/{owner}/{repo}/contents/{path} (which requires the blob sha). It builds a tree entry {path, mode 100644, type blob, sha: nil} on top of the branch's current head and commits it thro...

Open Graph Description: Describe the bug delete_file does not use DELETE /repos/{owner}/{repo}/contents/{path} (which requires the blob sha). It builds a tree entry {path, mode 100644, type blob, sha: nil} on top of the b...

X Description: Describe the bug delete_file does not use DELETE /repos/{owner}/{repo}/contents/{path} (which requires the blob sha). It builds a tree entry {path, mode 100644, type blob, sha: nil} on top of the b...

Opengraph URL: https://github.com/github/github-mcp-server/issues/3757

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"delete_file: no sha precondition, and a directory path deletes the whole subtree","articleBody":"### Describe the bug\n\n`delete_file` does not use `DELETE /repos/{owner}/{repo}/contents/{path}` (which requires the blob `sha`). It builds a tree entry `{path, mode 100644, type blob, sha: nil}` on top of the branch's current head and commits it through the Git Data API. That has two effects:\n\n1. **No precondition.** The input schema has no `sha` property. A `sha` argument is accepted and silently ignored. A file another writer changed after the caller read it is deleted anyway.\n2. **No type check on the path.** A directory path removes every file under it, recursively, and the tool reports success.\n\nCode (main 99d6d650, unchanged since v2.1.0): `pkg/github/repositories.go:1333` (`DeleteFile`; required `owner, repo, path, message, branch`, no `sha`), `:1430-1441` (nil-sha tree entry, `CreateTree` on the head's tree).\n\n### Affected version\n\nv2.1.0 (image `sha256:f6056fc1…0f8a`, commit 4bcdcdf8) and main nightly (image `sha256:48bc16d0…338f`, revision 99d6d650). Local stdio, fine-grained PAT.\n\n### Steps to reproduce the behavior\n\nStale delete:\n1. On branch `test`, create `p4/del.txt` with content `d0`. Its blob sha is `S0`.\n2. A second writer updates the file (`PUT /contents` with `sha: S0`, content `d1-written-after-read`). Its blob sha is now `S1`.\n3. Call:\n   ```json\n   {\"name\":\"delete_file\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"branch\":\"test\",\"path\":\"p4/del.txt\",\"message\":\"delete\",\"sha\":\"S0\"}}\n   ```\n4. Result: success with a new commit. `GET /contents/p4/del.txt?ref=test` returns 404. The newer content is gone, although `S0 != S1`.\n\nDirectory path:\n1. `push_files` `p4/dir/a.txt` and `p4/dir/sub/b.txt` to `test`.\n2. Call:\n   ```json\n   {\"name\":\"delete_file\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"branch\":\"test\",\"path\":\"p4/dir\",\"message\":\"delete\"}}\n   ```\n3. Result: success. Tree before: `p4/dir/a.txt`, `p4/dir/sub/b.txt`. Tree after: neither file.\n\n### Expected vs actual behavior\n\nExpected:\n- A `sha` parameter, as `create_or_update_file` has, checked against the current blob. A stale sha is refused, or at the least an unsupported `sha` argument is not silently accepted.\n- A directory path is rejected (\"path is a directory\").\n\nActual: both calls succeed. The schema gives a caller no way to make the delete conditional.\n\nSuggested fix: before building the tree, fetch the entry at `path` on `branch`. Refuse if it is not a blob, and refuse if a supplied `sha` differs from its sha. Using the Contents `DELETE` endpoint would enforce both, but the comment above `DeleteFile` (`repositories.go:1327-1331`) says the Git Data route is deliberate, because the Contents endpoint does not sign the deletion commit. A pre-check on the current code path avoids that trade-off. Note: open PR #3288 moves `delete_file` onto a shared commit path that retries a ref conflict by rebuilding on the latest tip. Without a sha check, that retry would also delete content written during the retry window.\n\n### Logs\n\n```\ndelete_file (stale sha S0, current S1)  -> OK {\"commit\":{\"sha\":\"f9953c67…\", …}}   (v2.1.0)\n                                        -> OK {\"commit\":{\"sha\":\"a5e7ecf5…\", …}}   (main)\nGET contents p4/del.txt                 -> 404\ndelete_file path \"p4/dir\"               -> OK {\"commit\":{\"sha\":\"47c16484…\", …}}   (v2.1.0); 3b1e4ad3… (main)\ntree p4/* before: p4/dir/a.txt, p4/dir/sub/b.txt, p4/stale.txt   after: p4/stale.txt\ntools/list delete_file properties: branch, message, owner, path, repo\n```\n\nFound during an independent audit of v2.1.0 on a throwaway org and private test repo. Prepared with AI assistance (Claude Code); reproduced by two independent test runs before filing.\n","author":{"url":"https://github.com/rafe-walker","@type":"Person","name":"rafe-walker"},"datePublished":"2026-11-09T06:00:00Z","url":"https://github.com/github/github-mcp-server/issues/3757"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f9d28dd2-c425-c18f-bf45-9bbd0bcc61e5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC668:3A6805:8929D2:B60263:6B05F001
html-safe-nonce0563407c7ff89eea7e64a1f9ba06fa87674861ebc4a5f32eb64eaf1460c7fadd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjY4OjNBNjgwNTo4OTI5RDI6QjYwMjYzOjZCMDVGMDAxIiwidmlzaXRvcl9pZCI6IjUyNDQ4OTgwOTUyNTg3OTE5MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac801c9aff4b459fd4d1e63eed017773946825cfd5e5848d0feb0a18c4348f59b8
hovercard-subject-tagissue:6280845523
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3757/issue_layout
twitter:imagehttps://opengraph.githubassets.com/18b14a5c277d7b050f6b12d3f0dc1eb6f63ac933ad667ffcc0bf6552d588f7f5/github/github-mcp-server/issues/3757
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/18b14a5c277d7b050f6b12d3f0dc1eb6f63ac933ad667ffcc0bf6552d588f7f5/github/github-mcp-server/issues/3757
og:image:altDescribe the bug delete_file does not use DELETE /repos/{owner}/{repo}/contents/{path} (which requires the blob sha). It builds a tree entry {path, mode 100644, type blob, sha: nil} on top of the b...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerafe-walker
hostnamegithub.com
expected-hostnamegithub.com
Nonec214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece
turbo-cache-controlno-preview
go-importgithub.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id942771284
octolytics-dimension-repository_nwogithub/github-mcp-server
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id942771284
octolytics-dimension-repository_network_root_nwogithub/github-mcp-server
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7d164a4e71eb333b2b17fd5b17e18efb7855505c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/github/github-mcp-server/issues/3757#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fissues%2F3757
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fissues%2F3757
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=github%2Fgithub-mcp-server
Reloadhttps://github.com/github/github-mcp-server/issues/3757
Reloadhttps://github.com/github/github-mcp-server/issues/3757
Reloadhttps://github.com/github/github-mcp-server/issues/3757
githubhttps://github.com/github
github-mcp-serverhttps://github.com/github/github-mcp-server
Codehttps://github.com/github/github-mcp-server
Issues238 (238)https://github.com/github/github-mcp-server/issues
Pull requests226 (226)https://github.com/github/github-mcp-server/pulls
Discussionshttps://github.com/github/github-mcp-server/discussions
Actionshttps://github.com/github/github-mcp-server/actions
Security and quality2 (2)https://github.com/github/github-mcp-server/security
Insightshttps://github.com/github/github-mcp-server/insights
https://github.com/github/github-mcp-server
New issuehttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3757
New issuehttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3757
#3790https://github.com/github/github-mcp-server/pull/3790
delete_file: no sha precondition, and a directory path deletes the whole subtreehttps://github.com/github/github-mcp-server/issues/3757#top
#3790https://github.com/github/github-mcp-server/pull/3790
https://github.com/rafe-walker
rafe-walkerhttps://github.com/rafe-walker
on Nov 9, 2026https://github.com/github/github-mcp-server/issues/3757#issue-6280845523
99d6d65https://github.com/github/github-mcp-server/commit/99d6d6503a7b2a133e2f8a595d6d0ba24b4086d3
4bcdcdfhttps://github.com/github/github-mcp-server/commit/4bcdcdf8d7beee98c9448e73e257308280924cc4
99d6d65https://github.com/github/github-mcp-server/commit/99d6d6503a7b2a133e2f8a595d6d0ba24b4086d3
#3288https://github.com/github/github-mcp-server/pull/3288
https://github.com/rafe-walker
rafe-walkerhttps://github.com/rafe-walker
on Nov 12, 2026https://github.com/github/github-mcp-server/issues/3757#issuecomment-6829112427
#3790https://github.com/github/github-mcp-server/pull/3790
Sign up for freehttps://github.com/signup?return_to=https://github.com/github/github-mcp-server/issues/3757
Sign in to commenthttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3757
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.