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)
| 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 |
| 638 | func (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 | |
| 655 | func (e *CodexEngine) renderShellEnvironmentPolicyToml(yaml *strings.Builder, tools map[string]any, mcpTools []string, indent string) { |
| 656 | sortedEnvVars := e.getShellEnvironmentPolicyVars(tools, mcpTools) |
no test coverage detected