blocks

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecutorPython     = "python3"
	ExecutorBash       = "bash"
	ExecutorSh         = "sh"
	ExecutorPowershell = "powershell"
	ExecutorRuby       = "ruby"
	ExecutorBinary     = "binary"
	ExecutorCmd        = "cmd.exe"
)

These are all the different executors that could run our inline command

Variables

This section is empty.

Functions

func FetchAbs

func FetchAbs(path string, workdir string) (fullpath string, err error)

FetchAbs returns the absolute path of a file given its path and the working directory. It handles cases where the path starts with "~/", is an absolute path, or is a relative path from the working directory. It logs any errors and returns them.

**Parameters:**

path: A string representing the path to the file.

workdir: A string representing the working directory.

**Returns:**

fullpath: A string representing the absolute path to the file.

error: An error if the path cannot be resolved to an absolute path.

func FetchEnv

func FetchEnv(environ map[string]string) []string

FetchEnv converts an environment variable map into a slice of strings that can be used as an argument when running a command.

**Parameters:**

environ: A map of environment variable names to values.

**Returns:**

[]string: A slice of strings representing the environment variables and their values.

func FindFilePath

func FindFilePath(path string, workdir string, system fs.StatFS) (string, error)

FindFilePath checks if a file exists given its path, the working directory, and an optional fs.StatFS. It handles cases where the path starts with "../", "~/", or is a relative path. It also checks a list of paths in InventoryPath for the file. It logs any errors and returns them.

**Parameters:**

path: A string representing the path to the file.

workdir: A string representing the working directory.

system: An optional fs.StatFS that can be used to check if the file exists.

**Returns:**

string: A string representing the path to the file, or an empty string if the file does not exist.

error: An error if the file cannot be found or if other errors occur.

func InferExecutor

func InferExecutor(filePath string) string

InferExecutor infers the executor based on the file extension and returns it as a string.

func LoadTTP

func LoadTTP(ttpFilePath string, fsys afero.Fs, execCfg *TTPExecutionConfig, argsKvStrs []string) (*TTP, *TTPExecutionContext, error)

LoadTTP reads a TTP file and creates a TTP instance based on its contents. If the file is empty or contains invalid data, it returns an error.

**Parameters:**

ttpFilePath: the absolute or relative path to the TTP YAML file. fsys: an afero.Fs that contains the specified TTP file path

**Returns:**

*TTP: Pointer to the created TTP instance, or nil if the file is empty or invalid. TTPExecutionContext: the initialized TTPExecutionContext suitable for passing to TTP.Execute(...) err: An error if the file contains invalid data or cannot be read.

func ShouldUseImplicitDefaultCleanup added in v1.0.9

func ShouldUseImplicitDefaultCleanup(action Action) bool

ShouldUseImplicitDefaultCleanup is a hack to make subTTPs always run their default cleanup process even when `cleanup: default` is not explicitly specified - this is purely for backward compatibility

Types

type ActResult

type ActResult struct {
	Stdout  string
	Stderr  string
	Outputs map[string]string
}

ActResult contains common fields produced from both the execution of steps and their associated cleanup actions

type Action added in v1.0.9

type Action interface {
	Execute(execCtx TTPExecutionContext) (*ActResult, error)
	Validate(execCtx TTPExecutionContext) error
	GetDefaultCleanupAction() Action
	IsNil() bool
}

Action is an interface that is implemented by all action types used in steps/cleanups (such as create_file, inline, etc)

type BasicStep

type BasicStep struct {
	Executor    string                  `yaml:"executor,omitempty"`
	Inline      string                  `yaml:"inline,flow"`
	Environment map[string]string       `yaml:"env,omitempty"`
	Outputs     map[string]outputs.Spec `yaml:"outputs,omitempty"`
	// contains filtered or unexported fields
}

BasicStep is a type that represents a basic execution step.

func NewBasicStep

func NewBasicStep() *BasicStep

NewBasicStep creates a new BasicStep instance with an initialized Act struct.

func (*BasicStep) Execute

