René's URL Explorer Experiment


Title: fix: reject directory paths and stale shas in delete_file by shhhhhhjokerist · Pull Request #3790 · github/github-mcp-server · GitHub

Open Graph Title: fix: reject directory paths and stale shas in delete_file by shhhhhhjokerist · Pull Request #3790 · github/github-mcp-server

X Title: fix: reject directory paths and stale shas in delete_file by shhhhhhjokerist · Pull Request #3790 · github/github-mcp-server

Description: Summary delete_file now verifies what is at the requested path before it mutates the tree: directory paths and missing paths are rejected instead of committing a deletion, and an optional sha argument turns the call into "delete only if the file is unchanged". Why Fixes #3757. delete_file builds the tree entry with SHA: nil, so the commit deletes the whole subtree when path is a directory. Because there is no precondition either, a stale read of the file cannot be detected, and deleting a path that does not exist succeeds and produces an empty commit. The REST contents DELETE endpoint is not an alternative here: it does not sign the resulting commit, while the Git Data API does, which is why delete_file uses tree entries. The guard therefore belongs in the handler, before the tree is created. What changed pkg/github/repositories.go: look up the path with the contents API after reading the branch head and before creating the tree. Reject directory paths, missing paths, and a sha that no longer matches the blob on the branch. pkg/github/repositories.go: sha is a new optional input; the path description now says a directory path is rejected. pkg/github/repository_tool_types.go: DeleteFileInput.Sha carries the optional precondition. pkg/github/repositories_test.go: the existing success case now mocks the contents lookup, plus Test_DeleteFile_Precondition (stale sha / directory / not found) and Test_DeleteFile_AcceptsMatchingSha. README.md: regenerated with generate-docs for the two description changes. MCP impact Tool schema or behavior changed delete_file gains an optional sha; directory and missing paths now return a tool error instead of a commit. Existing calls without sha behave as before for regular files. Prompts tested (tool changes only) "Delete docs/old-setup.md from owner/repo on main" → deletes the file as before. "Delete docs/old-setup.md on main, but only if its sha is still abc123" → deletes when the sha matches and returns a sha mismatch error when the file changed. "Delete the docs directory from owner/repo" → returns path "docs" is a directory; delete_file only removes a single file instead of deleting every file below it. Security / limits Data exposure, filtering, or token/size limits considered The extra contents lookup is a single read on the same branch the deletion targets. The tool is still destructive and its destructiveHint stays true; the change narrows what a confirmed call can destroy. Tool renaming I am not renaming tools as part of this PR Lint & tests Linted locally with golangci-lint run ./pkg/github/... → 0 issues (go vet ./pkg/github also clean) go test ./pkg/github -run 'Test_DeleteFile' passes, and fails on the base revision with the new precondition tests Full ./script/test on this Windows checkout: 15 pre-existing failures unrelated to this change (assign_copilot_to_issue base64 icon snapshots, protocol=2026-07-28 typed outputs, Test_RequestCopilotReview); the same 15 tests fail on main without this change. Docs Updated (README)

Open Graph Description: Summary delete_file now verifies what is at the requested path before it mutates the tree: directory paths and missing paths are rejected instead of committing a deletion, and an optional sha argum...

X Description: Summary delete_file now verifies what is at the requested path before it mutates the tree: directory paths and missing paths are rejected instead of committing a deletion, and an optional sha argum...

Opengraph URL: https://github.com/github/github-mcp-server/pull/3790

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e6dba43e-1362-4902-04f2-050d3d6efd17
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB504:95F42:80397:B0E1A:6B05F581
html-safe-nonce8d984803fbd5dc254397b5d3aa38388757951d298d92a6f0c5ab4cce03b33989
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTA0Ojk1RjQyOjgwMzk3OkIwRTFBOjZCMDVGNTgxIiwidmlzaXRvcl9pZCI6IjM0MzQxMzAyMjM4ODM3NDQ2NDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc7f93a1cc623b35e86677d43a4484d21d2d9af9852c386d05b10e8db65b40588
hovercard-subject-tagpull_request:5235169869
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/github/github-mcp-server/pull/3790/files
twitter:imagehttps://avatars.githubusercontent.com/u/104197119?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/104197119?s=400&v=4
og:image:altSummary delete_file now verifies what is at the requested path before it mutates the tree: directory paths and missing paths are rejected instead of committing a deletion, and an optional sha argum...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
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

Links:

