restrict MCP_GATEWAY_PAYLOAD_DIR to 0700 to prevent bearer token enumeration#31706
restrict MCP_GATEWAY_PAYLOAD_DIR to 0700 to prevent bearer token enumeration#31706Copilot wants to merge 5 commits into
Conversation
Co-authored-by: szabta89 <[email protected]>
…ate lock files Co-authored-by: szabta89 <[email protected]>
|
@lpcox needs review on this |
|
@copilot merge main and recompile |
…gateway-permissions # Conflicts: # .github/workflows/daily-cache-strategy-analyzer.lock.yml Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Done — merged |
This comment has been minimized.
This comment has been minimized.
|
Hey
If you'd like a hand getting this across the finish line, assign this prompt to your coding agent:
|
|
@lpcox i beleive this is not an issue. the mcp gateway api key is a session id |
Bug Fix
What was the bug?
The MCP gateway container names its per-session subdirectory after the raw bearer token. Because
mcp_setup_generator.gocreated$MCP_GATEWAY_PAYLOAD_DIRwithmkdir -pand nochmod, the directory kept its default0755permissions — letting any process on the runner host enumerate the token with a plainls /tmp/gh-aw/mcp-payloads/, bypassing the0600hardening already applied tomcp-servers.jsonandgateway-output.json.How did you fix it?
pkg/workflow/mcp_setup_generator.go— addchmod 700 "${MCP_GATEWAY_PAYLOAD_DIR}"immediately aftermkdir -p, matching the existing pattern used for/tmp/gh-aw/mcp-config:yaml.WriteString(" mkdir -p \"${MCP_GATEWAY_PAYLOAD_DIR}\"\n") + yaml.WriteString(" chmod 700 \"${MCP_GATEWAY_PAYLOAD_DIR}\"\n")pkg/workflow/mcp_setup_generator_test.go— new integration testTestMCPGatewayPayloadDirHasRestrictedPermissionsasserts the generated YAML contains thechmod 700call adjacent to and after themkdir -p..github/workflows/*.lock.yml(221 files) — regenerated all compiled workflow lock files so every active workflow enforces the restricted permissions at runtime.