model

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

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.

* 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.

* 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.

* 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.

* 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.

Index

Constants

View Source
const (
	SuppressionJustificationIgnoreComment = "dd-iac-scan ignore"
	SuppressionJustificationDisableInFile = "dd-iac-scan disable"
)

Suppression justifications surfaced in SARIF `suppressions[].justification`. `IgnoreComment` covers both `ignore-line` and `ignore-block` because `LinesIgnore` flattens block directives to individual line numbers, so the originating directive is no longer recoverable at suppression time.

View Source
const (
	SeverityCritical = "CRITICAL"
	SeverityHigh     = "HIGH"
	SeverityMedium   = "MEDIUM"
	SeverityLow      = "LOW"
	SeverityInfo     = "INFO"
	SeverityTrace    = "TRACE"
)

Constants to describe vulnerability's severity

View Source
const (
	SuppressionKindInSource = "inSource"
)

Suppression kinds map to SARIF 2.1.0 `suppressions[].kind`.

Variables

View Source
var (
	// DDCommentRgxp identifies dd-iac-scan inline suppression comments
	DDCommentRgxp = regexp.MustCompile(`(^|\n)((/{2})|#|;)*\s*dd-iac-scan\s*`)
	// DDGetContentCommentRgxp extracts the dd-iac-scan comment content
	DDGetContentCommentRgxp = regexp.MustCompile(`(^|\n)((/{2})|#|;)*\s*dd-iac-scan([^\n]*)\n`)
	// DDCommentRgxpYaml identifies dd-iac-scan suppression comments in YAML
	DDCommentRgxpYaml = regexp.MustCompile(`((/{2})|#)*\s*dd-iac-scan\s*(ignore-line|ignore-block)\s*\n*$`)
)

Arrays to group all constants of one type

Functions

func ClearYAMLScalarInterner added in v1.16.0

func ClearYAMLScalarInterner()

ClearYAMLScalarInterner drops the intern lookup after prepare. Live documents still share the interned strings; the table is not retained across scans in a long-lived process.

func GetDatadogFingerprintHash added in v1.6.0

func GetDatadogFingerprintHash(
	sciInfo SCIInfo, filePath, platform, resourceType, resourceName, ruleID, vulnLine, moduleCallChain string,
) string

GetDatadogFingerprintHash is the single source of truth for a finding's stable identity. It is computed once when the summary is built and reused by every report format, so the fingerprint never diverges across outputs. nolint:gocritic

func GetIgnoreLines added in v1.12.0

func GetIgnoreLines(file *FileMetadata) []int

GetIgnoreLines recomputes YAML ignore comments from OriginalData after reference resolution shifted line numbers.

func Range

func Range(start, end int) (lines []int)

Range returns a slice of lines between the start and end line numbers.

func RedactURLCredentials added in v1.13.0

func RedactURLCredentials(s string) string

RedactURLCredentials strips embedded userinfo (`user`, `user:password`, `:password`) from the authority of every URL in s, whatever its scheme, leaving the rest of the string — scheme, host, port, path and query — untouched. An `@` outside the authority (`.../repo@ref`, `?user=a@b`) is not userinfo and is preserved. It is safe to call on arbitrary text such as error messages, not just on bare URLs.

func RemoveDuplicates

func RemoveDuplicates(lines []int) []int

RemoveDuplicates removes duplicate lines from a slice of lines.

Types

type AnalyzedPaths

type AnalyzedPaths struct {
	Types        []string
	Exc          []string
	ExpectedLOC  int
	FilePlatform map[string]string
	Inventory    []string
	ChartRoots   []string
	TotalFiles   int
	ContentCache map[string][]byte
}

AnalyzedPaths is a slice of types and excluded files obtained from the Analyzer

type ArtifactChange

type ArtifactChange struct {
	ArtifactLocation ArtifactLocation `json:"artifactLocation"`
	Replacements     []FixReplacement `json:"replacements"`
}

type ArtifactLocation

