results

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

internal/results/enrich.go

File: internal/results/pipeline.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CWEProvider

type CWEProvider interface {
	GetFullName(ctx context.Context, cweID string) (string, bool)
}

Defines an interface for CWE data retrieval. REFACTORED: Updated interface to accept context.Context for cancellation/timeout propagation.

type Enricher

type Enricher struct {
	// contains filtered or unexported fields
}

Enricher is responsible for enhancing findings with additional context.

func NewEnricher

func NewEnricher(cweProvider providers.CWEProvider, logger *zap.Logger) *Enricher

NewEnricher creates a new Enricher instance.

func (*Enricher) EnrichFinding

func (e *Enricher) EnrichFinding(finding *schemas.Finding)

EnrichFinding enhances a single finding.

type NormalizedFinding

type NormalizedFinding struct {
	schemas.Finding
	Score              float64
	NormalizedSeverity string
}

Represents a finding that has been standardized.

func Normalize

func Normalize(finding schemas.Finding) NormalizedFinding

Converts a raw finding into a normalized finding. REFACTORED: It now maps the raw severity string to a canonical StandardSeverity.

type Pipeline

type Pipeline struct {
	// contains filtered or unexported fields
}

Pipeline manages the processing of raw findings into a final report.

func NewPipeline

func NewPipeline(store schemas.Store, logger *zap.Logger) *Pipeline

NewPipeline creates a new results processing pipeline.

func (*Pipeline) ProcessScanResults

func (p *Pipeline) ProcessScanResults(ctx context.Context, scanID string) (*Report, error)

ProcessScanResults retrieves, normalizes, enriches, and prioritizes findings for a scan.

type PipelineConfig

type PipelineConfig struct {
	ScoreConfig ScoreConfig
	// CWEProvider is optional. If nil, enrichment will be skipped.
	CWEProvider CWEProvider
}

Holds all configuration required for the results pipeline. REFACTORED: Introduced to centralize configuration and dependencies.

type Report

type Report struct {
	ScanID   string            `json:"scan_id"`
	Findings []schemas.Finding `json:"findings"`
	Summary  map[string]int    `json:"summary"`
}

Report represents the final aggregated scan report.

func (*Report) ToJSON

func (r *Report) ToJSON() ([]byte, error)

ToJSON serializes the report to a JSON byte slice.

type ScoreConfig

type ScoreConfig struct {
	// Keys should correspond to the canonical StandardSeverity strings.
	SeverityWeights map[string]float64
}

Defines the parameters for the prioritization process.

type StandardSeverity

type StandardSeverity string

Defines canonical severity levels used internally.

const (
	SeverityCritical StandardSeverity = "CRITICAL"
	SeverityHigh     StandardSeverity = "HIGH"
	SeverityMedium   StandardSeverity = "MEDIUM"
	SeverityLow      StandardSeverity = "LOW"
	SeverityInfo     StandardSeverity = "INFO"
	SeverityUnknown  StandardSeverity = "UNKNOWN"
)

Directories

Path Synopsis
internal/results/providers/cwe_provider.go
internal/results/providers/cwe_provider.go

Jump to

Keyboard shortcuts

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