Documentation
¶
Overview ¶
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *
This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *
This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.
Package source (go:generate go run -mod=mod github.com/golang/mock/mockgen -package mock -source=./$GOFILE -destination=../mock/$GOFILE)
Index ¶
- Constants
- func GetPathToCustomLibrary(ctx context.Context, platform, libraryPathFlag string) string
- func MergeInputData(defaultInputData, customInputData string) (string, error)
- func MergeModulesData(modules []tfmodules.ParsedModule, inputData string) (string, error)
- func ReadMetadata(ctx context.Context, queryDir string) (map[string]interface{}, error)
- func ReadQuery(ctx context.Context, queryDir string) (model.QueryMetadata, error)
- type ExcludeQueries
- type FilesystemSource
- func (s *FilesystemSource) CheckCloudProvider(cloudProvider interface{}) bool
- func (s *FilesystemSource) CheckType(queryPlatform interface{}) bool
- func (s *FilesystemSource) GetQueries(ctx context.Context, queryParameters *QueryInspectorParameters) ([]model.QueryMetadata, error)
- func (s *FilesystemSource) GetQueryLibrary(ctx context.Context, platform string) (RegoLibraries, error)
- type IncludeQueries
- type QueriesSource
- type QueryInspectorParameters
- type RegoLibraries
Constants ¶
const ( // QueryFileName The default query file name QueryFileName = "query.rego" // MetadataFileName The default metadata file name MetadataFileName = "metadata.json" // LibrariesDefaultBasePath the path to rego libraries LibrariesDefaultBasePath = "./assets/libraries" )
Variables ¶
This section is empty.
Functions ¶
func GetPathToCustomLibrary ¶
GetPathToCustomLibrary - returns the libraries path for a given platform
func MergeInputData ¶
MergeInputData merges KICS input data with custom input data user defined
func MergeModulesData ¶
func MergeModulesData(modules []tfmodules.ParsedModule, inputData string) (string, error)
func ReadMetadata ¶
ReadMetadata read query's metadata file inside the query directory
Types ¶
type ExcludeQueries ¶
ExcludeQueries is a struct that represents the option to exclude queries by ids or by categories
type FilesystemSource ¶
type FilesystemSource struct {
Source []string
Types []string
CloudProviders []string
Library string
ExperimentalQueries bool
}
FilesystemSource this type defines a struct with a path to a filesystem source of queries Source is the path to the queries Types are the types given by the flag --type for query selection mechanism
func NewFilesystemSource ¶
func NewFilesystemSource(ctx context.Context, source, types, cloudProviders []string, libraryPath string, experimentalQueries bool) *FilesystemSource
NewFilesystemSource initializes a NewFilesystemSource with source to queries and types of queries to load
func (*FilesystemSource) CheckCloudProvider ¶
func (s *FilesystemSource) CheckCloudProvider(cloudProvider interface{}) bool
CheckCloudProvider checks if the queries have the cloud provider passed as an argument in '--cloud-provider' flag to be loaded
func (*FilesystemSource) CheckType ¶
func (s *FilesystemSource) CheckType(queryPlatform interface{}) bool
CheckType checks if the queries have the type passed as an argument in '--type' flag to be loaded
func (*FilesystemSource) GetQueries ¶
func (s *FilesystemSource) GetQueries(ctx context.Context, queryParameters *QueryInspectorParameters) ([]model.QueryMetadata, error)
GetQueries walks a given filesource path returns all queries found in an array of QueryMetadata struct
func (*FilesystemSource) GetQueryLibrary ¶
func (s *FilesystemSource) GetQueryLibrary(ctx context.Context, platform string) (RegoLibraries, error)
GetQueryLibrary returns the library.rego for the platform passed in the argument
type IncludeQueries ¶
type IncludeQueries struct {
ByIDs []string
}
IncludeQueries is a struct that represents the option to include queries by ID taking precedence over exclusion
type QueriesSource ¶
type QueriesSource interface {
GetQueries(ctx context.Context, querySelection *QueryInspectorParameters) ([]model.QueryMetadata, error)
GetQueryLibrary(ctx context.Context, platform string) (RegoLibraries, error)
}
QueriesSource wraps an interface that contains basic methods: GetQueries and GetQueryLibrary GetQueries gets all queries from a QueryMetadata list GetQueryLibrary gets a library of rego functions given a plataform's name
type QueryInspectorParameters ¶
type QueryInspectorParameters struct {
IncludeQueries IncludeQueries
ExcludeQueries ExcludeQueries
ExperimentalQueries bool
InputDataPath string
BomQueries bool
FlagEvaluator featureflags.FlagEvaluator
}
QueryInspectorParameters is a struct that represents the optionn to select queries to be executed
type RegoLibraries ¶
RegoLibraries is a struct that contains the library code and its input data