type ArtifactLocation struct {
	URI string `json:"uri"`
}

type CodeLine

type CodeLine struct {
	Position int
	Line     string
}

CodeLine is the lines containing and adjacent to the vulnerability line with their respective positions

type CommentCommand

type CommentCommand string

CommentCommand represents a command given from a comment

const (
	IgnoreLine    CommentCommand = "ignore-line"
	IgnoreBlock   CommentCommand = "ignore-block"
	IgnoreComment CommentCommand = "ignore-comment"
)

Constants to describe commands given from comments

func ProcessCommands

func ProcessCommands(commands []string) CommentCommand

ProcessCommands processes a slice of commands.

type CommentsCommands

type CommentsCommands map[string]string

CommentsCommands list of commands on a file that will be parsed

type Counters

type Counters struct {
	ScannedFiles           int `json:"files_scanned"`
	ScannedFilesLines      int `json:"lines_scanned"`
	ParsedFiles            int `json:"files_parsed"`
	ParsedFilesLines       int `json:"lines_parsed"`
	IgnoredFilesLines      int `json:"lines_ignored"`
	FailedToScanFiles      int `json:"files_failed_to_scan"`
	TotalQueries           int `json:"queries_total"`
	FailedToExecuteQueries int `json:"queries_failed_to_execute"`
	FoundResources         int `json:"resources_found"`
}

Counters hold information about how many files were scanned, parsed, failed to be scaned, the total of queries and how many queries failed to execute

type DiffAware

type DiffAware struct {
	Enabled      bool   `json:"enabled"`
	ConfigDigest string `json:"config_digest"`
	BaseSha      string `json:"base_sha"`
	Files        string `json:"files"`
}

DiffAware contains the necessary information to be able to perform a diff between two reports

type Document

type Document map[string]interface{}

Document

func (*Document) UnmarshalYAML

func (m *Document) UnmarshalYAML(ctx context.Context, value *yaml.Node, ignore *Ignore) error

UnmarshalYAML is a custom yaml parser that places line information in the payload

type Documents

type Documents struct {
	Documents []Document `json:"document"`
}

Documents

type Extensions

type Extensions map[string]struct{}

Extensions represents a list of supported extensions

func (Extensions) Include

func (e Extensions) Include(ext string) bool

Include returns true if an extension is included in supported extensions listed otherwise returns false

func (Extensions) MatchedFilesRegex

func (e Extensions) MatchedFilesRegex() string

MatchedFilesRegex returns the regex rule to identify if an extension is supported or not

type ExtractedPathObject

type ExtractedPathObject struct {
	Path      string
	LocalPath bool
}

ExtractedPathObject is the struct that contains the path location of extracted source and a boolean to check if it is a local source

type FileKind

type FileKind string

FileKind is the extension of a file

const (
	KindTerraform     FileKind = "TF"
	KindTerraformPlan FileKind = "TFPLAN"
	KindBICEP         FileKind = "BICEP"
	KindDOCKER        FileKind = "DOCKER"
	KindJSON          FileKind = "JSON"
	KindYAML          FileKind = "YAML"
	KindYML           FileKind = "YML"
	KindPROTO         FileKind = "PROTO"
	KindCOMMON        FileKind = "*"
	KindHELM          FileKind = "HELM"
	KindBUILDAH       FileKind = "SH"
	KindCFG           FileKind = "CFG"
	KindINI           FileKind = "INI"
)

Constants to describe what kind of file refers

type FileMetadata

