Documentation
¶
Overview ¶
Package core implements sandbox-mediated archive inspection and extraction.
Index ¶
- Variables
- func Read(ctx context.Context, source string, name string, config ReadConfig) (_ []byte, found bool, outErr error)
- func WithConfig(ctx context.Context, config Config) context.Context
- type Config
- type Entry
- type EntryPathError
- type ExtractConfig
- type ExtractResult
- type Format
- type LimitError
- type ListConfig
- type ReadConfig
Constants ¶
This section is empty.
Variables ¶
var ErrConfigNotFound = errors.New("archive: config not found in context")
ErrConfigNotFound indicates that archive configuration is unavailable in the execution context.
Functions ¶
Types ¶
type Config ¶
Config controls archive resource limits.
func ConfigFrom ¶
ConfigFrom returns archive configuration from the execution context.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the archive module's default resource limits.
func DefaultConfigOr ¶
type Entry ¶
type Entry struct {
CompressedSize *int64 `json:"compressedSize"`
ModTime *string `json:"modTime"`
LinkName *string `json:"linkName"`
Name string `json:"name"`
Mode string `json:"mode"`
Format Format `json:"format"`
Size int64 `json:"size"`
IsDir bool `json:"isDir"`
IsRegular bool `json:"isRegular"`
IsSymlink bool `json:"isSymlink"`
// contains filtered or unexported fields
}
Entry is the public metadata returned by LIST.
type EntryPathError ¶
EntryPathError reports an archive entry name unsafe for extraction.
func (*EntryPathError) Error ¶
func (e *EntryPathError) Error() string
type ExtractConfig ¶
type ExtractConfig struct {
Format Format `json:"format"`
Links string `json:"links"`
Include []string `json:"include"`
Exclude []string `json:"exclude"`
Config
Overwrite bool `json:"overwrite"`
CreateDirs bool `json:"createDirs"`
}
ExtractConfig controls archive extraction.
func DefaultExtractOptions ¶
func DefaultExtractOptions(cfg ...Config) ExtractConfig
DefaultExtractOptions returns EXTRACT defaults.
type ExtractResult ¶
type ExtractResult struct {
Path *string `json:"path"`
Reason *string `json:"reason"`
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"isDir"`
Skipped bool `json:"skipped"`
}
ExtractResult describes one eligible archive entry.
func Extract ¶
func Extract( ctx context.Context, source string, destination string, config ExtractConfig, ) (_ []ExtractResult, outErr error)
Extract safely writes eligible archive entries beneath destination.
type LimitError ¶
LimitError reports a declared or observed archive size over a configured cap.
func (*LimitError) Error ¶
func (e *LimitError) Error() string
type ListConfig ¶
ListConfig controls archive listing.
func DefaultListOptions ¶
func DefaultListOptions(cfg ...Config) ListConfig
DefaultListOptions returns LIST defaults.
type ReadConfig ¶
type ReadConfig struct {
Format Format `json:"format"`
As string `json:"as"`
Missing string `json:"missing"`
Config
}
ReadConfig controls archive entry reads.
func DefaultReadOptions ¶
func DefaultReadOptions(cfg ...Config) ReadConfig
DefaultReadOptions returns READ defaults.