core

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Targets       []string `yaml:"targets" json:"targets"`
	EnableSAST    bool     `yaml:"enable_sast" json:"enable_sast"`
	EnableSCA     bool     `yaml:"enable_sca" json:"enable_sca"`
	EnableSecrets bool     `yaml:"enable_secrets" json:"enable_secrets"`

	Workers     int   `yaml:"workers" json:"workers"`
	MaxFileSize int64 `yaml:"max_file_size" json:"max_file_size"`

	OutputFormat string `yaml:"output_format" json:"output_format"`
	OutputFile   string `yaml:"output_file" json:"output_file"`

	MinSeverity    Severity `yaml:"min_severity" json:"min_severity"`
	ExcludePaths   []string `yaml:"exclude_paths" json:"exclude_paths"`
	IncludeRuleIDs []string `yaml:"include_rule_ids" json:"include_rule_ids"`
	ExcludeRuleIDs []string `yaml:"exclude_rule_ids" json:"exclude_rule_ids"`

	SecretsRulesDir  string `yaml:"secrets_rules_dir" json:"secrets_rules_dir"`
	DisableRedaction bool   `yaml:"disable_redaction" json:"disable_redaction"`
	ValidateSecrets  bool   `yaml:"validate_secrets" json:"validate_secrets"`

	Offline           bool     `yaml:"offline" json:"offline"`
	Languages         []string `yaml:"languages" json:"languages"`
	AIModel           string   `yaml:"ai_model" json:"ai_model"`
	AIFilterSecrets   bool     `yaml:"ai_filter_secrets" json:"ai_filter_secrets"`
	AISCAReachability bool     `yaml:"ai_sca_reachability" json:"ai_sca_reachability"`
	BaselineFile      string   `yaml:"baseline_file" json:"baseline_file"`
	Quiet             bool     `yaml:"quiet" json:"quiet"`
}

type Finding

type Finding struct {
	ID          string   `json:"id"`
	Type        ScanType `json:"type"`
	RuleID      string   `json:"rule_id"`
	RuleName    string   `json:"rule_name"`
	Severity    Severity `json:"severity"`
	Confidence  string   `json:"confidence,omitempty"`
	Title       string   `json:"title"`
	Description string   `json:"description"`

	FilePath    string `json:"file_path"`
	StartLine   int    `json:"start_line"`
	EndLine     int    `json:"end_line"`
	StartColumn int    `json:"start_column,omitempty"`
	EndColumn   int    `json:"end_column,omitempty"`
	Snippet     string `json:"snippet,omitempty"`

	PackageName    string  `json:"package_name,omitempty"`
	PackageVersion string  `json:"package_version,omitempty"`
	Ecosystem      string  `json:"ecosystem,omitempty"`
	FixedVersion   string  `json:"fixed_version,omitempty"`
	CVE            string  `json:"cve,omitempty"`
	CVSSScore      float64 `json:"cvss_score,omitempty"`
	Advisory       string  `json:"advisory_url,omitempty"`

	Redacted string  `json:"redacted,omitempty"`
	Entropy  float64 `json:"entropy,omitempty"`

	CWE         []string  `json:"cwe,omitempty"`
	References  []string  `json:"references,omitempty"`
	Tags        []string  `json:"tags,omitempty"`
	Fingerprint string    `json:"fingerprint"`
	Timestamp   time.Time `json:"timestamp"`
}

func (*Finding) ComputeFingerprint

func (f *Finding) ComputeFingerprint()

ComputeFingerprint sets a deduplication hash. Changes when file path or line changes.

type ScanMetrics

type ScanMetrics struct {
	FilesScanned  int64 `json:"files_scanned"`
	FilesSkipped  int64 `json:"files_skipped"`
	TotalBytes    int64 `json:"total_bytes"`
	FindingsCount int   `json:"findings_count"`
	RulesLoaded   int   `json:"rules_loaded"`
}

type ScanResult

type ScanResult struct {
	Findings  []Finding     `json:"findings"`
	Metrics   ScanMetrics   `json:"metrics"`
	Duration  time.Duration `json:"duration_ms"`
	ScanTypes []ScanType    `json:"scan_types"`
}

type ScanType

type ScanType string
const (
	ScanTypeSAST    ScanType = "sast"
	ScanTypeSCA     ScanType = "sca"
	ScanTypeSecrets ScanType = "secrets"
)

type Scanner

type Scanner interface {
	Name() string
	Type() ScanType
	Init(cfg *Config) error
	Scan(ctx context.Context, paths []string, findings chan<- Finding) error
	Close() error
}

type Severity

type Severity int
const (
	SeverityInfo Severity = iota
	SeverityLow
	SeverityMedium
	SeverityHigh
	SeverityCritical
)

func ParseSeverity

func ParseSeverity(s string) Severity

func SeverityFromCVSS

func SeverityFromCVSS(score float64) Severity

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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