type FileMetadata struct {
	ID               string `db:"id"`
	ScanID           string `db:"scan_id"`
	Document         Document
	LineInfoDocument map[string]interface{}

	OriginalData      string   `db:"orig_data"`
	Kind              FileKind `db:"kind"`
	FilePath          string   `db:"file_path"`
	HelmID            string
	IDInfo            map[int]interface{}
	Commands          CommentsCommands
	LinesIgnore       []int
	ResolvedFiles     map[string]ResolvedFile
	LinesOriginalData *[]string

	IsMinified bool

	// HelmInvocation identifies the source action that emitted a rendered Helm
	// resource whose YAML lives in a named template.
	HelmInvocation ResourceLine
	// ModuleCallChain: synthetic rows for instantiated local modules; used in SARIF fingerprint (Terraform only).
	ModuleCallChain string
	// ModuleAttributions maps resourceType.resourceName to attribution when a synthetic
	// document groups multiple module resources from the same file.
	ModuleAttributions map[string]*ModuleAttribution
	// Platform is the lowercased platform the file was classified as (e.g.
	// "ansible", "kubernetes", "terraform"); "" when undetermined. Used by the
	// engine to evaluate each query only against documents of its own platform.
	Platform string
	// contains filtered or unexported fields
}

FileMetadata is a representation of basic information and content of a file

func (*FileMetadata) DiscardLineInfoDocument added in v1.17.0

func (f *FileMetadata) DiscardLineInfoDocument()

DiscardLineInfoDocument drops a memoized line-info tree while keeping the loader so a later decode pass can rebuild it. No-op when line info was never lazily loaded: without a loader the tree could not be rebuilt, and writing the field outside the state mutex would race concurrent readers (UseLineInfoDocument reads it unlocked when no loader is configured).

func (*FileMetadata) EnsureLineInfoDocument added in v1.10.0

func (f *FileMetadata) EnsureLineInfoDocument(ctx context.Context) error

EnsureLineInfoDocument lazily materializes LineInfoDocument on first access, memoizing the result (or error) so repeat calls are cheap. Safe for concurrent callers. No-op when line info is already populated or unset.

func (*FileMetadata) Lines added in v1.16.0

func (f *FileMetadata) Lines() []string

Lines returns the file's content split into lines, computing it lazily from OriginalData on first access when SetLazyLines was configured. Safe for concurrent callers.

func (*FileMetadata) ReleasePostEvalData added in v1.16.0

func (f *FileMetadata) ReleasePostEvalData()

ReleasePostEvalData drops OriginalData and LinesOriginalData after eval — detectors have run and line-info documents are lazily reparsed — reclaiming the raw input content before the report phase.

func (*FileMetadata) SetLazyLines added in v1.16.0

func (f *FileMetadata) SetLazyLines()

SetLazyLines configures on-demand computation of LinesOriginalData from OriginalData on first access via Lines().

func (*FileMetadata) SetLineInfoLoader added in v1.10.0

func (f *FileMetadata) SetLineInfoLoader(
	loader func(ctx context.Context, fm *FileMetadata) (map[string]interface{}, error),
)

SetLineInfoLoader configures on-demand reconstruction of LineInfoDocument.

func (*FileMetadata) SetReleaseOriginalDataAfterLineInfo added in v1.16.0

func (f *FileMetadata) SetReleaseOriginalDataAfterLineInfo(release bool)

SetReleaseOriginalDataAfterLineInfo instructs EnsureLineInfoDocument to release OriginalData after populating LineInfoDocument and LinesOriginalData (for non-Terraform kinds).

func (*FileMetadata) ShallowCopy added in v1.10.0

func (f *FileMetadata) ShallowCopy() *FileMetadata

ShallowCopy returns a copy of f with independent lazy line-info memoization.

func (*FileMetadata) UseLineInfoDocument added in v1.17.0

func (f *FileMetadata) UseLineInfoDocument(ctx context.Context, fn func(map[string]interface{}) error) error

UseLineInfoDocument loads line info (when configured) and runs fn against it while holding the file's line-info lock, so concurrent decoders serialize on the file. The decode loop owns discarding trees between files (see DiscardLineInfoDocument); fn must not retain the map.

type FileMetadatas

type FileMetadatas []*FileMetadata

FileMetadatas is a slice of FileMetadata pointers

func (FileMetadatas) Combine

func (m FileMetadatas) Combine(ctx context.Context, lineInfo bool) Documents

