Title: Advertised page/perPage bounds are not enforced in list_commits, get_commit, actions_list and list_gists, and -2^63 returns a raw Go decode error · Issue #3762 · github/github-mcp-server · GitHub
Open Graph Title: Advertised page/perPage bounds are not enforced in list_commits, get_commit, actions_list and list_gists, and -2^63 returns a raw Go decode error · Issue #3762 · github/github-mcp-server
X Title: Advertised page/perPage bounds are not enforced in list_commits, get_commit, actions_list and list_gists, and -2^63 returns a raw Go decode error · Issue #3762 · github/github-mcp-server
Description: Describe the bug These tools advertise page with minimum: 1 (and perPage 1..100) in tools/list. At runtime they validate against a relaxed clone of the schema with the bounds removed, and they forward the value unchanged: page: -1 is sen...
Open Graph Description: Describe the bug These tools advertise page with minimum: 1 (and perPage 1..100) in tools/list. At runtime they validate against a relaxed clone of the schema with the bounds removed, and they forw...
X Description: Describe the bug These tools advertise page with minimum: 1 (and perPage 1..100) in tools/list. At runtime they validate against a relaxed clone of the schema with the bounds removed, and they forw...
Opengraph URL: https://github.com/github/github-mcp-server/issues/3762
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Advertised page/perPage bounds are not enforced in list_commits, get_commit, actions_list and list_gists, and -2^63 returns a raw Go decode error","articleBody":"### Describe the bug\n\nThese tools advertise `page` with `minimum: 1` (and `perPage` 1..100) in `tools/list`. At runtime they validate against a relaxed clone of the schema with the bounds removed, and they forward the value unchanged:\n\n- `page: -1` is sent as `?page=-1`.\n- `page: 9007199254740992` (2^53) is sent as is. For `list_commits`, GitHub answers HTTP 500 and the tool returns `failed to list commits: : GET …/commits?page=9007199254740992&per_page=1: 500 []`, with an empty message.\n- `page: 2147483647` is accepted by GitHub and returns `[]`.\n\nThe relaxation is intentional, per the comment at `pkg/github/git_gist_types.go:236-242` (\"the SDK continues accepting legacy out-of-range values (e.g. page=-1, perPage=101) that the handler has always forwarded unmodified\"). The result is that the advertised contract and the behaviour disagree, and very large values produce an opaque upstream 500.\n\nSeparately, `-9223372036854775808` (-2^63) passes the integer range check, which is inclusive at the lower end (`pkg/github/params.go:63-66`; `typed_read_normalizers.go:45` uses the same `inSignedIntRange`), and then, by code reading, fails in the typed decode with a raw `encoding/json` error that exposes internal type names and a fragment of the arguments:\n`json: cannot unmarshal number -9223372036854776000,\"perPage\":1... overflows into Go struct field github.ListCommitsInput.page of type int` (also `github.IssueReadInput.issue_number` via `issue_read`).\n\nRelated: #3647 / PR #3649 (list_label turns `perPage: 0` into 100 despite `minimum: 1`), the same class in a different tool. #3489 / PR #3650 fixed the upper bound (2^63) only.\n\nCode (main 99d6d650, unchanged since v2.1.0): `relaxedPaginationValidationSchema` at `pkg/github/git_gist_types.go:243-253`, used at `repositories.go:75` (get_commit), `repositories.go:248` (list_commits), `gists.go:49` (list_gists). `actionsValidationSchema` at `actions_types.go:114` (actions_list). Range check at `params.go:63-66`.\n\n`perPage` out-of-range values were not tested; the relaxation also clears the `perPage` min/max per the code.\n\n### Affected version\n\nv2.1.0 (image `sha256:f6056fc1…0f8a`, commit 4bcdcdf8) and main nightly (image `sha256:48bc16d0…338f`, revision 99d6d650). `--read-only --toolsets=all`, read-only fine-grained PAT.\n\n### Steps to reproduce the behavior\n\nThe forwarded value is visible in the request URL of the error result:\n```json\n{\"name\":\"list_commits\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"sha\":\"no-such-ref\",\"page\":-1,\"perPage\":1}}\n```\nResult: `GET …/commits?page=-1&per_page=1&sha=no-such-ref: 404`.\n```json\n{\"name\":\"list_gists\",\"arguments\":{\"username\":\"no-such-user-zz9\",\"page\":-1,\"perPage\":1}}\n```\nResult: `GET …/users/no-such-user-zz9/gists?page=-1&per_page=1: 404`.\n```json\n{\"name\":\"actions_list\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"method\":\"list_workflows\",\"page\":9007199254740992,\"perPage\":1}}\n```\nResult: `GET …/actions/workflows?page=9007199254740992&per_page=1` (403 here because the PAT has no Actions scope, but the page value is visible).\n```json\n{\"name\":\"list_commits\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"page\":9007199254740992,\"perPage\":1}}\n```\nResult: `failed to list commits: : GET …/commits?page=9007199254740992&per_page=1: 500 []`.\n```json\n{\"name\":\"list_commits\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"page\":-9223372036854775808,\"perPage\":1}}\n```\nResult: the raw decode error quoted above.\n\n`get_commit` with `page: -1` and `page: 2^53` returns success with no validation error. Its error messages don't show the URL; by code it forwards `page` to `ListOptions` the same way.\n\n### Expected vs actual behavior\n\nExpected: values outside the advertised range are clamped or rejected with a message that names the parameter. An out-of-range integer gets the same \"value out of range\" message as at the upper end.\n\nActual: the values are forwarded unmodified (opaque 500 at 2^53), and -2^63 leaks a Go decode error.\n\nSuggested fix: if accepting legacy values must stay, normalise in the handler: `page \u003c 1` → 1, and reject `page` above a sane cap (for example, 2^31-1) with a clear error. Alternatively, stop advertising bounds that aren't enforced. Make the lower bound in `inSignedIntRange` exclusive (`f > -limit`), matching the upper bound, so -2^63 gets the existing range error.\n\n### Logs\n\n```\nlist_commits page=-1 (bad ref) -> …/commits?page=-1&per_page=1&sha=no-such-ref: 404 Not Found []\nlist_gists page=-1 (bad user) -> …/users/no-such-user-zz9/gists?page=-1&per_page=1: 404 Not Found []\nactions_list page=2^53 -> …/actions/workflows?page=9007199254740992&per_page=1: 403 …\nlist_commits page=2^53 -> failed to list commits: : GET …/commits?page=9007199254740992&per_page=1: 500 []\nlist_commits page=2147483647 -> OK []\nlist_commits page=-2^63 -> json: cannot unmarshal number -9223372036854776000,\"perPage\":1... overflows into Go struct field github.ListCommitsInput.page of type int\ntools/list list_commits page: {\"type\":\"number\",\"minimum\":1}\n```\nSame on v2.1.0 and main.\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:12:08Z","url":"https://github.com/github/github-mcp-server/issues/3762"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b3fb686c-392f-37fd-a916-2bf2a3bc645b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBE4:107A1:70AD35:92C2D4:6B06283B |
| html-safe-nonce | bbb873d6d7731ea473c92ba408f57e80b647940a1860dc3d6a8d2c8ce3dce8f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkU0OjEwN0ExOjcwQUQzNTo5MkMyRDQ6NkIwNjI4M0IiLCJ2aXNpdG9yX2lkIjoiODAwNzA5OTM1NDExMDYzNDA0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5a55cf5875917ef11171d2617c6513fd159b460accc50317f321dcbe2d43d1d7 |
| hovercard-subject-tag | issue:6280976155 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3762/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5cdc06486376af69c07b44a6816977cd996b130ad074187441e67f1170096e6b/github/github-mcp-server/issues/3762 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5cdc06486376af69c07b44a6816977cd996b130ad074187441e67f1170096e6b/github/github-mcp-server/issues/3762 |
| og:image:alt | Describe the bug These tools advertise page with minimum: 1 (and perPage 1..100) in tools/list. At runtime they validate against a relaxed clone of the schema with the bounds removed, and they forw... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rafe-walker |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e10bb0ecc0bd0f8692aa89586ee9b54e498d7ab9f244a44cdb5b93653a125ce |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32e57d5cc2ce6ce92ec6dceb65858344750c27c2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width