Repository navigation
fix: reject integer parameters at or above 2^63 - #3650
Merged
Merged
Conversation
math.MaxInt64 is not representable as a float64 and rounds up to 2^63, so range checks against it let 2^63 through to an implementation-defined float-to-int conversion (MinInt on amd64, MaxInt on arm64). Add inSignedIntRange, which compares against the exact power-of-two bound before converting, and use it in toInt, toInt64 and the security and typed-read argument normalizers. Fixes #3489
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the integer-overflow validation changes.
No open issues 🎉
What changed in this PR
Fixes integer overflow validation in GitHub MCP Server parameter parsing, addressing #3489 and covering the fixes proposed in #3493 and #3565 without changing tool schemas.
Changes:
- Adds a shared signed-integer range check using an exact, exclusive upper bound.
- Applies the check before integer conversion in parameter parsers and both input normalizers.
- Adds boundary tests for rejected overflow values and accepted limits.
| File | Description |
|---|---|
pkg/github/typed_security_outputs_test.go |
Tests security argument overflow rejection and valid input. |
pkg/github/typed_search_outputs_test.go |
Tests out-of-range pagination string rejection. |
pkg/github/typed_read_normalizers.go |
Uses the shared range check for pagination string conversion. |
pkg/github/security_outputs.go |
Uses the shared range check for security integer arguments. |
pkg/github/params.go |
Adds the range helper and checks bounds before int and int64 conversion. |
pkg/github/params_test.go |
Adds helper, optional integer, and required big-integer boundary tests. |
Review effort: Balanced (auto)
omgitsads
approved these changes
Nov 3, 2026
RossTarrant
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integer parameter parsing now rejects values at or above 2^63. Before, they slipped past the range check and came out as
MinInt(amd64) orMaxInt(arm64).Why
math.MaxInt64can't be represented as a float64 and rounds up to 2^63, sof > math.MaxIntlets 2^63 through. That includes"9223372036854775807". Go doesn't define the result of converting an out-of-range float to an int.Fixes #3489
What changed
pkg/github/params.go: added aninSignedIntRangehelper that checks against the exact 2^(n-1) bound before converting.toIntandtoInt64now use it;toInt64's old round-trip check also missed this case on arm64.pkg/github/security_outputs.go,pkg/github/typed_read_normalizers.go: replaced the same broken check with the helper.OptionalIntParam,RequiredBigIntand both normalizers. The new rejection cases fail onmain.This covers both #3493 and #3565, and also fixes
toInt64.MCP impact
Schemas are unchanged. Values ≥ 2^63 now return the existing range errors instead of being sent to the API.
Prompts tested (tool changes only)
Security / limits
Input validation only.
Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint: passed, 0 issues (golangci-lint v2.14.0)./script/test: passedDocs