secureloader

package
v0.25.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(root, name string) (*chart.Chart, error)

Load takes a string root and name, tries to resolve it to a file or directory, and then loads it securely without traversing outside of root.

This is the preferred way to load a chart. It will discover the chart encoding and hand off to the appropriate chart reader.

If a .helmignore file is present, the directory loader will skip loading any files matching it. But .helmignore is not evaluated when reading out of an archive.

func LoadArchive

func LoadArchive(in io.Reader) (*chart.Chart, error)

LoadArchive loads from a reader containing a compressed tar archive.

func LoadArchiveFiles

func LoadArchiveFiles(in io.Reader) ([]*loader.BufferedFile, error)

LoadArchiveFiles reads in files out of an archive into memory. This function performs important path security checks and should always be used before expanding a tarball

func LoadFile

func LoadFile(name string) (*chart.Chart, error)

LoadFile loads from an archive file.

func Loader

func Loader(root, name string) (loader.ChartLoader, error)

Loader returns a new loader.ChartLoader appropriate for the given chart name. That being, SecureDirLoader when name is a directory, and FileLoader when it's a file. Name can be an absolute or relative path, but always has to be inside root.

func SecureLoadDir

func SecureLoadDir(root, path string, maxSize int64) (*chart.Chart, error)

SecureLoadDir securely loads a chart from the path relative to root, without traversing outside root. When maxSize >= 0, files are not allowed to exceed this size, or an error is returned.

Types

type FileLoader

type FileLoader = loader.FileLoader

FileLoader is equal to Helm's. Redeclared to avoid having to deal with multiple package imports, possibly resulting in using the non-secure directory loader.

type SecureDirLoader

type SecureDirLoader struct {
	// contains filtered or unexported fields
}

SecureDirLoader securely loads a chart from a directory while resolving symlinks without including files outside root.

func NewSecureDirLoader

func NewSecureDirLoader(root string, path string, maxSize int64) SecureDirLoader

NewSecureDirLoader returns a new SecureDirLoader, configured to the scope of the root and provided dir. Max size configures the maximum size a file must not exceed to be loaded. If 0 it defaults to helm.MaxChartFileSize, it can be disabled using a negative integer.

func (SecureDirLoader) Load

func (l SecureDirLoader) Load() (*chart.Chart, error)

Load loads and returns the chart.Chart, or an error.

Directories

Path Synopsis
Package ignore provides tools for writing ignore files (a la .gitignore).
Package ignore provides tools for writing ignore files (a la .gitignore).

Jump to

Keyboard shortcuts

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