(command string)
| 209 | } |
| 210 | |
| 211 | func StripSafeEnvVars(command string) string { |
| 212 | cleaned := strings.TrimLeftFunc(command, unicode.IsSpace) |
| 213 | if cleaned == "" { |
| 214 | return "" |
| 215 | } |
| 216 | |
| 217 | token, rest := splitFirstShellToken(cleaned) |
| 218 | if token == "" && rest == "" { |
| 219 | return "" |
| 220 | } |
| 221 | envName := leadingEnvName(token) |
| 222 | if envName == "" || !safeEnvVars.Contains(envName) { |
| 223 | return cleaned |
| 224 | } |
| 225 | if strings.TrimSpace(rest) == "" { |
| 226 | return cleaned |
| 227 | } |
| 228 | return strings.TrimLeftFunc(rest, unicode.IsSpace) |
| 229 | } |
| 230 | |
| 231 | func StripAllSafeEnvPrefixes(command string) string { |
| 232 | var prev string |
no test coverage detected