scenario

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(ctx context.Context, challDir, scenario string) (string, error)

Decode (base 64) and unzip the scenario content into the scenario directory along the others. If files already exist for this challenge, erase it first. Returns the directory to look for the Pulumi stack or an error if anything went wrong. Error is of type *errors.ErrInternal if related to file-system errors, else a meaningfull error to return to the API call.

func Validate

func Validate(ctx context.Context, dir string) error

Validate check the challenge instance can build i.e. a preview.

Types

type Decompressor added in v0.1.4

type Decompressor struct {
	*Options
}

Decompressor handle the load of

func NewDecompressor added in v0.1.4

func NewDecompressor(opts *Options) *Decompressor

NewDecompressor constructs a fresh Decompressor.

func (*Decompressor) Unzip added in v0.1.4

func (dec *Decompressor) Unzip(r *zip.Reader, cd string) (string, error)

Unzip extracts the content of the zip reader into cd. It returns the directory it extracted into for Pulumi to use, or an error if anything unexpected happens.

type ErrPathTainted added in v0.1.4

type ErrPathTainted struct {
	Path string
}

ErrPathTainted is returned when a potential zip slip is detected through an unzip.

func (ErrPathTainted) Error added in v0.1.4

func (err ErrPathTainted) Error() string

type ErrTooLargeContent added in v0.1.4

type ErrTooLargeContent struct {
	MaxSize int64
}

ErrTooLargeContent is returned when a too large zip is processed (e.g. a zip bomb).

func (ErrTooLargeContent) Error added in v0.1.4

func (err ErrTooLargeContent) Error() string

type Options added in v0.1.4

type Options struct {
	MaxSize int64
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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