MCPcopy Create free account
hub / github.com/cli/cli / validateChildPath

Function validateChildPath

internal/safepaths/root.go:283–289  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

281}
282
283func validateChildPath(name string) (string, error) {
284 local := filepath.Clean(name)
285 if !filepath.IsLocal(local) {
286 return "", PathTraversalError{Elems: []string{name}}
287 }
288 return local, nil
289}
290
291func (r *Root) openDirectories(name string, perm os.FileMode) (*os.Root, error) {
292 var current string

Callers 2

localPathMethod · 0.85
ValidateChildFunction · 0.85

Calls 2

IsLocalMethod · 0.65
CleanMethod · 0.45

Tested by

no test coverage detected