Combine merge documents from FileMetadatas using the ID as reference for Document ID and FileName as reference for file

func (FileMetadatas) ToMap

func (m FileMetadatas) ToMap() map[string]*FileMetadata

ToMap creates a map of FileMetadatas, which the key is the FileMetadata ID and the value is a pointer to the FileMetadata

type FixContent

type FixContent struct {
	Text string `json:"text"`
}

type FixMessage

type FixMessage struct {
	Text string `json:"text"`
}

type FixReplacement

type FixReplacement struct {
	DeletedRegion   SarifRegion `json:"deletedRegion"`
	InsertedContent FixContent  `json:"insertedContent,omitempty"`
}

type Framework

type Framework struct {
	Framework        string `json:"framework"`
	FrameworkVersion string `json:"framework_version"`
	Requirement      string `json:"requirement"`
	Control          string `json:"control"`
}

Framework represents a framework mapping for a query

type HelmIDLineRange added in v1.14.0

type HelmIDLineRange struct {
	Start int
	End   int
}

HelmIDLineRange is the inclusive source-line range owned by a Helm marker.

type Ignore

type Ignore struct {
	// Lines is the lines to ignore
	Lines []int
}

Ignore is a struct that holds the lines to ignore

func (*Ignore) GetLines

func (i *Ignore) GetLines() []int

GetLines returns the lines to ignore

type LineObject

type LineObject struct {
	Line int                      `json:"_dd_line"`
	Arr  []map[string]*LineObject `json:"_dd_arr,omitempty"`
}

LineObject is the struct that will hold line information for each key

type ModuleAttribution added in v1.12.1

type ModuleAttribution struct {
	Name               string          `json:"name,omitempty"`
	Source             string          `json:"source,omitempty"`
	SourceType         string          `json:"source_type,omitempty"`
	Version            string          `json:"version,omitempty"`
	DependencyType     string          `json:"dependency_type,omitempty"`
	CallSite           SourceLocation  `json:"call_site,omitempty"`
	ModuleCodeLocation SourceLocation  `json:"code_location,omitempty"`
	ModulePath         []ModulePathHop `json:"module_path,omitempty"`
	ModuleCodeOwned    bool            `json:"-"`
}

ModuleAttribution carries module provenance for instantiated Terraform findings. CallSite is the call-site declaration the finding anchors on (SARIF primary location, IDE code bit); ModuleCodeLocation is the defining location inside the module, relative to the module root.

type ModuleAttributionSARIF added in v1.12.1

type ModuleAttributionSARIF struct {
	Name               string          `json:"name,omitempty"`
	Source             string          `json:"source,omitempty"`
	SourceType         string          `json:"source_type,omitempty"`
	Version            string          `json:"version,omitempty"`
	DependencyType     string          `json:"dependency_type,omitempty"`
	ModuleCodeLocation SourceLocation  `json:"code_location,omitempty"`
	ModulePath         []ModulePathHop `json:"module_path,omitempty"`
}

ModuleAttributionSARIF is the properties.module payload emitted for instantiated findings.

func ModuleAttributionForSARIF added in v1.12.1

func ModuleAttributionForSARIF(attr *ModuleAttribution) *ModuleAttributionSARIF

type ModulePathHop added in v1.12.1

type ModulePathHop struct {
	Name         string         `json:"name,omitempty"`
	Source       string         `json:"source,omitempty"`
	SourceType   string         `json:"source_type,omitempty"`
	Version      string         `json:"version,omitempty"`
	CodeLocation SourceLocation `json:"code_location,omitempty"`
}

ModulePathHop is one module call on the path to a finding.

type PathParameters

type PathParameters struct {
	ScannedPaths      []string
	PathExtractionMap map[string]ExtractedPathObject
}

PathParameters - structure wraps the required fields for temporary path translation

type QueryConfig

type QueryConfig struct {
	FileKind []FileKind
	Platform string
}

