MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / StripSafeEnvVars

Function StripSafeEnvVars

tools/bash/tokenizer.go:211–229  ·  view source on GitHub ↗
(command string)

Source from the content-addressed store, hash-verified

209}
210
211func 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
231func StripAllSafeEnvPrefixes(command string) string {
232 var prev string

Callers 1

StripAllSafeEnvPrefixesFunction · 0.85

Calls 2

splitFirstShellTokenFunction · 0.85
leadingEnvNameFunction · 0.85

Tested by

no test coverage detected