func (b *BasicStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the BasicStep and returns an error if any occur.

func (*BasicStep) GetDefaultCleanupAction added in v1.0.9

func (ad *BasicStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction provides a default implementation of the GetDefaultCleanupAction method from the Action interface. This saves us from having to declare this function for every steps If a specific action needs a default cleanup action (such as a create_file action), it can override this step

func (*BasicStep) IsNil

func (b *BasicStep) IsNil() bool

IsNil checks if a BasicStep is considered empty or uninitialized.

func (*BasicStep) Validate

func (b *BasicStep) Validate(execCtx TTPExecutionContext) error

Validate validates the BasicStep, checking for the necessary attributes and dependencies.

type CommonStepFields added in v1.0.9

type CommonStepFields struct {
	Name        string         `yaml:"name,omitempty"`
	Description string         `yaml:"description,omitempty"`
	Checks      []checks.Check `yaml:"checks,omitempty"`

	// CleanupSpec is exported so that UnmarshalYAML
	// can see it - however, it should be considered
	// to be a private detail of this file
	// and not referenced elsewhere in the codebase
	CleanupSpec yaml.Node `yaml:"cleanup,omitempty"`
}

CommonStepFields contains the fields common to every type of step (such as Name). It centralizes validation to simplify the code

type CopyPathStep added in v1.0.10

type CopyPathStep struct {
	Source      string   `yaml:"copy_path,omitempty"`
	Destination string   `yaml:"to,omitempty"`
	Recursive   bool     `yaml:"recursive,omitempty"`
	Overwrite   bool     `yaml:"overwrite,omitempty"`
	Mode        int      `yaml:"mode,omitempty"`
	FileSystem  afero.Fs `yaml:"-,omitempty"`
}

CopyPathStep creates a new file and populates it with the specified contents from an existing path. Its intended use is simulating malicious file copies via a C2, where there is no corresponding shell history telemetry.

func NewCopyPathStep added in v1.0.10

func NewCopyPathStep() *CopyPathStep

NewCopyPathStep creates a new CopyPathStep instance and returns a pointer to it.

func (*CopyPathStep) Execute added in v1.0.10

func (s *CopyPathStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the step and returns an error if any occur.

func (*CopyPathStep) GetDefaultCleanupAction added in v1.0.10

func (s *CopyPathStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction will instruct the calling code to remove the path created by this action

func (*CopyPathStep) IsNil added in v1.0.10

func (s *CopyPathStep) IsNil() bool

IsNil checks if the step is nil or empty and returns a boolean value.

func (*CopyPathStep) Validate added in v1.0.10

func (s *CopyPathStep) Validate(execCtx TTPExecutionContext) error

Validate validates the step

**Returns:**

error: An error if any validation checks fail.

type CreateFileStep added in v1.0.8

type CreateFileStep struct {
	Path       string   `yaml:"create_file,omitempty"`
	Contents   string   `yaml:"contents,omitempty"`
	Overwrite  bool     `yaml:"overwrite,omitempty"`
	Mode       int      `yaml:"mode,omitempty"`
	FileSystem afero.Fs `yaml:"-,omitempty"`
}

CreateFileStep creates a new file and populates it with the specified contents. Its intended use is simulating malicious file creation through an editor program or via a C2, where there is no corresponding shell history telemetry

func NewCreateFileStep added in v1.0.8

func NewCreateFileStep() *CreateFileStep

NewCreateFileStep creates a new CreateFileStep instance and returns a pointer to it.

func (*CreateFileStep) Execute added in v1.0.8

func (s *CreateFileStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the step and returns an error if any occur.

func (*CreateFileStep) GetDefaultCleanupAction added in v1.0.9

func (s *CreateFileStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction will instruct the calling code to remove the path created by this action

func (*CreateFileStep) IsNil added in v1.0.8

func (s *CreateFileStep) IsNil() bool

IsNil checks if the step is nil or empty and returns a boolean value.

func (*CreateFileStep) Validate added in v1.0.8

func (s *CreateFileStep) Validate(execCtx TTPExecutionContext) error

Validate validates the step

**Returns:**

error: An error if any validation checks fail.

type Edit

type Edit struct {
	Old    string `yaml:"old,omitempty"`
	New    string `yaml:"new,omitempty"`
	Append string `yaml:"append,omitempty"`
	Delete string `yaml:"delete,omitempty"`
	Regexp bool   `yaml:"regexp,omitempty"`
	// contains filtered or unexported fields
}

Edit represents a single old+new find-and-replace pair

type EditStep

type EditStep struct {
	FileToEdit string   `yaml:"edit_file,omitempty"`
	Edits      []*Edit  `yaml:"edits,omitempty"`
	FileSystem afero.Fs `yaml:"-,omitempty"`
	BackupFile string   `yaml:"backup_file,omitempty"`
	// contains filtered or unexported fields
}

EditStep represents one or more edits to a specific file

func NewEditStep

func NewEditStep() *EditStep

NewEditStep creates a new EditStep instance with an initialized Act struct.

func (*EditStep) Execute

func (s *EditStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the EditStep and returns an error if any occur.

func (*EditStep) GetDefaultCleanupAction added in v1.0.9

func (ad *EditStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction provides a default implementation of the GetDefaultCleanupAction method from the Action interface. This saves us from having to declare this function for every steps If a specific action needs a default cleanup action (such as a create_file action), it can override this step

func (*EditStep) IsNil

func (s *EditStep) IsNil() bool

IsNil checks if an EditStep is considered empty or uninitialized.

func (*EditStep) Validate

func (s *EditStep) Validate(execCtx TTPExecutionContext) error

Validate validates the EditStep, checking for the necessary attributes and dependencies.

type ExecutionResult

type ExecutionResult struct {
	ActResult
	Cleanup *ActResult
}

ExecutionResult stores the results/outputs generated by executing a Step

type FetchURIStep added in v1.0.8

type FetchURIStep struct {
	FetchURI   string   `yaml:"fetch_uri,omitempty"`
	Retries    string   `yaml:"retries,omitempty"`
	Location   string   `yaml:"location,omitempty"`
	Proxy      string   `yaml:"proxy,omitempty"`
	Overwrite  bool     `yaml:"overwrite,omitempty"`
	FileSystem afero.Fs `yaml:"-,omitempty"`
	// contains filtered or unexported fields
}

FetchURIStep represents a step in a process that consists of a main action, a cleanup action, and additional metadata.

func NewFetchURIStep added in v1.0.8

func NewFetchURIStep() *FetchURIStep

NewFetchURIStep creates a new FetchURIStep instance and returns a pointer to it.

func (*FetchURIStep) Cleanup added in v1.0.8

func (f *FetchURIStep) Cleanup(execCtx TTPExecutionContext) (*ActResult, error)

Cleanup is a method to establish a link with the Cleanup interface. Assumes that the type is the cleanup step and is invoked by f.CleanupStep.Cleanup.

func (*FetchURIStep) Execute added in v1.0.8

func (f *FetchURIStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the FetchURIStep and returns an error if any occur.

func (*FetchURIStep) GetDefaultCleanupAction added in v1.0.9

func (ad *FetchURIStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction provides a default implementation of the GetDefaultCleanupAction method from the Action interface. This saves us from having to declare this function for every steps If a specific action needs a default cleanup action (such as a create_file action), it can override this step

func (*FetchURIStep) IsNil added in v1.0.8

func (f *FetchURIStep) IsNil() bool

IsNil checks if the FetchURIStep is nil or empty and returns a boolean value.

func (*FetchURIStep) Validate added in v1.0.8

func (f *FetchURIStep) Validate(execCtx TTPExecutionContext) error

Validate validates the FetchURIStep. It checks that the Act field is valid, Location is set with a valid file path, and Uri is set.

If Location is set, it ensures that the path exists and retrieves its absolute path.

**Returns:**

error: An error if any validation checks fail.

type FileStep

type FileStep struct {
	FilePath    string                  `yaml:"file,omitempty"`
	Executor    string                  `yaml:"executor,omitempty"`
	Environment map[string]string       `yaml:"env,omitempty"`
	Outputs     map[string]outputs.Spec `yaml:"outputs,omitempty"`
	Args        []string                `yaml:"args,omitempty,flow"`
	// contains filtered or unexported fields
}

FileStep represents a step in a process that consists of a main action, a cleanup action, and additional metadata.

func NewFileStep

func NewFileStep() *FileStep

NewFileStep creates a new FileStep instance and returns a pointer to it.

func (*FileStep) Cleanup

func (f *FileStep) Cleanup(execCtx TTPExecutionContext) (*ActResult, error)

Cleanup is a method to establish a link with the Cleanup interface. Assumes that the type is the cleanup step and is invoked by f.CleanupStep.Cleanup.

func (*FileStep) Execute

func (f *FileStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the FileStep and returns an error if any occur.

func (*FileStep) GetDefaultCleanupAction added in v1.0.9

func (ad *FileStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction provides a default implementation of the GetDefaultCleanupAction method from the Action interface. This saves us from having to declare this function for every steps If a specific action needs a default cleanup action (such as a create_file action), it can override this step

func (*FileStep) IsNil

func (f *FileStep) IsNil() bool

IsNil checks if the FileStep is nil or empty and returns a boolean value.

func (*FileStep) Validate

func (f *FileStep) Validate(execCtx TTPExecutionContext) error

Validate validates the FileStep. It checks that the Act field is valid, and that either FilePath is set with a valid file path, or InlineLogic is set with valid code.

If FilePath is set, it ensures that the file exists and retrieves its absolute path.

If Executor is not set, it infers the executor based on the file extension. It then checks that the executor is in the system path, and if CleanupStep is not nil, it validates the cleanup step as well. It logs any errors and returns them.

**Returns:**

error: An error if any validation checks fail.

type MitreAttack added in v1.0.8

type MitreAttack struct {
	Tactics       []string `yaml:"tactics,omitempty"`
	Techniques    []string `yaml:"techniques,omitempty"`
	SubTechniques []string `yaml:"subtechniques,omitempty"`
}

MitreAttack represents mappings to the MITRE ATT&CK framework.

**Attributes:**

Tactics: A string slice containing the MITRE ATT&CK tactic(s) associated with the TTP. Techniques: A string slice containing the MITRE ATT&CK technique(s) associated with the TTP. SubTechniques: A string slice containing the MITRE ATT&CK sub-technique(s) associated with the TTP.

type PrintStrAction added in v1.0.9

type PrintStrAction struct {
	Message string `yaml:"print_str,omitempty"`
	// contains filtered or unexported fields
}

PrintStrAction is used to print a string to the console

func (*PrintStrAction) Execute added in v1.0.9

func (s *PrintStrAction) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the step and returns an error if any occur.

func (*PrintStrAction) GetDefaultCleanupAction added in v1.0.9

func (ad *PrintStrAction) GetDefaultCleanupAction() Action

GetDefaultCleanupAction provides a default implementation of the GetDefaultCleanupAction method from the Action interface. This saves us from having to declare this function for every steps If a specific action needs a default cleanup action (such as a create_file action), it can override this step

func (*PrintStrAction) IsNil added in v1.0.9

func (s *PrintStrAction) IsNil() bool

IsNil checks if the step is nil or empty and returns a boolean value.

func (*PrintStrAction) Validate added in v1.0.9

func (s *PrintStrAction) Validate(execCtx TTPExecutionContext) error

Validate validates the step

**Returns:**

error: An error if any validation checks fail.

type RemovePathAction added in v1.0.9

type RemovePathAction struct {
	Path       string   `yaml:"remove_path,omitempty"`
	Recursive  bool     `yaml:"recursive,omitempty"`
	FileSystem afero.Fs `yaml:"-,omitempty"`
	// contains filtered or unexported fields
}

RemovePathAction is invoked by adding remove_path to a given YAML step. It will delete the file at the specified path You must pass `recursive: true` to delete directories

func (*RemovePathAction) Execute added in v1.0.9

func (s *RemovePathAction) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the step and returns an error if any occur.

func (*RemovePathAction) GetDefaultCleanupAction added in v1.0.9

func (ad *RemovePathAction) GetDefaultCleanupAction() Action

GetDefaultCleanupAction provides a default implementation of the GetDefaultCleanupAction method from the Action interface. This saves us from having to declare this function for every steps If a specific action needs a default cleanup action (such as a create_file action), it can override this step

func (*RemovePathAction) IsNil added in v1.0.9

func (s *RemovePathAction) IsNil() bool

IsNil checks if the step is nil or empty and returns a boolean value.

func (*RemovePathAction) Validate added in v1.0.9

func (s *RemovePathAction) Validate(execCtx TTPExecutionContext) error

Validate validates the step

**Returns:**

error: An error if any validation checks fail.

type RequirementsConfig added in v1.0.10

type RequirementsConfig struct {
	ExpectSuperuser bool             `yaml:"superuser,omitempty"`
	Platforms       []platforms.Spec `yaml:"platforms,omitempty"`
}

RequirementsConfig specifies the prerequisites that must be satisfied before executing a particular TTP.

**Attributes:**

ExpectSuperuser: Whether the TTP assumes superuser privileges

func (*RequirementsConfig) Validate added in v1.0.10

func (rc *RequirementsConfig) Validate() error

Validate checks that the requirements section is well-formed - it does not actually check that the requirements are met.

func (*RequirementsConfig) Verify added in v1.0.10

Verify checks that the requirements specified in the requirements section are actually satisfied by the environment in which the TTP is currently running.

type Step

type Step struct {
	CommonStepFields
	// contains filtered or unexported fields
}

Step contains a TTPForge executable action and its associated cleanup action (if specified)

func (*Step) Cleanup added in v1.0.9

func (s *Step) Cleanup(execCtx TTPExecutionContext) (*ActResult, error)

Cleanup runs the cleanup action associated with this step

func (*Step) Execute

func (s *Step) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs the action associated with this step

func (*Step) ParseAction added in v1.0.9

func (s *Step) ParseAction(node *yaml.Node) (Action, error)

ParseAction decodes an action (from step or cleanup) in YAML format into the appropriate struct

func (*Step) ShouldCleanupOnFailure added in v1.0.9

func (s *Step) ShouldCleanupOnFailure() bool

ShouldCleanupOnFailure specifies that this step should be cleaned up even if its Execute(...) failed. We usually don't want to do this - for example, you shouldn't try to remove_path a create_file that failed) However, certain step types (especially SubTTPs) need to run cleanup even if they fail

func (*Step) UnmarshalYAML added in v1.0.9

func (s *Step) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements custom deserialization process to ensure that the step action and its cleanup action are decoded to the correct struct type

func (*Step) Validate

func (s *Step) Validate(execCtx TTPExecutionContext) error

Validate checks that both the step action and cleanup action are valid

type StepResultsRecord

type StepResultsRecord struct {
	ByName  map[string]*ExecutionResult
	ByIndex []*ExecutionResult
}

StepResultsRecord provides convenient accessors that be used to query the results of executing individual TTP steps

func NewStepResultsRecord

func NewStepResultsRecord() *StepResultsRecord

NewStepResultsRecord generates an appropriately initialized StepResultsRecord

type SubTTPStep

type SubTTPStep struct {
	TtpFile string            `yaml:"ttp"`
	Args    map[string]string `yaml:"args"`
	// contains filtered or unexported fields
}

SubTTPStep represents a step within a parent TTP that references a separate TTP file.

func NewSubTTPStep

func NewSubTTPStep() *SubTTPStep

NewSubTTPStep creates a new SubTTPStep and returns a pointer to it.

func (*SubTTPStep) Execute

func (s *SubTTPStep) Execute(execCtx TTPExecutionContext) (*ActResult, error)

Execute runs each step of the TTP file associated with the SubTTPStep and manages the outputs and cleanup steps.

func (*SubTTPStep) GetDefaultCleanupAction added in v1.0.9

func (s *SubTTPStep) GetDefaultCleanupAction() Action

GetDefaultCleanupAction will instruct the calling code to cleanup all successful steps of this subTTP

func (*SubTTPStep) IsNil

func (s *SubTTPStep) IsNil() bool

IsNil checks if the SubTTPStep is empty or uninitialized.

func (*SubTTPStep) Validate

func (s *SubTTPStep) Validate(execCtx TTPExecutionContext) error

Validate checks the validity of the SubTTPStep by ensuring the following conditions are met: The associated Act is valid. The TTP file associated with the SubTTPStep can be successfully unmarshalled. The TTP file path is not empty. The steps within the TTP file do not contain any nested SubTTPSteps. If any of these conditions are not met, an error is returned.

type TTP

type TTP struct {
	Name               string              `yaml:"name,omitempty"`
	Description        string              `yaml:"description"`
	MitreAttackMapping *MitreAttack        `yaml:"mitre,omitempty"`
	Environment        map[string]string   `yaml:"env,flow,omitempty"`
	Requirements       *RequirementsConfig `yaml:"requirements,omitempty"`
	Steps              []Step              `yaml:"steps,omitempty,flow"`
	ArgSpecs           []args.Spec         `yaml:"args,omitempty,flow"`
	// Omit WorkDir, but expose for testing.
	WorkDir string `yaml:"-"`
}

TTP represents the top-level structure for a TTP (Tactics, Techniques, and Procedures) object.

**Attributes:**

Name: The name of the TTP. Description: A description of the TTP. MitreAttackMapping: A MitreAttack object containing mappings to the MITRE ATT&CK framework. Environment: A map of environment variables to be set for the TTP. Steps: An slice of steps to be executed for the TTP. ArgSpecs: An slice of argument specifications for the TTP. WorkDir: The working directory for the TTP.

func RenderTemplatedTTP

func RenderTemplatedTTP(ttpStr string, execCfg *TTPExecutionConfig) (*TTP, error)

RenderTemplatedTTP is a function that utilizes Golang's `text/template` for template substitution. It replaces template expressions like `{{ .Args.myarg }}` with corresponding values. This function must be invoked prior to YAML unmarshaling, as the template syntax `{{ ... }}` may result in invalid YAML under specific conditions.

**Parameters:**

ttpStr: A string containing the TTP template to be rendered. execCfg: A pointer to a TTPExecutionConfig that represents the execution configuration for the TTP.

**Returns:**

*TTP: A pointer to the TTP object created from the template. error: An error if the rendering or unmarshaling process fails.

func (*TTP) Execute added in v1.0.9

func (t *TTP) Execute(execCtx *TTPExecutionContext) (*StepResultsRecord, error)

Execute executes all of the steps in the given TTP, then runs cleanup if appropriate

**Parameters:**

execCfg: The TTPExecutionConfig for the current TTP.

**Returns:**

*StepResultsRecord: A StepResultsRecord containing the results of each step. error: An error if any of the steps fail to execute.

func (*TTP) MarshalYAML

func (t *TTP) MarshalYAML() (interface{}, error)

MarshalYAML is a custom marshalling implementation for the TTP structure. It encodes a TTP object into a formatted YAML string, handling the indentation and structure of the output YAML.

**Returns:**

interface{}: The formatted YAML string representing the TTP object. error: An error if the encoding process fails.

func (*TTP) RunSteps

func (t *TTP) RunSteps(execCtx *TTPExecutionContext) (*StepResultsRecord, int, error)

RunSteps executes all of the steps in the given TTP.

**Parameters:**

execCtx: The current TTPExecutionContext

**Returns:**

*StepResultsRecord: A StepResultsRecord containing the results of each step. int: the index of the step where cleanup should start (usually the last successful step) error: An error if any of the steps fail to execute.

func (*TTP) Validate added in v1.0.9

func (t *TTP) Validate(execCtx TTPExecutionContext) error

Validate ensures that all components of the TTP are valid It checks key fields, then iterates through each step and validates them in turn

**Parameters:**

execCtx: The TTPExecutionContext for the current TTP.

**Returns:**

error: An error if any part of the validation fails, otherwise nil.

type TTPExecutionConfig

type TTPExecutionConfig struct {
	DryRun              bool
	NoCleanup           bool
	CleanupDelaySeconds uint
	Args                map[string]any
	Repo                repos.Repo
	Stdout              io.Writer
	Stderr              io.Writer
}

TTPExecutionConfig - pass this into RunSteps to control TTP execution

type TTPExecutionContext

type TTPExecutionContext struct {
	Cfg         TTPExecutionConfig
	WorkDir     string
	StepResults *StepResultsRecord
}

TTPExecutionContext - holds config and context for the currently executing TTP

func (TTPExecutionContext) ExpandVariables

func (c TTPExecutionContext) ExpandVariables(inStrs []string) ([]string, error)

ExpandVariables takes a string containing the following types of variables and expands all of them to their appropriate values:

* Step outputs: ($forge.steps.bar.outputs.baz)

**Parameters:**

inStrs: the list of strings that have variables expanded

**Returns:**

[]string: the corresponding strings with variables expanded error: an error if there is a problem

Jump to

Keyboard shortcuts

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