QueryConfig is a struct that contains the fileKind and platform of the rego query

type QueryMetadata

type QueryMetadata struct {
	InputData string
	Query     string
	Content   string
	Metadata  map[string]interface{}
	Platform  string
	CWE       string
	// special field for generic queries
	// represents how many queries are aggregated into a single rego file
	Aggregation  int
	Experimental bool
}

QueryMetadata is a representation of general information about a query

type QueryResult

type QueryResult struct {
	QueryName                   string           `json:"query_name"`
	QueryID                     string           `json:"query_id"`
	LegacyQueryID               string           `json:"legacy_query_id"`
	QueryURI                    string           `json:"query_url"`
	Severity                    Severity         `json:"severity"`
	Platform                    string           `json:"platform"`
	CWE                         string           `json:"cwe,omitempty"`
	CloudProvider               string           `json:"cloud_provider,omitempty"`
	Category                    string           `json:"category"`
	Experimental                bool             `json:"experimental"`
	Description                 string           `json:"description"`
	DescriptionID               string           `json:"description_id"`
	CISDescriptionIDFormatted   string           `json:"cis_description_id,omitempty"`
	CISDescriptionTitle         string           `json:"cis_description_title,omitempty"`
	CISDescriptionTextFormatted string           `json:"cis_description_text,omitempty"`
	CISDescriptionID            string           `json:"cis_description_id_raw,omitempty"`
	CISDescriptionText          string           `json:"cis_description_text_raw,omitempty"`
	CISRationaleText            string           `json:"cis_description_rationale,omitempty"`
	CISBenchmarkName            string           `json:"cis_benchmark_name,omitempty"`
	CISBenchmarkVersion         string           `json:"cis_benchmark_version,omitempty"`
	Frameworks                  []Framework      `json:"frameworks,omitempty"`
	Files                       []VulnerableFile `json:"files"`
}

QueryResult contains a query that tested positive ID, name, severity and a list of files that tested vulnerable

type QueryResultSlice

type QueryResultSlice []QueryResult

QueryResultSlice is a slice of QueryResult

type RepositoryCommitInfo

type RepositoryCommitInfo struct {
	RepositoryUrl string `json:"repository_url,omitempty"`
	Branch        string `json:"branch,omitempty"`
	CommitSHA     string `json:"sha,omitempty"`
}

type ResolvedFile

type ResolvedFile struct {
	Path         string
	Content      []byte
	LinesContent *[]string
}

ResolvedFile is a struct that contains the information of a resolved file, the path and the content in bytes of the file

type ResolvedFileSplit

type ResolvedFileSplit struct {
	Path  string
	Lines []string
}

ResolvedFileSplit is a struct that contains the information of a resolved file, the path and the lines of the file

type ResolvedFiles

type ResolvedFiles struct {
	File     []ResolvedHelm
	Excluded []string
}

ResolvedFiles keeps the information of all file/template resolved

type ResolvedHelm

type ResolvedHelm struct {
	FileName            string
	Content             []byte
	OriginalData        []byte
	SplitID             string
	SourceDocumentIndex int
	HelmInvocation      ResourceLine
	IDInfo              map[int]interface{}
	IsCRD               bool
}

ResolvedHelm keeps the information of a file/template resolved

type ResourceLine

type ResourceLine struct {
	Col  int
	Line int
}

ResourceLine is the line information of the resource with their respective positions

type ResourceLocation

type ResourceLocation struct {
	Start ResourceLine
	End   ResourceLine
}

ResourceLocation is the line information of the resource with their respective start and end positions

type SCIInfo

type SCIInfo struct {
	DiffAware            DiffAware
	RepositoryDir        string
	RepositoryCommitInfo RepositoryCommitInfo `json:"repository_commit_info"`
	OrgId                int64                `json:"org_id"`
}

type SarifFix

type SarifFix struct {
	ArtifactChanges []ArtifactChange `json:"artifactChanges"`
	Description     FixMessage       `json:"description"`
}

