()
| 65 | * Returns a default environment object including only environment variables deemed safe to inherit. |
| 66 | */ |
| 67 | export function getDefaultEnvironment(): Record<string, string> { |
| 68 | const env: Record<string, string> = {}; |
| 69 | |
| 70 | for (const key of DEFAULT_INHERITED_ENV_VARS) { |
| 71 | const value = process.env[key]; |
| 72 | if (value === undefined) { |
| 73 | continue; |
| 74 | } |
| 75 | |
| 76 | if (value.startsWith('()')) { |
| 77 | // Skip functions, which are a security risk. |
| 78 | continue; |
| 79 | } |
| 80 | |
| 81 | env[key] = value; |
| 82 | } |
| 83 | |
| 84 | return env; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Client transport for stdio: this will connect to a server by spawning a process and communicating with it over stdin/stdout. |
no outgoing calls
no test coverage detected
searching dependent graphs…