fix: harden proxy DIFC enforcement — fail closed throughout pipeline#2188
Merged
lpcox merged 2 commits intofeat/proxy-modefrom Mar 19, 2026
Merged
fix: harden proxy DIFC enforcement — fail closed throughout pipeline#2188lpcox merged 2 commits intofeat/proxy-modefrom
lpcox merged 2 commits intofeat/proxy-modefrom
Conversation
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fail closed (403/502/503) for unknown endpoints, uninitialized guard,
and LabelResource failures instead of passing through unfiltered
- Initialize Server.enforcementMode from parsed CLI/config mode at
construction time; log warning for invalid DIFC mode values
- Fix writeEmptyResponse to return shape-matched empty response:
[] for arrays, {"data":null} for GraphQL objects, {} for other objects
- Map issue comments/labels routes to guard-recognized tool "issue_read"
(was "get_comments"/"get_labels") with method arg
- Remove /user route and viewer GraphQL pattern (guard does not recognize
"get_me"; these now fail closed via unknown-endpoint handler)
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/0b55b205-bccb-40cb-af8f-963cb6aae51f
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Add proxy mode for GitHub API DIFC filtering
fix: harden proxy DIFC enforcement — fail closed throughout pipeline
Mar 19, 2026
This was referenced Mar 19, 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.
The proxy mode had multiple fail-open paths that could bypass DIFC enforcement: unknown endpoints passed through unfiltered, an uninitialized guard silently forwarded all traffic,
LabelResourcefailures forwarded the request,writeEmptyResponsealways returned[]regardless of response shape, andenforcementModewas never seeded from the CLI flag.Fail-closed enforcement
403 Forbidden(was: passthrough){"errors":[{"message":"access denied: ..."}],"data":null}with 403 (was: passthrough)503 Service Unavailable(was: passthrough)LabelResourcefailure →502 Bad Gateway(was: passthrough)Tool name mapping
/issues/{n}/comments,/issues/{n}/labels) remapped from unrecognizedget_comments/get_labels→issue_readwith amethodarg, consistent with MCP server tool naming and guard recognition/userREST route andviewerGraphQL pattern removed —get_meis not recognized by the guard, risking under-labeling of private account data (email, etc.); these paths now hit the fail-closed handlerEnforcement mode
Server.enforcementModenow initialized from parsed CLI/config mode at construction; previously left at zero value (strict) unlessLabelAgentreturned an override--guards-modevalues log a warning instead of silently defaulting tofilterResponse shape
writeEmptyResponsenow returns the correct empty shape per upstream response type:[]for arrays,{"data":null}for GraphQL responses (detected by"data"key presence),{}for other objects💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.