MCPcopy Create free account
hub / github.com/github/gh-aw / renderShellEnvironmentPolicy

Method renderShellEnvironmentPolicy

pkg/workflow/codex_engine.go:638–653  ·  view source on GitHub ↗

renderShellEnvironmentPolicy generates the [shell_environment_policy] section for config.toml This controls which environment variables are passed through to MCP servers for security

(yaml *strings.Builder, tools map[string]any, mcpTools []string)

Source from the content-addressed store, hash-verified

636// renderShellEnvironmentPolicy generates the [shell_environment_policy] section for config.toml
637// This controls which environment variables are passed through to MCP servers for security
638func (e *CodexEngine) renderShellEnvironmentPolicy(yaml *strings.Builder, tools map[string]any, mcpTools []string) {
639 sortedEnvVars := e.getShellEnvironmentPolicyVars(tools, mcpTools)
640
641 // Render [shell_environment_policy] section
642 yaml.WriteString(" \n")
643 yaml.WriteString(" [shell_environment_policy]\n")
644 yaml.WriteString(" inherit = \"core\"\n")
645 yaml.WriteString(" include_only = [")
646 for i, envVar := range sortedEnvVars {
647 if i > 0 {
648 yaml.WriteString(", ")
649 }
650 yaml.WriteString("\"" + envVar + "\"")
651 }
652 yaml.WriteString("]\n")
653}
654
655func (e *CodexEngine) renderShellEnvironmentPolicyToml(yaml *strings.Builder, tools map[string]any, mcpTools []string, indent string) {
656 sortedEnvVars := e.getShellEnvironmentPolicyVars(tools, mcpTools)

Callers 1

RenderMCPConfigMethod · 0.95

Calls 1

Tested by

no test coverage detected