Repository navigation
Conversation
Both tools replace the current values and remove any not in the provided list, but they were annotated destructiveHint: false, so a host keying confirmation on destructiveHint may not prompt before labels/assignees are removed. Set destructiveHint to true for the two replace-semantics tools. Fixes github#3760
…signees The wire snapshots still carried destructiveHint: false; regenerate them to reflect the annotation change. Fixes github#3760
GITHUB_READ_ONLY and GITHUB_LOCKDOWN_MODE only turned their mode on for strconv.ParseBool spellings (1/true/TRUE/t). Common spellings such as yes, on, and enabled — and typos such as tru — were silently parsed as false, so the server started with write tools exposed. Parse these switches with a stricter helper that accepts the common spellings and returns an error for anything unrecognized, matching the --read-only flag. Fixes github#3747
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Stray carriage returns will break label and assignee snapshot comparisons, while whitespace-only read-only and lockdown settings fail open instead of being rejected.
2 open issues
What changed in this PR
This PR hardens the GitHub MCP Server’s safety-switch configuration parsing, addressing #3747 by rejecting unrecognized values instead of silently disabling protection. It also updates client-visible destructive-operation hints for two issue tools.
Changes:
- Add strict boolean parsing for stdio, HTTP, and read-only scope reporting.
- Test supported boolean spellings and invalid values.
- Mark issue-assignee and label replacements as destructive, with matching tests and snapshots.
| File | Description |
|---|---|
pkg/github/issues_granular.go |
Marks assignee and label replacement tools as destructive. |
pkg/github/granular_tools_test.go |
Tests destructive annotations for both tools. |
pkg/github/__toolsnaps__/update_issue_labels.snap |
Updates the labels tool’s annotation snapshot. |
pkg/github/__toolsnaps__/update_issue_assignees.snap |
Updates the assignees tool’s annotation snapshot. |
cmd/github-mcp-server/main.go |
Adds strict boolean parsing to stdio and HTTP configuration. |
cmd/github-mcp-server/main_test.go |
Adds table-driven boolean parser tests. |
cmd/github-mcp-server/list_scopes.go |
Validates read-only configuration before reporting scopes. |
Review effort: Max (adaptive)
| { | ||
| "mimeType": "image/png", | ||
| "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAC2UlEQVRIicWVMUyTaRjHf/+vVU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TaRjHf/+vVUpOJOdilOYoUvVreq2CDmLOwdlAS5xMbrrhBifjYG7QjYuJw108nZx1huLgYlw0QshxChUK2koxHHcuCmgsFfieG0or3kGPSoz/8X3f5/97nvfN8z7wmaVqm9FodFfR/EnMugy5giCAwYwgI9Ff9Hl9L9Lp1zUBgsGO+rqGwnlhF4CdwBSyAUwvS1G220zHBSFgHtmVxYWvfp2ZGSj8LyAcjgfZphTQZtAr7OdsZvSP9RIJR+LtQhcNusF+d1aUfPp05M8NAavmg8AOk3cmN56+s1Hpa7U/cviUYbcw3jgex9ZCKoBgsKM+0PDuAdBq2He5zOiTzZiXtc+NxRw598GeLRcWTuTz+UUAp3ygrqFwHmgzeWdqNQd4PpFOy/gedNQfaDz3UQXRaHRX0fNPGdzNZUZO12q+VuHIoV7g5Hu/1/IinX7tABTNnwR2SvRsxRzAzOsBGuuWfAkoX5FZFzCVHR95tFVAbiI9DEwj6wLwl5YVMTRYLTDsxjuRrgGYYz/kxkbvbXRWMOBB24cKYI9ks1X8hXQDaAaa5XG9WjImZgV71wI+m8qAv8y0t1pSmP0ITANTmHO2qqvRZDALlTdgHKyjWkx2YvQ2cHtTacMxYBhWK5DoF4TCkXj7Jg02VKsbOwI0Y+qvALZrOQXMC13cKkDSJWBuJUCqAhgbG3uF7IpBcn/k8KlPNQ+78U5QQuhy/vHjuQoAYPndwi9gw4bd2ufGYrWatxz8No50ExhaKsz9Vl6vAPL5/KKzoiTGG0fOg1oqCbvxTp/juw/M+zynu/yTwjoD58CBQ02ez/pAR4E+M69ntf3/o1Y3dqR050oAQz7P6Z6cfPRRw647MkOhUMAfaDyH+AloBKYNPRT292rQHoMOSp09J3TZlt5ezWazxX97VR3638RiX9ct+RImSyBcrDT0ETMyMp4ptRIgVX7QL6J/ALSUEwJ5rdg2AAAAAElFTkSuQmCC\r", |
Comment on lines
+401
to
+402
| switch strings.ToLower(strings.TrimSpace(raw)) { | ||
| case "", "0", "f", "false", "no", "n", "off", "disabled": |
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
Fail closed on unrecognized
read-only/lockdown-modeboolean values so a misspelled env var can't silently leave write tools exposed.Why
GITHUB_READ_ONLYandGITHUB_LOCKDOWN_MODEonly turned their mode on forstrconv.ParseBoolspellings (1/true/TRUE/t). Common spellings such asyes,on, andenabled— and typos such astru— were silently parsed asfalse, so the server started with every write tool exposed.Fixes #3747
What changed
parseBoolFlag, which accepts the common truthy/falsy spellings and returns an error for anything unrecognized (matching the--read-onlyflag's fail-closed behavior).read-onlyandlockdown-modein the stdio and HTTP commands and inlist_scopes.TestParseBoolFlag.MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming