analyzer

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

Analyzer orchestrates the security scanning process

func New

func New(cfg *config.Config) (*Analyzer, error)

New creates a new analyzer instance

func (*Analyzer) AnalyzeDependency

func (a *Analyzer) AnalyzeDependency(dep types.Dependency, popularPackages []string) ([]types.Threat, []types.Warning)

AnalyzeDependency analyzes a single dependency for threats

func (*Analyzer) Scan

func (a *Analyzer) Scan(path string, options *ScanOptions) (*ScanResult, error)

Scan performs a security scan of the specified path

type Conflict

type Conflict struct {
	PackageName         string        `json:"packageName"`
	ConflictingVersions []VersionInfo `json:"conflictingVersions"`
	Severity            string        `json:"severity"`
	Description         string        `json:"description"`
}

Conflict represents a dependency version conflict

type DependencyResolver

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

DependencyResolver handles dependency resolution and conflict detection

func NewDependencyResolver

func NewDependencyResolver(config *config.ScannerConfig) *DependencyResolver

NewDependencyResolver creates a new dependency resolver

func (*DependencyResolver) ResolveDependencies

func (r *DependencyResolver) ResolveDependencies(dependencies []types.Dependency) (*ResolutionResult, error)

ResolveDependencies analyzes dependencies and detects conflicts

type ResolutionResult

type ResolutionResult struct {
	Resolved  []types.Dependency `json:"resolved"`
	Conflicts []Conflict         `json:"conflicts"`
	Warnings  []Warning          `json:"warnings"`
}

ResolutionResult contains the results of dependency resolution

type ScanOptions

type ScanOptions struct {
	OutputFormat           string
	SpecificFile           string
	DeepAnalysis           bool
	IncludeDevDependencies bool
	SimilarityThreshold    float64
	ExcludePackages        []string
	AllowEmptyProjects     bool
	CheckVulnerabilities   bool
	VulnerabilityDBs       []string
	VulnConfigPath         string
}

ScanOptions contains options for scanning

type ScanResult

type ScanResult struct {
	ScanID        string                 `json:"scan_id"`
	Timestamp     time.Time              `json:"timestamp"`
	Duration      time.Duration          `json:"duration"`
	Path          string                 `json:"path"`
	TotalPackages int                    `json:"total_packages"`
	Threats       []types.Threat         `json:"threats"`
	Warnings      []types.Warning        `json:"warnings"`
	Resolution    *ResolutionResult      `json:"resolution,omitempty"`
	Summary       ScanSummary            `json:"summary"`
	Metadata      map[string]interface{} `json:"metadata"`
}

ScanResult contains the results of a security scan

func (*ScanResult) OutputConsole

func (r *ScanResult) OutputConsole(w io.Writer) error

OutputConsole outputs scan results in human-readable console format

func (*ScanResult) OutputHTML

func (r *ScanResult) OutputHTML(w io.Writer) error

OutputHTML outputs scan results in HTML format

func (*ScanResult) OutputJSON

func (r *ScanResult) OutputJSON(w io.Writer) error

OutputJSON outputs scan results in JSON format

type ScanSummary

type ScanSummary struct {
	CriticalThreats int `json:"critical_threats"`
	HighThreats     int `json:"high_threats"`
	MediumThreats   int `json:"medium_threats"`
	LowThreats      int `json:"low_threats"`
	TotalWarnings   int `json:"total_warnings"`
	CleanPackages   int `json:"clean_packages"`
	ConflictCount   int `json:"conflict_count"`
}

ScanSummary provides a high-level overview of scan results

type VersionInfo

type VersionInfo struct {
	Version    string `json:"version"`
	Constraint string `json:"constraint"`
	Source     string `json:"source"`
	Direct     bool   `json:"direct"`
}

VersionInfo contains version and source information

type Warning

type Warning struct {
	Type        string `json:"type"`
	PackageName string `json:"packageName"`
	Message     string `json:"message"`
	Severity    string `json:"severity"`
}

Warning represents a dependency resolution warning

Jump to

Keyboard shortcuts

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