type SarifRegion

type SarifRegion struct {
	StartLine   int `json:"startLine"`
	EndLine     int `json:"endLine"`
	StartColumn int `json:"startColumn"`
	EndColumn   int `json:"endColumn"`
}

type SarifResourceLocation

type SarifResourceLocation struct {
	Line int `json:"line"`
	Col  int `json:"col"`
}

type Severity

type Severity string

Severity of the vulnerability

type SeveritySummary

type SeveritySummary struct {
	ScanID            string           `json:"scan_id"`
	SeverityCounters  map[Severity]int `json:"severity_counters"`
	TotalCounter      int              `json:"total_counter"`
	TotalBOMResources int              `json:"total_bom_resources"`
}

SeveritySummary contains scans' result numbers, how many vulnerabilities of each severity was detected

type SourceLocation added in v1.12.1

type SourceLocation struct {
	Filename    string `json:"filename,omitempty"`
	LineStart   int    `json:"line_start,omitempty"`
	LineEnd     int    `json:"line_end,omitempty"`
	ColumnStart int    `json:"column_start,omitempty"`
	ColumnEnd   int    `json:"column_end,omitempty"`
}

SourceLocation is a filename plus an inclusive line/column range.

type Summary

type Summary struct {
	Version string `json:"kics_version,omitempty"`
	Counters
	SeveritySummary
	Times
	ScannedPaths []string          `json:"paths"`
	Queries      QueryResultSlice  `json:"queries"`
	Bom          QueryResultSlice  `json:"bill_of_materials,omitempty"`
	FilePaths    map[string]string `json:"-"`
}

Summary is a report of a single scan

func CreateSummary

func CreateSummary(ctx context.Context, counters Counters, vulnerabilities []Vulnerability,
	scanID string, pathExtractionMap map[string]ExtractedPathObject, repoDir string, sciInfo SCIInfo) Summary

CreateSummary creates a report for a single scan, based on its scanID

func (*Summary) WithoutSuppressed added in v1.3.2

func (s *Summary) WithoutSuppressed() *Summary

WithoutSuppressed returns a shallow copy of the Summary with suppressed VulnerableFile entries removed from Queries and Bom; QueryResult entries whose Files become empty after filtering are dropped entirely.

SARIF reporting must continue to use the original Summary so suppressed findings can be emitted under the SARIF `suppressions` array. Every other report format (json, csv, gitlab_sast, sonarqube, asff, junit, pdf, html, cyclonedx, code_climate) has no notion of suppressions and would otherwise expose ignored findings that the CLI counters already filtered out.

type Times

type Times struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

Times represents an object that contains the start and end time of the scan

type Vulnerability

