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

Function ValidateChild

internal/safepaths/root.go:278–281  ·  view source on GitHub ↗

ValidateChild reports whether the cleaned name is a lexically contained path, using the host operating system's path rules. Joining it to a root stays lexically within that root. Nested paths and names that clean to "." are allowed. This check does not consult the filesystem or the current working

(name string)

Source from the content-addressed store, hash-verified

276// This check does not consult the filesystem or the current working directory,
277// and does not account for symbolic links.
278func ValidateChild(name string) error {
279 _, err := validateChildPath(name)
280 return err
281}
282
283func validateChildPath(name string) (string, error) {
284 local := filepath.Clean(name)

Callers 3

validateNameMethod · 0.92
extractTarGzFunction · 0.92
runDownloadFunction · 0.92

Calls 1

validateChildPathFunction · 0.85

Tested by

no test coverage detected