Documentation ¶
Index ¶
- Constants
- func CreateCommand(tool Interface) *cobra.Command
- func IsDockerError(err error) bool
- func MissingFormatter(n *jnode.Node) string
- func MustRel(base, target string) string
- func PassFormatter(n *jnode.Node) string
- func TempFile(pattern string) (name string, err error)
- type AssessmentOpts
- func (o *AssessmentOpts) GetAssessmentHiddenOptions() *options.HiddenOptionsGroup
- func (o *AssessmentOpts) GetAssessmentOptions() *AssessmentOpts
- func (o *AssessmentOpts) GetCustomPoliciesDir(policyTypeName string, morePolicyTypeNames ...string) (string, error)
- func (o *AssessmentOpts) Register(c *cobra.Command)
- func (o *AssessmentOpts) Validate() error
- type Config
- type Consolidated
- type DirectoryBasedToolOpts
- func (o *DirectoryBasedToolOpts) GetDockerRunDirectory() string
- func (o *DirectoryBasedToolOpts) GetFilesInDirectory(files []string) ([]string, error)
- func (o *DirectoryBasedToolOpts) GetInventory() *inventory.Manifest
- func (o *DirectoryBasedToolOpts) IsExcluded(file string) bool
- func (o *DirectoryBasedToolOpts) Register(cmd *cobra.Command)
- func (o *DirectoryBasedToolOpts) RemoveExcluded(files []string) []string
- func (o *DirectoryBasedToolOpts) Validate() error
- type DirectoryOpt
- type DockerError
- type DockerTool
- type ExecuteResult
- func (r *ExecuteResult) AppendUploadOptions(compressFiles bool, options []api.Option) []api.Option
- func (r *ExecuteResult) ExpectExitCode(codes ...int) bool
- func (r *ExecuteResult) ParseJSON() (*jnode.Node, bool)
- func (r *ExecuteResult) SetFailureFromError(ft FailureType, err error)
- func (r *ExecuteResult) SetUploadValues(values map[string]string)
- func (r *ExecuteResult) ToError() error
- func (r *ExecuteResult) ToResult(dir string) *Result
- type ExtraArgs
- type FailureType
- type FileFingerprint
- type HasCommandTemplate
- type HasDirectory
- type IACPlatform
- type Interface
- type Result
- type Results
- type RunOpts
- func (o *RunOpts) ExecuteCommand(c *exec.Cmd) *ExecuteResult
- func (o *RunOpts) GetRunHiddenOptions() *options.HiddenOptionsGroup
- func (o *RunOpts) InstallAPIServerArtifact(name, urlPath string) (*download.Download, error)
- func (o *RunOpts) InstallTool(spec *download.Spec) (*download.Download, error)
- func (o *RunOpts) LogCommand(c *exec.Cmd)
- func (o *RunOpts) Register(cmd *cobra.Command)
- func (o *RunOpts) RunDocker(d *DockerTool) (*ExecuteResult, error)
- func (o *RunOpts) UsingDocker() bool
- type Simple
- type Single
- type ToolOpts
- type UploadOpts
Constants ¶
const ( InstallFailure = FailureType("install") ExecutionFailure = FailureType("execution") GarbledResultFailure = FailureType("garbled_result") ExitCodeFailure = FailureType("exit_code") NoFailure = FailureType("") )
const ( Terraform = IACPlatform("terraform") TerraformPlan = IACPlatform("terraform_plan") CDK = IACPlatform("cdk") Helm = IACPlatform("helm") Kustomize = IACPlatform("kustomize") Cloudformation = IACPlatform("cloudformation") Dockerfile = IACPlatform("dockerfile") ARM = IACPlatform("arm") Kubernetes = IACPlatform("kubernetes") )
const AssessmentDirectoryValue = "ASSESSMENT_DIRECTORY"
Variables ¶
This section is empty.
Functions ¶
func CreateCommand ¶ added in v0.4.28
func IsDockerError ¶ added in v0.5.4
func MissingFormatter ¶ added in v0.5.0
func MissingFormatter(n *jnode.Node) string
func PassFormatter ¶ added in v0.4.39
func PassFormatter(n *jnode.Node) string
Types ¶
type AssessmentOpts ¶ added in v0.5.9
type AssessmentOpts struct { ToolOpts UploadOpts PrintResultOpt bool SaveResult string PrintResultValues bool SaveResultValues string DisableCustomPolicies bool PrintFingerprints bool SaveFingerprints string CustomPoliciesDir string PreparedCustomPoliciesDir string FailThresholds []string // contains filtered or unexported fields }
func (*AssessmentOpts) GetAssessmentHiddenOptions ¶ added in v0.5.9
func (o *AssessmentOpts) GetAssessmentHiddenOptions() *options.HiddenOptionsGroup
func (*AssessmentOpts) GetAssessmentOptions ¶ added in v0.5.9
func (o *AssessmentOpts) GetAssessmentOptions() *AssessmentOpts
func (*AssessmentOpts) GetCustomPoliciesDir ¶ added in v0.5.9
func (o *AssessmentOpts) GetCustomPoliciesDir(policyTypeName string, morePolicyTypeNames ...string) (string, error)
Prepare and return a directory that contains the custom policies for a tool. The policyTypeName/morePolicyTypeNames signature requires at least a single policy type to give a hint that the policy manager needs specific support for any given tool, e.g. generate a directory with custom checkov policies requires specific support in the policy manager for checkov.
func (*AssessmentOpts) Register ¶ added in v0.5.9
func (o *AssessmentOpts) Register(c *cobra.Command)
func (*AssessmentOpts) Validate ¶ added in v0.5.9
func (o *AssessmentOpts) Validate() error
type Config ¶ added in v0.4.39
type Config struct {
// contains filtered or unexported fields
}
func ReadConfigFile ¶ added in v0.5.0
type Consolidated ¶ added in v0.5.0
A Consolidated tool runs and returns multiple asessment results (typically by invoking other tools)
type DirectoryBasedToolOpts ¶ added in v0.4.28
type DirectoryBasedToolOpts struct { AssessmentOpts DirectoryOpt Exclude []string // contains filtered or unexported fields }
Options for assessment tools that run in a directory
func (*DirectoryBasedToolOpts) GetDockerRunDirectory ¶ added in v0.4.45
func (o *DirectoryBasedToolOpts) GetDockerRunDirectory() string
Return the directory that a docker-based tool is run in. Normally this is /src, but if it's run out of PATH, then it's o.GetDirectory()
func (*DirectoryBasedToolOpts) GetFilesInDirectory ¶ added in v0.4.34
func (o *DirectoryBasedToolOpts) GetFilesInDirectory(files []string) ([]string, error)
func (*DirectoryBasedToolOpts) GetInventory ¶ added in v0.4.34
func (o *DirectoryBasedToolOpts) GetInventory() *inventory.Manifest
func (*DirectoryBasedToolOpts) IsExcluded ¶ added in v0.4.34
func (o *DirectoryBasedToolOpts) IsExcluded(file string) bool
func (*DirectoryBasedToolOpts) Register ¶ added in v0.4.28
func (o *DirectoryBasedToolOpts) Register(cmd *cobra.Command)
func (*DirectoryBasedToolOpts) RemoveExcluded ¶ added in v0.4.34
func (o *DirectoryBasedToolOpts) RemoveExcluded(files []string) []string
func (*DirectoryBasedToolOpts) Validate ¶ added in v0.4.34
func (o *DirectoryBasedToolOpts) Validate() error
type DirectoryOpt ¶ added in v0.5.9
type DirectoryOpt struct { Directory string // contains filtered or unexported fields }
func (*DirectoryOpt) GetDirectory ¶ added in v0.5.9
func (o *DirectoryOpt) GetDirectory() string
func (*DirectoryOpt) Register ¶ added in v0.5.9
func (o *DirectoryOpt) Register(cmd *cobra.Command)
func (*DirectoryOpt) SetDirectory ¶ added in v0.5.9
func (o *DirectoryOpt) SetDirectory(dir string)
func (*DirectoryOpt) Validate ¶ added in v0.5.9
func (o *DirectoryOpt) Validate(opts *ToolOpts) error
type DockerError ¶ added in v0.5.4
type DockerError string
func (DockerError) Error ¶ added in v0.5.4
func (d DockerError) Error() string
func (DockerError) Is ¶ added in v0.5.4
func (d DockerError) Is(err error) bool
type DockerTool ¶ added in v0.4.29
type DockerTool struct { Name string Image string DockerArgs []string Args []string DefaultNoDockerName string ExtraMounts map[string]string Stdout io.Writer Stderr io.Writer Directory string WorkingDirectory string PropagateEnvironmentVars []string // contains filtered or unexported fields }
func (*DockerTool) AppendArgs ¶ added in v0.5.8
func (t *DockerTool) AppendArgs(args ...string)
func (*DockerTool) Mount ¶ added in v0.5.8
func (t *DockerTool) Mount(name, mountpoint string)
type ExecuteResult ¶ added in v0.5.13
type ExecuteResult struct { Args []string FailureType FailureType FailureMessage string ExitCode int CombinedOutput string Output []byte }
func (*ExecuteResult) AppendUploadOptions ¶ added in v0.5.13
func (*ExecuteResult) ExpectExitCode ¶ added in v0.5.13
func (r *ExecuteResult) ExpectExitCode(codes ...int) bool
func (*ExecuteResult) ParseJSON ¶ added in v0.5.13
func (r *ExecuteResult) ParseJSON() (*jnode.Node, bool)
func (*ExecuteResult) SetFailureFromError ¶ added in v0.5.13
func (r *ExecuteResult) SetFailureFromError(ft FailureType, err error)
func (*ExecuteResult) SetUploadValues ¶ added in v0.5.13
func (r *ExecuteResult) SetUploadValues(values map[string]string)
func (*ExecuteResult) ToError ¶ added in v0.5.13
func (r *ExecuteResult) ToError() error
func (*ExecuteResult) ToResult ¶ added in v0.5.13
func (r *ExecuteResult) ToResult(dir string) *Result
type ExtraArgs ¶ added in v0.4.55
type ExtraArgs []string
ExtraArgs captures extra arguments to a command
type FailureType ¶ added in v0.5.13
type FailureType string
type FileFingerprint ¶ added in v0.5.0
type HasCommandTemplate ¶ added in v0.4.31
type HasDirectory ¶ added in v0.5.9
type IACPlatform ¶ added in v0.5.31
type IACPlatform string
type Result ¶
type Result struct { Tool Single Data *jnode.Node Findings assessments.Findings Values map[string]string Directory string FileFingerprints []*FileFingerprint UploadOptions []api.Option ExecuteResult *ExecuteResult ModuleName string IACPlatform IACPlatform Assessment *assessments.Assessment AssessmentRaw *jnode.Node }
func RunSingleAssessment ¶ added in v0.5.9
func (*Result) AddUploadOption ¶ added in v0.5.9
func (*Result) UpdateFileFingerprints ¶ added in v0.5.0
func (r *Result) UpdateFileFingerprints()
type Results ¶ added in v0.5.0
type Results []*Result
func RunConsoliatedAssessments ¶ added in v0.5.9
func RunConsoliatedAssessments(tool Consolidated) (Results, error)
type RunOpts ¶ added in v0.4.39
type RunOpts struct { options.PrintClientOpts ToolVersion string ToolPath string SkipDockerPull bool ExtraDockerArgs []string NoDocker bool Internal bool // contains filtered or unexported fields }
func (*RunOpts) ExecuteCommand ¶ added in v0.5.13
func (o *RunOpts) ExecuteCommand(c *exec.Cmd) *ExecuteResult
func (*RunOpts) GetRunHiddenOptions ¶ added in v0.4.55
func (o *RunOpts) GetRunHiddenOptions() *options.HiddenOptionsGroup
func (*RunOpts) InstallAPIServerArtifact ¶ added in v0.5.9
func (*RunOpts) InstallTool ¶ added in v0.4.39
func (*RunOpts) LogCommand ¶ added in v0.4.55
func (*RunOpts) RunDocker ¶ added in v0.4.39
func (o *RunOpts) RunDocker(d *DockerTool) (*ExecuteResult, error)
Run a docker tool. If the tool cannot be run because docker isn't running or the tool path isn't known then returns an error. Otherwise returns an ExecuteResult that holds the output, log and exit code of the command.
func (*RunOpts) UsingDocker ¶ added in v0.5.18
type Single ¶ added in v0.5.0
type Single interface { Interface GetAssessmentOptions() *AssessmentOpts Run() (*Result, error) }
A Single tool runs and returns a single assessment result
type ToolOpts ¶
type ToolOpts struct { RunOpts Tool Interface RepoRoot string UseEmptyConfigFile bool // contains filtered or unexported fields }
func (*ToolOpts) GetStandardXCPValues ¶ added in v0.5.9
func (*ToolOpts) GetToolOptions ¶ added in v0.4.28
type UploadOpts ¶ added in v0.5.15
type UploadOpts struct { DefaultUploadEnabled bool UploadEnabled bool GitPRBaseRef string UploadErrors bool CompressResults bool }
func (*UploadOpts) AppendUploadOptions ¶ added in v0.5.15
func (*UploadOpts) Register ¶ added in v0.5.15
func (o *UploadOpts) Register(cmd *cobra.Command)