Repository navigation
Restrict MCP log cache permissions - #78187
pelikhan with github-agentic-autofix[bot] wants to merge 3 commits into
Conversation
Co-authored-by: pelikhan <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The new exact-mode assertions fail on Windows because os.Stat reports 0777/0666 rather than the expected 0700/0600, breaking unit-test portability.
1 open issue
What changed in this PR
This PR restricts access to gh-aw’s MCP log cache to protect private workflow and agent data.
Changes:
- Set cache directories to
0700and report files to0600, including reused reports. - Update permission tests to assert exact owner-only modes.
| File | Description |
|---|---|
pkg/cli/mcp_logs_guardrail.go |
Apply owner-only permissions when creating or reusing cached reports. |
pkg/cli/mcp_logs_guardrail_test.go |
Rename the permission test and assert 0700 directory and 0600 file modes. |
Review effort: Max (dynamic)
| cachePerm := cacheInfo.Mode().Perm() | ||
| if cachePerm&0o005 != 0o005 { | ||
| t.Errorf("Cache directory should be accessible to other users (expected other r-x bits set), got mode %o", cachePerm) | ||
| if cachePerm != 0o700 { |
|
@copilot the agent must be able to read the files in the logs folder. They should be stored in the temp folder accessible to the agent so that they also get deleted afterwards. |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Restored agent-readable permissions for reports in the existing |
| t.Errorf("Cache file should be world-readable (expected other read bit set), got mode %o", filePerm) | ||
| if runtime.GOOS != "windows" { | ||
| cachePerm := cacheInfo.Mode().Perm() | ||
| if cachePerm&0o005 != 0o005 { |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "4c8887ef2d75be9486274f0a87f0cf6b041dda7a",
"kind": "requested",
"schema_version": "1",
"state": "49627475e82d4120ac672f81cf52fa1b75dd859d968273cfabff776f7337de15",
"work": [
"a46dcc3c45e5bd0704547891e7cf19fc8c185fbcf7643862f773eb19f8707273"
],
"workflow": "pr-sous-chef"
}
|

MCP log reports contain private workflow and agent data but were stored with world-readable permissions. This change restricts the cache and its reports to the current user; existing shell safeguards cover the reported post-agent symlink risks.
0700and report files to0600, including when reusing cached reports.