Skip to contenthttps://github.com/github/github-mcp-server/pull/3790/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fpull%2F3790%2Ffiles
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%2Fpull%2F3790%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=github%2Fgithub-mcp-server
Reloadhttps://github.com/github/github-mcp-server/pull/3790/files
Reloadhttps://github.com/github/github-mcp-server/pull/3790/files
Reloadhttps://github.com/github/github-mcp-server/pull/3790/files
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
Sign up for GitHub https://github.com/signup?return_to=%2Fgithub%2Fgithub-mcp-server%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgithub%2Fgithub-mcp-server%2Fissues%2Fnew%2Fchoose
shhhhhhjokeristhttps://github.com/shhhhhhjokerist
github:mainhttps://github.com/github/github-mcp-server/tree/main
shhhhhhjokerist:fix/delete-file-preconditionhttps://github.com/shhhhhhjokerist/github-mcp-server/tree/fix/delete-file-precondition
Conversation 7 https://github.com/github/github-mcp-server/pull/3790
Commits 1 https://github.com/github/github-mcp-server/pull/3790/commits
Checks 1 https://github.com/github/github-mcp-server/pull/3790/checks
Findings https://github.com/github/github-mcp-server/pull/3790/findings
Files changed https://github.com/github/github-mcp-server/pull/3790/files
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3790/files
fix: reject directory paths and stale shas in delete_file https://github.com/github/github-mcp-server/pull/3790/files#top
Show all changes 1 commit https://github.com/github/github-mcp-server/pull/3790/files
674d55d fix: reject directory paths and stale shas in delete_file shhhhhhjokerist Nov 10, 2026 https://github.com/github/github-mcp-server/pull/3790/commits/674d55d8cadb71ab82f537da0f8115200d9d0dbc
Clear filters https://github.com/github/github-mcp-server/pull/3790/files
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3790/files
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3790/files
README.md https://github.com/github/github-mcp-server/pull/3790/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
delete_file.snap https://github.com/github/github-mcp-server/pull/3790/files#diff-e59a8eb2f63e5d796e0d6c3bcf9e77d95dbe33cce2c7261214edc35b1ef70eb2
repositories.go https://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
repositories_test.go https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
repository_tool_types.go https://github.com/github/github-mcp-server/pull/3790/files#diff-1189bc0ef240f3b188742d259f7703a82230bb1010d1de025c0494ba394311b1
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
README.mdhttps://github.com/github/github-mcp-server/pull/3790/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
View file https://github.com/github/github-mcp-server/blob/674d55d8cadb71ab82f537da0f8115200d9d0dbc/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3790/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3790/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
https://github.com/github/github-mcp-server/pull/3790/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
pkg/github/__toolsnaps__/delete_file.snaphttps://github.com/github/github-mcp-server/pull/3790/files#diff-e59a8eb2f63e5d796e0d6c3bcf9e77d95dbe33cce2c7261214edc35b1ef70eb2
View file https://github.com/github/github-mcp-server/blob/674d55d8cadb71ab82f537da0f8115200d9d0dbc/pkg/github/__toolsnaps__/delete_file.snap
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3790/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3790/files#diff-e59a8eb2f63e5d796e0d6c3bcf9e77d95dbe33cce2c7261214edc35b1ef70eb2
https://github.com/github/github-mcp-server/pull/3790/files#diff-e59a8eb2f63e5d796e0d6c3bcf9e77d95dbe33cce2c7261214edc35b1ef70eb2
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
pkg/github/repositories.gohttps://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
View file https://github.com/github/github-mcp-server/blob/674d55d8cadb71ab82f537da0f8115200d9d0dbc/pkg/github/repositories.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3790/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
https://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
shhhhhhjokeristhttps://github.com/shhhhhhjokerist
Nov 10, 2026https://github.com/github/github-mcp-server/pull/3790/files#r4520806568
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
674d55dhttps://github.com/github/github-mcp-server/commit/674d55d8cadb71ab82f537da0f8115200d9d0dbc
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3790/files
https://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
https://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
https://github.com/github/github-mcp-server/pull/3790/files#diff-396c76ab9d216fd1d9043c561bf2bfe57ade719aa0c0cedb47e85b3277714b92
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
pkg/github/repositories_test.gohttps://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
View file https://github.com/github/github-mcp-server/blob/674d55d8cadb71ab82f537da0f8115200d9d0dbc/pkg/github/repositories_test.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3790/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
https://github.com/github/github-mcp-server/pull/3790/files#diff-1f37596d401182a6443ebc5cf77fd4451cb48bd6f8a3ca31742a7a29feed4279
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
pkg/github/repository_tool_types.gohttps://github.com/github/github-mcp-server/pull/3790/files#diff-1189bc0ef240f3b188742d259f7703a82230bb1010d1de025c0494ba394311b1
View file https://github.com/github/github-mcp-server/blob/674d55d8cadb71ab82f537da0f8115200d9d0dbc/pkg/github/repository_tool_types.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3790/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3790/files#diff-1189bc0ef240f3b188742d259f7703a82230bb1010d1de025c0494ba394311b1
https://github.com/github/github-mcp-server/pull/3790/files#diff-1189bc0ef240f3b188742d259f7703a82230bb1010d1de025c0494ba394311b1
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-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.