René's URL Explorer Experiment


Title: Symlink corruption: `get_file_contents` follows symlinks but `create_or_update_file` does not · Issue #2997 · github/github-mcp-server · GitHub

Open Graph Title: Symlink corruption: `get_file_contents` follows symlinks but `create_or_update_file` does not · Issue #2997 · github/github-mcp-server

X Title: Symlink corruption: `get_file_contents` follows symlinks but `create_or_update_file` does not · Issue #2997 · github/github-mcp-server

Description: Describe the bug While using Claude Fable 5, I asked the agent to edit a text file that was a symlink to another file. get_file_contents returned the target file's content and a SHA without indicating that the requested path was a symlin...

Open Graph Description: Describe the bug While using Claude Fable 5, I asked the agent to edit a text file that was a symlink to another file. get_file_contents returned the target file's content and a SHA without indicat...

X Description: Describe the bug While using Claude Fable 5, I asked the agent to edit a text file that was a symlink to another file. get_file_contents returned the target file's content and a SHA without ind...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Symlink corruption: `get_file_contents` follows symlinks but `create_or_update_file` does not","articleBody":"### Describe the bug\n\nWhile using Claude Fable 5, I asked the agent to edit a text file that was a symlink to another file.\n\n`get_file_contents` returned the target file's content and a SHA without indicating that the requested path was a symlink. Claude then passed the edited content and returned SHA to `create_or_update_file` for the same path.\n\nThe write succeeded, but updated the symlink blob rather than the target file, while preserving Git mode `120000`. In the original incident, approximately 15 KB of Markdown became the symlink target and the resulting commit could not be checked out.\n\nThis does not happen in a normal filesystem-based editing workflow, where reads and writes both follow the symlink. It is specific to workflows that use GitHub MCP or the GitHub API for the write, including cases where an agent reads from a local checkout and uses MCP only to commit the update.\n\n### Affected version\n\nThe command that works with the current image is:\n\n```console\n$ docker run -i --rm ghcr.io/github/github-mcp-server:latest --version\nGitHub MCP Server\nVersion: v1.8.0\nCommit: ca8ab52dcc45b86fae190398178fd22edb7b1362\nBuild Date: 2026-07-30T13:28:24Z\n```\n\n### Steps to reproduce the behavior\n\n1. Create and push a regular file and a symlink to it:\n\n   ```bash\n   head -c 4097 /dev/zero | tr '\\0' A > file1.txt\n   ln -s file1.txt file2.txt\n   git add file1.txt file2.txt\n   git commit -m \"Add symlink\"\n   git push\n   ```\n\n2. Call `get_file_contents` for `file2.txt`. It returns the 4,097-byte contents of `file1.txt`, a file SHA, and no indication that the requested path is a symlink.\n\n3. Call `create_or_update_file` for `file2.txt` with the returned SHA and content.\n\n4. Inspect the result:\n\n   ```bash\n   git ls-tree HEAD file2.txt\n   git cat-file -p HEAD:file2.txt\n   ```\n\n   The mode remains `120000`, but the blob contains the submitted file content instead of `file1.txt`.\n\n5. Clone or check out the resulting commit. Checkout fails with `File name too long`.\n\n### Expected vs actual behavior\n\nExpected: before writing, the agent is told that GitHub API writes operate on the exact Git path and do not follow symlinks like filesystem writes. This should still allow intentional symlink updates: to edit the linked file, write to its target path; to change the symlink, write the new target path.\n\nActual: the read follows the symlink, while the write updates the symlink blob. The different semantics are not exposed to the agent, and SHA validation accepts the value returned by the read.\n\nA possible fix is to document the exact-path behavior in both the server-level MCP `instructions` and the `tools/list` descriptions of mutating file tools. This informs the agent before any file tool is called, including when it reads the content locally and uses MCP only for the write.\n\nI would be happy to submit a pull request once the maintainers confirm the preferred wording and scope.\n\n### Logs\n\nThe following output was captured using the official v1.8.0 Docker image. Repository identifiers, SHAs, URLs, and most of the 4,097-byte content have been redacted.\n\n`get_file_contents` followed `file2.txt` and returned the 4,097-byte contents of `file1.txt` as a text resource:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":2,\"result\":{\"content\":[\n  {\"type\":\"text\",\"text\":\"successfully downloaded text file (SHA: \u003credacted>)\"},\n  {\"type\":\"resource\",\"resource\":{\"uri\":\"repo://\u003credacted>/contents/file2.txt\",\"mimeType\":\"text/plain; charset=utf-8\",\"text\":\"AAAA... \u003c4,093 bytes redacted>\"}}\n]}}\n```\n\n`create_or_update_file` accepted the same content and returned success with `size: 4097`:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":3,\"result\":{\"content\":[{\"type\":\"text\",\"text\":\"{\\\"content\\\":{\\\"name\\\":\\\"file2.txt\\\",\\\"path\\\":\\\"file2.txt\\\",\\\"sha\\\":\\\"\u003credacted>\\\",\\\"size\\\":4097,\\\"html_url\\\":\\\"\u003credacted>\\\"},\\\"commit\\\":{\\\"sha\\\":\\\"\u003credacted>\\\",\\\"message\\\":\\\"Reproduce symlink write behavior\\\",\\\"html_url\\\":\\\"\u003credacted>\\\"}}\"}]}}\n```\n\nAfter the write, the Contents API reported the path as a 4,097-byte symlink, and the Git tree still had mode `120000`:\n\n```json\n{\"type\":\"symlink\",\"size\":4097,\"sha\":\"\u003credacted>\",\"target\":\"AAAA... \u003c4,093 bytes redacted>\"}\n{\"path\":\"file2.txt\",\"mode\":\"120000\",\"type\":\"blob\",\"sha\":\"\u003credacted>\",\"size\":4097}\n```\n\nThis cannot happen on an ordinary file system. The MCP call itself produced no error. Cloning the resulting branch fetched the commit, then failed during checkout:\n\n```text\nCloning into '\u003credacted>'...\nerror: unable to create symlink file2.txt: File name too long\nfatal: unable to checkout working tree\nwarning: Clone succeeded, but checkout failed.\n```\n","author":{"url":"https://github.com/kujiy","@type":"Person","name":"kujiy"},"datePublished":"2026-08-03T02:27:16Z","url":"https://github.com/github/github-mcp-server/issues/2997"}

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:7eadb7b8-d330-a20a-15f7-3f9a39bdb968
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9000:33943:1F08103:290EF7A:6B0691D6
html-safe-nonce9d17be2bd52a447f4190710540e720b1645317048bbe6a272b343d8f871ed9f8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDAwOjMzOTQzOjFGMDgxMDM6MjkwRUY3QTo2QjA2OTFENiIsInZpc2l0b3JfaWQiOiIzOTQ5MDI3OTk3Mjk4MTAyNzQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac057fb18872a44f1c1729a066fddc071fd0648daa46c5822d332709fa4839b45e
hovercard-subject-tagissue:5045729909
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/2997/issue_layout
twitter:imagehttps://opengraph.githubassets.com/36b0d71f7b3e45f9deff0b9e914a57fbbedcf1d167a3e2fe010d37f6d578e7db/github/github-mcp-server/issues/2997
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/36b0d71f7b3e45f9deff0b9e914a57fbbedcf1d167a3e2fe010d37f6d578e7db/github/github-mcp-server/issues/2997
og:image:altDescribe the bug While using Claude Fable 5, I asked the agent to edit a text file that was a symlink to another file. get_file_contents returned the target file's content and a SHA without indicat...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekujiy
hostnamegithub.com
expected-hostnamegithub.com
None4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a
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
release6d3909414814ff86ce7da4c51a0f4918a13fb41b
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/github/github-mcp-server/issues/2997#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fissues%2F2997
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%2F2997
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/2997
Reloadhttps://github.com/github/github-mcp-server/issues/2997
Reloadhttps://github.com/github/github-mcp-server/issues/2997
githubhttps://github.com/github
github-mcp-serverhttps://github.com/github/github-mcp-server
Codehttps://github.com/github/github-mcp-server
Issues239 (239)https://github.com/github/github-mcp-server/issues
Pull requests228 (228)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/2997
New issuehttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/2997
#3071https://github.com/github/github-mcp-server/pull/3071
Symlink corruption: get_file_contents follows symlinks but create_or_update_file does nothttps://github.com/github/github-mcp-server/issues/2997#top
#3071https://github.com/github/github-mcp-server/pull/3071
bughttps://github.com/github/github-mcp-server/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/kujiy
kujiyhttps://github.com/kujiy
on Aug 3, 2026https://github.com/github/github-mcp-server/issues/2997#issue-5045729909
kujiyhttps://github.com/kujiy
bughttps://github.com/github/github-mcp-server/issues?q=state%3Aopen%20label%3A%22bug%22
on Aug 3, 2026https://github.com/github/github-mcp-server/issues/2997#event-28864628172
github-actionshttps://github.com/apps/github-actions
request ai reviewhttps://github.com/github/github-mcp-server/issues?q=state%3Aopen%20label%3A%22request%20ai%20review%22
on Aug 3, 2026https://github.com/github/github-mcp-server/issues/2997#event-28864631222
SamMorrowDrumshttps://github.com/SamMorrowDrums
on Aug 18, 2026https://github.com/github/github-mcp-server/issues/2997#event-29648084204
fix(repos): guard writes to symbolic linkshttps://github.com/theinfosecguy/github-mcp-server/commit/c8f69774fd869011504c41071deb088f1c5081dc
c8f6977https://github.com/theinfosecguy/github-mcp-server/commit/c8f69774fd869011504c41071deb088f1c5081dc
fix(repos): guard writes to symbolic linkshttps://github.com/theinfosecguy/github-mcp-server/commit/afd1d52e7b9a5bd27a1ee2bc560dc0fb94166b12
afd1d52https://github.com/theinfosecguy/github-mcp-server/commit/afd1d52e7b9a5bd27a1ee2bc560dc0fb94166b12
fix(repos): guard writes to symbolic linkshttps://github.com/theinfosecguy/github-mcp-server/commit/57230e466f2fec0aa5f10253169f4b5f36a38a1e
57230e4https://github.com/theinfosecguy/github-mcp-server/commit/57230e466f2fec0aa5f10253169f4b5f36a38a1e
fix(repos): guard writes to symbolic linkshttps://github.com/theinfosecguy/github-mcp-server/commit/434d3c69e57d1d8b74544d9c2b0427317c7f827e
434d3c6https://github.com/theinfosecguy/github-mcp-server/commit/434d3c69e57d1d8b74544d9c2b0427317c7f827e
fix(repos): guard writes to symbolic linkshttps://github.com/github/github-mcp-server/commit/bb3a1b2a03c4c84655652e376c331959eb9a8464
bb3a1b2https://github.com/github/github-mcp-server/commit/bb3a1b2a03c4c84655652e376c331959eb9a8464
SamMorrowDrumshttps://github.com/SamMorrowDrums
completedhttps://github.com/github/github-mcp-server/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3071https://github.com/github/github-mcp-server/pull/3071
on Aug 19, 2026https://github.com/github/github-mcp-server/issues/2997#event-29677488275
Sign up for freehttps://github.com/signup?return_to=https://github.com/github/github-mcp-server/issues/2997
Sign in to commenthttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/2997
bughttps://github.com/github/github-mcp-server/issues?q=state%3Aopen%20label%3A%22bug%22
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.