Repository navigation
Prevent shared compiler-option aliasing in walkSchemaCompileOpts - #16802
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the change includes targeted regression coverage for option-slice isolation while preserving the existing environment restrictions.
No open issues 🎉
What changed in this PR
This PR prevents walkSchemaCompileOpts from mutating shared compiler options when the slice has spare capacity, while preserving $ENV/env restrictions and the pinned gojq v0.12.20 dependency.
Changes:
- Allocates an isolated compiler-option slice before registering
walk_schema. - Adds regression coverage for spare-capacity aliasing and environment isolation.
- Retains gojq
v0.12.20without a dependency upgrade.
| File | Description |
|---|---|
| internal/middleware/jqschema.go | Copies the shared compiler options before appending the native walk_schema function. |
| internal/middleware/jqschema_bench_test.go | Adds regression coverage for backing-slice isolation and verifies $ENV and env remain disabled. |
Review effort: Lite (adaptive)
This comment has been minimized.
This comment has been minimized.
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked through mcpg. Part A/C reads confirmed fully functional. Part B could not independently confirm gateway-level write-blocking: all 6 targeted write tools (star_repository, add_issue_comment, issue_write, create_branch, create_or_update_file, create_pull_request) were absent from the exposed tool catalog — this reflects gh-aw's GITHUB_READ_ONLY=1 backend config, not mcpg's own DIFC/guard layer (per the task's architectural note). Parts D/E could not run: gh auth status showed no authenticated host, so REST/GraphQL write attempts never reached GitHub to test the token-scope boundary. No destructive or write operations were attempted beyond these benign probes; nothing was created, starred, or commented.
|
walkSchemaCompileOptsappends to shared compiler options, risking mutation if the slice gains spare capacity. The gojq review requires no dependency upgrade.walk_schema, matching the variable-option helper.$ENVandenv.v0.12.20.