path

package
v2.9.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolvedFileOrDirectoryPath added in v2.3.12

type ResolvedFileOrDirectoryPath string

ResolvedFileOrDirectoryPath represents a resolved file or directory path and is intended to prevent unintentional use of an unverified file or directory path. It is an absolute path.

func ResolveFileOrDirectoryPath added in v2.3.12

func ResolveFileOrDirectoryPath(appPath, repoRoot, dir string) (ResolvedFileOrDirectoryPath, error)

type ResolvedFilePath

type ResolvedFilePath string

ResolvedFilePath represents a resolved file path and is intended to prevent unintentional use of an unverified file path. It is always either a URL or an absolute path.

func ResolveValueFilePathOrUrl added in v2.3.12

func ResolveValueFilePathOrUrl(appPath, repoRoot, valueFile string, allowedURLSchemes []string) (resolvedPath ResolvedFilePath, isRemote bool, err error)

ResolveValueFilePathOrUrl will inspect and resolve given file, and make sure that its final path is within the boundaries of the path specified in repoRoot.

appPath is the path we're operating in, e.g. where a Helm chart was unpacked to. repoRoot is the path to the root of the repository.

If either appPath or repoRoot is relative, it will be treated as relative to the current working directory.

valueFile is the path to a value file, relative to appPath. If valueFile is specified as an absolute path (i.e. leading slash), it will be treated as relative to the repoRoot. In case valueFile is a symlink in the extracted chart, it will be resolved recursively and the decision of whether it is in the boundary of repoRoot will be made using the final resolved path. valueFile can also be a remote URL with a protocol scheme as prefix, in which case the scheme must be included in the list of allowed schemes specified by allowedURLSchemes.

Will return an error if either valueFile is outside the boundaries of the repoRoot, valueFile is an URL with a forbidden protocol scheme or if valueFile is a recursive symlink nested too deep. May return errors for other reasons as well.

resolvedPath will hold the absolute, resolved path for valueFile on success or set to the empty string on failure.

isRemote will be set to true if valueFile is an URL using an allowed protocol scheme, or to false if it resolved to a local file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL