Skip to content

Prevent shared compiler-option aliasing in walkSchemaCompileOpts - #16802

Merged
lpcox merged 2 commits into
mainfrom
copilot/go-fan-go-module-review
Nov 18, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/go-fan-go-module-review

Conversation

@lpcox

@lpcox lpcox commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

walkSchemaCompileOpts appends to shared compiler options, risking mutation if the slice gains spare capacity. The gojq review requires no dependency upgrade.

  • Option isolation: Allocate a fresh slice before registering walk_schema, matching the variable-option helper.
  • Regression coverage: Exercise spare-capacity aliasing and confirm schema compilation still disables $ENV and env.
  • Dependency: Retain gojq v0.12.20.

@lpcox lpcox changed the title [WIP] Review go module github.com/itchyny/gojq Prevent shared compiler-option aliasing in walkSchemaCompileOpts Nov 18, 2026
@lpcox
lpcox marked this pull request as ready for review November 18, 2026 18:54
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 18:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.20 without 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)

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) all 6 write tools ABSENT from the 23-tool catalog (backend runs with GITHUB_READ_ONLY=1 per gh-aw) BLOCKED ⚠️
C CLI reads (same probes via proxied github CLI) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh not authenticated — no token present, calls fail before reaching GitHub BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh not authenticated BLOCKED ⚠️

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.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go-fan] Go Module Review: github.com/itchyny/gojq

3 participants