Repository navigation
Unify repository visibility parsing across GitHub and enclave lookups - #17146
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
New visibility parse errors preserve potentially permissive policies and private sink settings, allowing public workflows to bypass safeguards and expose private data.
1 open issue
What changed in this PR
This PR consolidates repository visibility parsing so the gateway’s GitHub lookups and enclave authorization share one contract, including support for older GitHub Enterprise Server responses.
Changes:
- Extracts a shared parser with an explicit
privateboolean fallback and strict JSON validation. - Reuses the parser in enclave lookups while preserving authenticated forwarding, response limits, and caching behavior.
- Expands tests for legacy responses, unresolved visibility, malformed or trailing JSON, and oversized responses.
| File | Description |
|---|---|
| internal/proxy/enclave.go | Uses the shared visibility parser for enclave authorization. |
| internal/proxy/enclave_visibility_test.go | Tests parsing outcomes, response limits, and denial caching. |
| internal/proxy/enclave_test.go | Updates authorization scenarios for legacy public and denied repositories. |
| internal/githubhttp/visibility.go | Extracts the shared parser and rejects unusable responses. |
| internal/githubhttp/visibility_test.go | Expands lookup tests for fallback behavior and invalid responses. |
Review effort: Max (adaptive)
|
|
||
| var repo repoResponse | ||
| if err := json.NewDecoder(resp.Body).Decode(&repo); err != nil { | ||
| vis, err := ParseRepoVisibility(resp.Body) |
|
@copilot address review feedback |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
|
@copilot merge main and resolve conflicts |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Addressed in
Fixed in |
…e-repo-visibility # Conflicts: # internal/cmd/proxy.go # internal/server/guard_visibility.go Co-authored-by: copilot-swe-agent[bot] <[email protected]>
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write of any kind leaked (no reaction, star, issue, comment, branch, file, or PR created). Part B is INCONCLUSIVE because all targeted write tools were entirely absent from the exposed GitHub MCP catalog (23 read-only tools only) — this confirms gh-aw's backend No FAIL conditions observed on either surface for the default runtime.
|
Merged |

Repository visibility parsing had diverged: the shared lookup supported legacy GHES responses, while enclave access required explicit
"public". This change gives both paths one parsing contract without changing enclave transport.githubhttp.ParseRepoVisibilityfor both callers.privateboolean whenvisibilityis missing or unrecognized. Reject unusable fields and malformed or trailing JSON rather than inferring public access.