[log] Add debug logging to mount policy validation paths - #12070
Conversation
Log mount validation outcomes (allowed/rejected) in ValidateMount and container option rejections in ValidateContainerArgs to aid debugging of mount policy enforcement failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The logging is correctly scoped, uses the existing logger, and does not alter validation behavior.
Pull request overview
Adds targeted debug logging for mount-policy validation decisions.
Changes:
- Logs mount allow/reject decisions and matched roots.
- Logs rejected container options that could bypass mount policy.
File summaries
| File | Description |
|---|---|
internal/launcher/mount_policy.go |
Adds debug logs to mount and container-argument validation paths. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes succeeded or leaked. No artifact was created. References: §33220361567
|
🔒 mcpg Read-Only Stress — gVisor (
|
| Part | Surface | Op | Result | Expected | Status |
|---|---|---|---|---|---|
| A | MCP | reads (list_issues, list_pulls, get_file, list_commits) | data returned | ALLOWED | ✅ |
| B | MCP | writes (reaction/star/issue/comment/branch/file/PR) | tool not found (absent from catalog) | BLOCKED | |
| C | CLI | reads (list_issues, get_file_contents) | data returned | ALLOWED | ✅ |
| D | CLI | REST writes (reaction/star/issue/comment/file) | gh unauthenticated |
BLOCKED | |
| E | CLI | GraphQL mutations (addReaction/addStar/createIssue) | gh unauthenticated |
BLOCKED |
Overall: INCONCLUSIVE
- Part B: All 7 write tools absent from MCP catalog (backend runs with
GITHUB_READ_ONLY=1). This confirms gh-aw's defense-in-depth guarantee. Gateway-level DIFC/guard enforcement could not be independently confirmed via this surface (structural limitation of this test harness — write tools never registered). No writes leaked. - Parts D & E:
ghCLI is not authenticated in this environment (GH_TOKENnot set). Token-scope boundary cannot be validated in this run. No writes attempted. - No write succeeded; the overall result is INCONCLUSIVE (not FAIL) because the gaps are methodology limitations, not enforcement failures.
References: §33220361569
🔒 mcpg read-only stress (gVisor runtime) by Read-Only Stress: gVisor runtime
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. No FAIL condition.
|
Summary
Adds targeted debug logging to
internal/launcher/mount_policy.goin the security-critical mount validation code paths (ValidateMountandValidateContainerArgs). Previously these functions had no logging on their reject/allow decisions, making it hard to troubleshoot why a container-backed MCP server's mount request was denied.Changes
logMountPolicylogger (logger.ForFile(), namespacelauncher:mount_policy) — no new logger declared.ValidateMount:ValidateContainerArgs:--privileged,--mount) is rejected.No log arguments compute anything or cause side effects; all values are already-computed local variables.
Validation
go build ./...— succeedsgo vet ./internal/launcher/...— cleango test ./internal/launcher/...— passes (ok)(Note: local Go toolchain was 1.24.13 vs
go.mod's required 1.26.4; usedGOTOOLCHAIN=autoto let Go auto-fetch the required toolchain for validation.)