type Vulnerability struct {
	ID                    int              `json:"id"`
	ScanID                string           `db:"scan_id" json:"-"`
	FileID                string           `db:"file_id" json:"-"`
	FileName              string           `db:"file_name" json:"fileName"`
	QueryID               string           `db:"query_id" json:"queryID"`
	LegacyQueryID         string           `db:"legacy_query_id" json:"legacyQueryID"`
	QueryName             string           `db:"query_name" json:"queryName"`
	QueryURI              string           `json:"-"`
	Category              string           `json:"category"`
	Experimental          bool             `json:"experimental"`
	Description           string           `json:"description"`
	DescriptionID         string           `json:"descriptionID"`
	Platform              string           `db:"platform" json:"platform"`
	CWE                   string           `db:"cwe" json:"cwe"`
	Severity              Severity         `json:"severity"`
	Line                  int              `json:"line"`
	VulnerabilityLocation ResourceLocation `json:"resourceLocation"`
	VulnLines             *[]CodeLine      `json:"vulnLines"`
	ResourceType          string           `db:"resource_type" json:"resourceType"`
	ResourceName          string           `db:"resource_name" json:"resourceName"`
	SearchKey             string           `db:"search_key" json:"searchKey"`
	SearchLine            int              `db:"search_line" json:"searchLine"`
	SearchValue           string           `db:"search_value" json:"searchValue"`
	Value                 *string          `db:"value" json:"value"`
	Output                string           `json:"-"`
	CloudProvider         string           `json:"cloud_provider"`
	Remediation           string           `db:"remediation" json:"remediation"`
	RemediationType       string           `db:"remediation_type" json:"remediation_type"`
	RemediationLocation   ResourceLocation `json:"remediationLocation"`
	QueryDuration         time.Duration    `json:"query_duration"`
	LineWithVulnerability string           `json:"lineWithVulnerability"`
	ResourceSource        string           `json:"resourceSource"`
	FileSource            []string         `json:"fileSource"`
	BlockLocation         ResourceLocation `json:"blockLocation"`
	Frameworks            []Framework      `json:"frameworks,omitempty"`
	// IsSuppressed marks a finding as kept-for-SARIF but excluded from
	// severity counters; the kind/justification map directly to SARIF
	// `suppressions[]`.
	IsSuppressed             bool   `json:"isSuppressed,omitempty"`
	SuppressionKind          string `json:"suppressionKind,omitempty"`
	SuppressionJustification string `json:"suppressionJustification,omitempty"`
	// ModuleCallChain: local-module instantiation path; empty for root resources; folded into fingerprint.
	ModuleCallChain string `json:"moduleCallChain,omitempty"`
	// ModuleAttribution: provenance for instantiated module findings, serialized
	// so content-push consumers can anchor them on the call site like SARIF does.
	ModuleAttribution *ModuleAttribution `json:"moduleAttribution,omitempty"`
}

Vulnerability is a representation of a detected vulnerability in scanned files after running a query

type VulnerabilityLines

type VulnerabilityLines struct {
	Line                   int
	VulnLines              *[]CodeLine
	LineWithVulnerability  string
	ResolvedFile           string
	VulnerablilityLocation ResourceLocation
	RemediationLocation    ResourceLocation
	ResourceSource         string
	FileSource             []string
	BlockLocation          ResourceLocation
}

VulnerabilityLines is the representation of the found line for issue

type VulnerableFile

type VulnerableFile struct {
	FileName              string           `json:"file_name"`
	Fingerprint           string           `json:"fingerprint,omitempty"`
	Line                  int              `json:"line"`
	ResourceLocation      ResourceLocation `json:"resource_location"`
	VulnLines             *[]CodeLine      `json:"-"`
	ResourceType          string           `json:"resource_type,omitempty"`
	ResourceName          string           `json:"resource_name,omitempty"`
	SearchKey             string           `json:"search_key"`
	SearchLine            int              `json:"search_line"`
	SearchValue           string           `json:"search_value"`
	Value                 *string          `json:"value,omitempty"`
	Remediation           string           `json:"remediation,omitempty"`
	RemediationType       string           `json:"remediation_type,omitempty"`
	RemediationLocation   ResourceLocation `json:"remediation_location,omitempty"`
	LineWithVulnerability string           `json:"line_content,omitempty"`
	ResourceSource        string           `json:"resource_source,omitempty"`
	FileSource            []string         `json:"file_source,omitempty"`
	BlockLocation         ResourceLocation `json:"block_location,omitempty"`
	// Suppression metadata; see Vulnerability.IsSuppressed.
	IsSuppressed             bool   `json:"is_suppressed,omitempty"`
	SuppressionKind          string `json:"suppression_kind,omitempty"`
	SuppressionJustification string `json:"suppression_justification,omitempty"`
	// ModuleCallChain: local-module call path; empty for root; included in fingerprint.
	ModuleCallChain string `json:"module_call_chain,omitempty"`
	// ModuleAttribution: declaration and body locations for instantiated module findings.
	ModuleAttribution *ModuleAttribution `json:"-"`
}

VulnerableFile contains information of a vulnerable file and where the vulnerability was found

Jump to

Keyboard shortcuts

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