René's URL Explorer Experiment


Title: Scope-challenge middleware fails open when the token-scope fetch returns an error · Issue #3929 · github/github-mcp-server · GitHub

Open Graph Title: Scope-challenge middleware fails open when the token-scope fetch returns an error · Issue #3929 · github/github-mcp-server

X Title: Scope-challenge middleware fails open when the token-scope fetch returns an error · Issue #3929 · github/github-mcp-server

Description: Scope-challenge middleware fails open when the token-scope fetch returns an error Target repository: github/github-mcp-server Affected revision: e3809fe91c75 (the same branches are present on main as of 2026-11-01). Summary Two error bra...

Open Graph Description: Scope-challenge middleware fails open when the token-scope fetch returns an error Target repository: github/github-mcp-server Affected revision: e3809fe91c75 (the same branches are present on main ...

X Description: Scope-challenge middleware fails open when the token-scope fetch returns an error Target repository: github/github-mcp-server Affected revision: e3809fe91c75 (the same branches are present on main ...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Scope-challenge middleware fails open when the token-scope fetch returns an error","articleBody":"# Scope-challenge middleware fails open when the token-scope fetch returns an error\r\n\r\n> Target repository: `github/github-mcp-server`\r\n> Affected revision: `e3809fe91c75` (the same branches are present on `main` as of 2026-11-01).\r\n\r\n## Summary\r\n\r\nTwo error branches treat a failed token-scope lookup as \"allow\":\r\n\r\n1. **OAuth `tools/call` middleware** — `pkg/http/middleware/scope_challenge.go:87-91`:\r\n\r\n```go\r\nfetchedScopes, err := scopeFetcher.FetchTokenScopes(ctx, tokenInfo.Token)\r\nif err != nil {\r\n    next.ServeHTTP(w, r)\r\n    return\r\n}\r\n```\r\n\r\nWhen the scope endpoint is unavailable, the request is forwarded **without** the `403` + `WWW-Authenticate: ... insufficient_scope` challenge that the middleware exists to produce.\r\n\r\n2. **PAT inventory filtering** — `pkg/http/handler.go:488-491`:\r\n\r\n```go\r\nscopes, err := f.fetchScopes(ctx, token)\r\nif err != nil {\r\n    return b\r\n}\r\n```\r\n\r\nA failed scope fetch returns the unfiltered tool inventory instead of withholding tools whose scopes cannot be verified.\r\n\r\n## Reproduction\r\n\r\nThe real middleware chain can be driven with a fake scope fetcher:\r\n\r\n```go\r\nfetcher := &fakeFetcher{err: errors.New(\"scope endpoint unavailable (simulated HTTP 503)\")}\r\nh := WithMCPParse()(WithScopeChallenge(&oauth.Config{}, fetcher)(recordingNext))\r\n// tool scope map: delete_repository requires delete_repo + repo\r\n// request: tools/call delete_repository, OAuth token, no scopes in context\r\n```\r\n\r\nObserved:\r\n\r\n| Case | Result |\r\n|---|---|\r\n| fetch error | `next=true, status=200, WWW-Authenticate=\"\"`, no scopes installed in context |\r\n| fetched scopes `[repo]` (control) | `403`, `WWW-Authenticate: ... scope=\"delete_repo repo\"`, next not called |\r\n| scopes `[repo]` already in context + erroring fetcher | 403 (fetcher not called) |\r\n\r\nFor the PAT path, with a real `github.LabelWrite` tool and a failing fetch, the production `NewDefaultInventoryFactory` exposed **134 tools including `label_write`**, versus **46 tools** when scopes were `[gist]` — 88 scope-gated tools exposed.\r\n\r\n## Expected behavior\r\n\r\nIf the token's scopes cannot be verified, the request should fail closed:\r\n\r\n- the OAuth `tools/call` middleware should return the insufficient-scope challenge (or a 503/authorization error), not call the next handler;\r\n- the PAT inventory path should withhold scope-gated tools, or fail the listing, rather than returning the unfiltered inventory.\r\n\r\nA scope-endpoint outage is an authorization-verification failure, not evidence that the token is authorized.\r\n\r\n## Actual behavior\r\n\r\nBoth paths call the success path on error:\r\n\r\n- `scope_challenge.go:88-91` calls `next.ServeHTTP(w, r)`; the request reaches the tool handler with `status=200`, no `WWW-Authenticate`, and no scopes in context.\r\n- `handler.go:488-491` returns the builder unchanged; with a failing fetch the production inventory exposed 134 tools (including `label_write`) versus 46 tools when the token's scopes were `[gist]`.\r\n\r\n## Impact\r\n\r\n* **Protocol/UX fail-open**: the client is never told to re-authenticate and the call proceeds to GitHub. GitHub enforces the token's real scopes at the API, and the tool handlers use the caller's own token, so this does **not** widen privileges; an out-of-scope call still fails at the API.\r\n* **Inventory disclosure**: a failing scope fetch reveals the names/descriptions of tools the token should not see. Those descriptions are public in this open-source repository, so the confidentiality impact is low.\r\n* Severity: informational/low. The bug is that an availability failure silently disables a security control instead of failing closed or using a cached scope set.\r\n\r\n## Suggested fix\r\n\r\nFail closed on a scope-fetch error:\r\n\r\n```go\r\nif err != nil {\r\n    http.Error(w, \"scope verification unavailable\", http.StatusServiceUnavailable)\r\n    return\r\n}\r\n```\r\n\r\nor fall back to the last successfully fetched scopes for that token, never to the unrestricted path. For the inventory path, withhold scope-gated tools when scopes cannot be fetched.\r\n\r\n## Evidence\r\n\r\n- PoC tests: `zz_verify173_test.go`, `zz_verify174_test.go` (inside the target tree during the audit)\r\n- Upstream status checked on 2026-11-01: both error branches are still present.\r\n\r\nReproduced with the real `go test` runs (exit 0).\r\n","author":{"url":"https://github.com/soarkit","@type":"Person","name":"soarkit"},"datePublished":"2026-11-23T04:23:45Z","url":"https://github.com/github/github-mcp-server/issues/3929"}

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:21e77a51-973b-aba1-3b40-6ca14473aafd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDF16:2E4E6F:5CC0B7:7C0C2D:6B0626B3
html-safe-nonce6f6a55c835c5811eb77d6d79e607b4403c446cb7fde023e5ba54c0ea16aa44f4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjE2OjJFNEU2Rjo1Q0MwQjc6N0MwQzJEOjZCMDYyNkIzIiwidmlzaXRvcl9pZCI6IjI2OTc1MzY3Nzg0OTk2NjM1MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca7443bbe27682a2c47ce18fec45b8d83830d450a49b73d3a5388daab3f7a3c45
hovercard-subject-tagissue:6552230467
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/3929/issue_layout
twitter:imagehttps://opengraph.githubassets.com/59b6e31d93c5ba915f993a2a7b1a2961a4979ef7b508e7679a2af6fd9ec13826/github/github-mcp-server/issues/3929
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/59b6e31d93c5ba915f993a2a7b1a2961a4979ef7b508e7679a2af6fd9ec13826/github/github-mcp-server/issues/3929
og:image:altScope-challenge middleware fails open when the token-scope fetch returns an error Target repository: github/github-mcp-server Affected revision: e3809fe91c75 (the same branches are present on main ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesoarkit
hostnamegithub.com
expected-hostnamegithub.com
None9e10bb0ecc0bd0f8692aa89586ee9b54e498d7ab9f244a44cdb5b93653a125ce
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
release32e57d5cc2ce6ce92ec6dceb65858344750c27c2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/github/github-mcp-server/issues/3929#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fissues%2F3929
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%2F3929
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/3929
Reloadhttps://github.com/github/github-mcp-server/issues/3929
Reloadhttps://github.com/github/github-mcp-server/issues/3929
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/3929
New issuehttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3929
#3932https://github.com/github/github-mcp-server/pull/3932
Scope-challenge middleware fails open when the token-scope fetch returns an errorhttps://github.com/github/github-mcp-server/issues/3929#top
#3932https://github.com/github/github-mcp-server/pull/3932
https://github.com/soarkit
soarkithttps://github.com/soarkit
on Nov 23, 2026https://github.com/github/github-mcp-server/issues/3929#issue-6552230467
Shanmukh-l33thttps://github.com/Shanmukh-l33t
on Nov 23, 2026https://github.com/github/github-mcp-server/issues/3929#event-37032340811
Distinguish invalid tokens and known empty scopes from outageshttps://github.com/Shanmukh-l33t/github-mcp-server/commit/e4aebb077dce1728177d17bc0a32c9d016037d4b
https://docs.github.com/articles/closing-issues-via-commit-messages
e4aebb0https://github.com/Shanmukh-l33t/github-mcp-server/commit/e4aebb077dce1728177d17bc0a32c9d016037d4b
Sign up for freehttps://github.com/signup?return_to=https://github.com/github/github-mcp-server/issues/3929
Sign in to commenthttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3929
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.