package tar

import "github.com/coreos/rkt/pkg/tar"

Package tar contains helper functions for working with tar files

Index

Constants

const DEFAULT_DIR_MODE os.FileMode = 0755

Variables

var ErrNotSupportedPlatform = errors.New("platform and architecture is not supported")

Functions

func ExtractTar

func ExtractTar(rs io.Reader, dir string, overwrite bool, uidRange *user.UidRange, pwl PathWhitelistMap) error

ExtractTar extracts a tarball (from a io.Reader) into the given directory if pwl is not nil, only the paths in the map are extracted. If overwrite is true, existing files will be overwritten. The extraction is executed by fork/exec()ing a new process. The new process needs the CAP_SYS_CHROOT capability.

func ExtractTarInsecure

func ExtractTarInsecure(tr *tar.Reader, target string, overwrite bool, pwl PathWhitelistMap, editor FilePermissionsEditor) error

ExtractTarInsecure extracts a tarball (from a tar.Reader) into the target directory. If pwl is not nil, only the paths in the map are extracted. If overwrite is true, existing files will be overwritten.

func HdrToTimespec

func HdrToTimespec(hdr *tar.Header) []syscall.Timespec

Types

type FilePermissionsEditor

type FilePermissionsEditor func(path string, uid, gid int, typ byte, _ os.FileInfo, xattr map[string]string) error

func NewUidShiftingFilePermEditor

func NewUidShiftingFilePermEditor(uidRange *user.UidRange) (FilePermissionsEditor, error)

type PathWhitelistMap

type PathWhitelistMap map[string]struct{}

Map of paths that should be whitelisted. The paths should be relative to the root of the tar file and should be cleaned (for example using filepath.Clean)

Source Files

chroot.go tar.go

Version
v1.30.0 (latest)
Published
Apr 13, 2018
Platform
linux/amd64
Imports
17 packages
Last checked
6 days ago

Tools for package owners.