scanner

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package scanner handles project detection, dependency extraction, and threat analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzerContext

type AnalyzerContext struct {
	Context context.Context
	Config  *config.Config
	Logger  Logger
}

AnalyzerContext provides context for analyzer operations

type AnalyzerMetadata

type AnalyzerMetadata struct {
	Name         string   `json:"name"`
	Version      string   `json:"version"`
	Description  string   `json:"description"`
	Author       string   `json:"author"`
	Languages    []string `json:"languages"`
	Capabilities []string `json:"capabilities"`
	Requirements []string `json:"requirements"`
}

AnalyzerMetadata contains information about an analyzer

type AnalyzerRegistry

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

AnalyzerRegistry manages all registered language analyzers

func NewAnalyzerRegistry

func NewAnalyzerRegistry(cfg *config.Config) *AnalyzerRegistry

NewAnalyzerRegistry creates a new analyzer registry

func (*AnalyzerRegistry) GetAllAnalyzers

func (r *AnalyzerRegistry) GetAllAnalyzers() map[string]LanguageAnalyzer

GetAllAnalyzers returns all registered analyzers

func (*AnalyzerRegistry) GetAnalyzer

func (r *AnalyzerRegistry) GetAnalyzer(name string) (LanguageAnalyzer, bool)

GetAnalyzer retrieves an analyzer by name

func (*AnalyzerRegistry) GetAnalyzerForProject

func (r *AnalyzerRegistry) GetAnalyzerForProject(projectInfo *ProjectInfo) (LanguageAnalyzer, error)

GetAnalyzerForProject finds the best analyzer for a given project

func (*AnalyzerRegistry) GetPluginAnalyzers

func (r *AnalyzerRegistry) GetPluginAnalyzers() map[string]*PluginAnalyzer

GetPluginAnalyzers returns all plugin-based analyzers

func (*AnalyzerRegistry) LoadPlugin

func (r *AnalyzerRegistry) LoadPlugin(pluginPath string) error

LoadPlugin loads an analyzer from a plugin file

func (*AnalyzerRegistry) RegisterAnalyzer

func (r *AnalyzerRegistry) RegisterAnalyzer(analyzer LanguageAnalyzer) error

RegisterAnalyzer registers a built-in analyzer

func (*AnalyzerRegistry) UnloadPlugin

func (r *AnalyzerRegistry) UnloadPlugin(name string) error

UnloadPlugin unloads a plugin analyzer

func (*AnalyzerRegistry) ValidateAnalyzer

func (r *AnalyzerRegistry) ValidateAnalyzer(analyzer LanguageAnalyzer) error

ValidateAnalyzer checks if an analyzer implements the interface correctly

type AuthenticityValidation

type AuthenticityValidation struct {
	IsAuthentic bool     `json:"is_authentic"`
	Evidence    []string `json:"evidence"`
	Confidence  float64  `json:"confidence"`
}

type BaseAnalyzer

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

BaseAnalyzer provides common functionality for analyzers

func NewBaseAnalyzer

func NewBaseAnalyzer(name string, extensions, supportedFiles []string, metadata *AnalyzerMetadata, config *config.Config) *BaseAnalyzer

NewBaseAnalyzer creates a new base analyzer

func (*BaseAnalyzer) GetMetadata

func (b *BaseAnalyzer) GetMetadata() *AnalyzerMetadata

GetMetadata returns analyzer metadata

func (*BaseAnalyzer) GetName

func (b *BaseAnalyzer) GetName() string

GetName returns the analyzer name

func (*BaseAnalyzer) GetSupportedExtensions

func (b *BaseAnalyzer) GetSupportedExtensions() []string

GetSupportedExtensions returns supported file extensions

func (*BaseAnalyzer) GetSupportedFiles

func (b *BaseAnalyzer) GetSupportedFiles() []string

GetSupportedFiles returns supported filenames

func (*BaseAnalyzer) ValidateProject

func (b *BaseAnalyzer) ValidateProject(projectInfo *ProjectInfo) error

ValidateProject provides basic project validation

type BehaviorAnomaly

type BehaviorAnomaly struct {
	Type        string  `json:"type"`
	Description string  `json:"description"`
	Score       float64 `json:"score"`
	Severity    string  `json:"severity"`
}

type BehaviorPattern

type BehaviorPattern struct {
	Type        string  `json:"type"`
	Description string  `json:"description"`
	Frequency   int     `json:"frequency"`
	Confidence  float64 `json:"confidence"`
}

type BehavioralAnalysis

type BehavioralAnalysis struct {
	BehaviorPatterns []BehaviorPattern      `json:"behavior_patterns"`
	Anomalies        []BehaviorAnomaly      `json:"anomalies"`
	RiskScore        float64                `json:"risk_score"`
	Metadata         map[string]interface{} `json:"metadata"`
	AnalyzedAt       time.Time              `json:"analyzed_at"`
}

type BuildArtifact

type BuildArtifact struct {
	Name     string `json:"name"`
	Path     string `json:"path"`
	Checksum string `json:"checksum"`
	Size     int64  `json:"size"`
}

type BuildIntegrityDetector

type BuildIntegrityDetector interface {
	AnalyzeBuildIntegrity(ctx context.Context, pkg *types.Package) ([]BuildIntegrityFinding, error)
	ValidatePackageSignature(ctx context.Context, pkg *types.Package) (*SignatureValidation, error)
	DetectTampering(ctx context.Context, pkg *types.Package) ([]TamperingEvidence, error)
	AnalyzeBuildProcess(ctx context.Context, pkg *types.Package) (*BuildProcessAnalysis, error)
}

BuildIntegrityDetector interface for detecting build integrity issues

type BuildIntegrityFinding

type BuildIntegrityFinding struct {
	ID          string                 `json:"id"`
	Type        string                 `json:"type"`
	Severity    types.Severity         `json:"severity"`
	Description string                 `json:"description"`
	Evidence    []types.Evidence       `json:"evidence"`
	Confidence  float64                `json:"confidence"`
	Metadata    map[string]interface{} `json:"metadata"`
	DetectedAt  time.Time              `json:"detected_at"`
}

type BuildProcessAnalysis

type BuildProcessAnalysis struct {
	BuildSystem    string                 `json:"build_system"`
	BuildSteps     []BuildStep            `json:"build_steps"`
	Artifacts      []BuildArtifact        `json:"artifacts"`
	SecurityIssues []SecurityIssue        `json:"security_issues"`
	Metadata       map[string]interface{} `json:"metadata"`
	AnalyzedAt     time.Time              `json:"analyzed_at"`
}

type BuildStep

type BuildStep struct {
	Name        string                 `json:"name"`
	Command     string                 `json:"command"`
	Environment map[string]string      `json:"environment"`
	Metadata    map[string]interface{} `json:"metadata"`
}

type BundlerGemInfo

type BundlerGemInfo struct {
	Name         string
	Version      string
	Dependencies []string
	Source       string
	Platforms    []string
}

BundlerGemInfo represents gem information from Bundler

type BundlerLockInfo

type BundlerLockInfo struct {
	BundlerVersion string
	RubyVersion    string
	Gems           map[string]*BundlerGemInfo
	Platforms      []string
	Sources        []string
}

BundlerLockInfo represents parsed Bundler lock information

type CSProj

type CSProj struct {
	XMLName        xml.Name        `xml:"Project"`
	Sdk            string          `xml:"Sdk,attr"`
	PropertyGroups []PropertyGroup `xml:"PropertyGroup"`
	ItemGroups     []ItemGroup     `xml:"ItemGroup"`
	Targets        []Target        `xml:"Target"`
}

Project file structures

type CacheConfig

type CacheConfig struct {
	MemoryTTL     time.Duration
	FSTTL         time.Duration
	MaxMemorySize int64
	MaxFSSize     int64
	CacheDir      string
}

CacheConfig holds cache configuration

type CacheEntry

type CacheEntry struct {
	Key       string
	Value     interface{}
	CreatedAt time.Time
	TTL       time.Duration
	Size      int64
}

CacheEntry represents a cached item

type CacheManager

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

CacheManager handles multi-level caching

func NewCacheManager

func NewCacheManager(config *CacheConfig) *CacheManager

NewCacheManager creates a new cache manager

func (*CacheManager) Get

func (cm *CacheManager) Get(key string) (interface{}, bool)

Get retrieves a value from cache

func (*CacheManager) Set

func (cm *CacheManager) Set(key string, value interface{})

Set stores a value in cache

type CargoLock

type CargoLock struct {
	Packages []CargoLockPackage `toml:"package"`
}

CargoLock represents the structure of Cargo.lock

type CargoLockPackage

type CargoLockPackage struct {
	Name         string   `toml:"name"`
	Version      string   `toml:"version"`
	Source       string   `toml:"source"`
	Checksum     string   `toml:"checksum"`
	Dependencies []string `toml:"dependencies"`
}

type CargoPackage

type CargoPackage struct {
	Name    string `toml:"name"`
	Version string `toml:"version"`
}

type CargoToml

type CargoToml struct {
	Package           CargoPackage           `toml:"package"`
	Dependencies      map[string]interface{} `toml:"dependencies"`
	DevDependencies   map[string]interface{} `toml:"dev-dependencies"`
	BuildDependencies map[string]interface{} `toml:"build-dependencies"`
}

CargoToml represents the structure of Cargo.toml

type CodeAnomaly

type CodeAnomaly struct {
	Type        string                 `json:"type"`
	Location    string                 `json:"location"`
	Description string                 `json:"description"`
	Severity    types.Severity         `json:"severity"`
	Score       float64                `json:"score"`
	Evidence    []types.Evidence       `json:"evidence"`
	Metadata    map[string]interface{} `json:"metadata"`
}

type Compile

type Compile struct {
	Include string `xml:"Include,attr"`
}

type CompileAsset

type CompileAsset struct {
	Related []string `json:"related"`
}

type ComposerAuthor

type ComposerAuthor struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Homepage string `json:"homepage"`
	Role     string `json:"role"`
}

type ComposerAutoload

type ComposerAutoload struct {
	Psr4                map[string]interface{} `json:"psr-4"`
	Psr0                map[string]interface{} `json:"psr-0"`
	Classmap            []string               `json:"classmap"`
	Files               []string               `json:"files"`
	ExcludeFromClassmap []string               `json:"exclude-from-classmap"`
}

type ComposerDist

type ComposerDist struct {
	Type      string `json:"type"`
	URL       string `json:"url"`
	Reference string `json:"reference"`
	Shasum    string `json:"shasum"`
}

type ComposerJSON

type ComposerJSON struct {
	Name             string                 `json:"name"`
	Version          string                 `json:"version"`
	Description      string                 `json:"description"`
	Type             string                 `json:"type"`
	Keywords         []string               `json:"keywords"`
	Homepage         string                 `json:"homepage"`
	License          interface{}            `json:"license"`
	Authors          []ComposerAuthor       `json:"authors"`
	Require          map[string]string      `json:"require"`
	RequireDev       map[string]string      `json:"require-dev"`
	Suggest          map[string]string      `json:"suggest"`
	Provide          map[string]string      `json:"provide"`
	Conflict         map[string]string      `json:"conflict"`
	Replace          map[string]string      `json:"replace"`
	Autoload         ComposerAutoload       `json:"autoload"`
	AutoloadDev      ComposerAutoload       `json:"autoload-dev"`
	Repositories     []ComposerRepository   `json:"repositories"`
	Config           map[string]interface{} `json:"config"`
	Scripts          map[string]interface{} `json:"scripts"`
	Extra            map[string]interface{} `json:"extra"`
	MinimumStability string                 `json:"minimum-stability"`
	PreferStable     bool                   `json:"prefer-stable"`
}

ComposerJSON represents the structure of composer.json

type ComposerLock

type ComposerLock struct {
	Readme           []string               `json:"_readme"`
	ContentHash      string                 `json:"content-hash"`
	Packages         []ComposerLockPackage  `json:"packages"`
	PackagesDev      []ComposerLockPackage  `json:"packages-dev"`
	Aliases          []interface{}          `json:"aliases"`
	MinimumStability string                 `json:"minimum-stability"`
	StabilityFlags   map[string]interface{} `json:"stability-flags"`
	PreferStable     bool                   `json:"prefer-stable"`
	PreferLowest     bool                   `json:"prefer-lowest"`
	Platform         map[string]string      `json:"platform"`
	PlatformDev      map[string]string      `json:"platform-dev"`
	PluginAPIVersion string                 `json:"plugin-api-version"`
}

ComposerLock represents the structure of composer.lock

type ComposerLockPackage

type ComposerLockPackage struct {
	Name            string            `json:"name"`
	Version         string            `json:"version"`
	Source          ComposerSource    `json:"source"`
	Dist            ComposerDist      `json:"dist"`
	Require         map[string]string `json:"require"`
	RequireDev      map[string]string `json:"require-dev"`
	Conflict        map[string]string `json:"conflict"`
	Replace         map[string]string `json:"replace"`
	Provide         map[string]string `json:"provide"`
	Suggest         map[string]string `json:"suggest"`
	Type            string            `json:"type"`
	Autoload        ComposerAutoload  `json:"autoload"`
	NotificationURL string            `json:"notification-url"`
	License         []string          `json:"license"`
	Authors         []ComposerAuthor  `json:"authors"`
	Description     string            `json:"description"`
	Homepage        string            `json:"homepage"`
	Keywords        []string          `json:"keywords"`
	Support         map[string]string `json:"support"`
	Time            string            `json:"time"`
}

type ComposerRepository

type ComposerRepository struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

type ComposerSource

type ComposerSource struct {
	Type      string `json:"type"`
	URL       string `json:"url"`
	Reference string `json:"reference"`
}

type ConfusionThreat

type ConfusionThreat struct {
	Package        string         `json:"package"`
	ConfusedWith   string         `json:"confused_with"`
	Severity       types.Severity `json:"severity"`
	Description    string         `json:"description"`
	Recommendation string         `json:"recommendation"`
}

type Content

type Content struct {
	Include string `xml:"Include,attr"`
}

type CriticalPath added in v1.0.1

type CriticalPath struct {
	Path            []string `json:"path"`
	Depth           int      `json:"depth"`
	RiskScore       float64  `json:"risk_score"`
	Vulnerabilities []string `json:"vulnerabilities"`
	ImpactRadius    int      `json:"impact_radius"`
	Criticality     string   `json:"criticality"`
}

CriticalPath represents a high-risk dependency path

type DeepDependency added in v1.0.1

type DeepDependency struct {
	PackageName     string                 `json:"package_name"`
	Depth           int                    `json:"depth"`
	Paths           [][]string             `json:"paths"`
	RiskScore       float64                `json:"risk_score"`
	ComplexityScore float64                `json:"complexity_score"`
	Maintenance     MaintenanceInfo        `json:"maintenance"`
	Metadata        map[string]interface{} `json:"metadata"`
}

DeepDependency represents a dependency at significant depth

type Dependency

type Dependency struct {
	Target         string `json:"target"`
	Version        string `json:"version"`
	AutoReferenced bool   `json:"autoReferenced"`
	Include        string `json:"include"`
	Exclude        string `json:"exclude"`
	SuppressParent string `json:"suppressParent"`
	PrivateAssets  string `json:"privateAssets"`
	IncludeAssets  string `json:"includeAssets"`
	ExcludeAssets  string `json:"excludeAssets"`
}

type DependencyAnalyzer

type DependencyAnalyzer interface {
	AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)
	ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)
}

DependencyAnalyzer interface for analyzing dependencies

type DependencyDepthAnalyzer added in v1.0.1

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

DependencyDepthAnalyzer provides comprehensive dependency depth analysis

func NewDependencyDepthAnalyzer added in v1.0.1

func NewDependencyDepthAnalyzer(cfg *config.DependencyGraphConfig, log *logger.Logger) *DependencyDepthAnalyzer

NewDependencyDepthAnalyzer creates a new depth analyzer instance

func (*DependencyDepthAnalyzer) AnalyzeDependencyDepth added in v1.0.1

func (dda *DependencyDepthAnalyzer) AnalyzeDependencyDepth(ctx context.Context, graph *DependencyGraph) (*DepthAnalysisResult, error)

AnalyzeDependencyDepth performs comprehensive depth analysis

type DependencyEdge

type DependencyEdge struct {
	From         string                 `json:"from"`
	To           string                 `json:"to"`
	RelationType string                 `json:"relation_type"`
	Constraints  string                 `json:"constraints"`
	Metadata     map[string]interface{} `json:"metadata"`
}

type DependencyGraph

type DependencyGraph struct {
	Nodes []DependencyNode `json:"nodes"`
	Edges []DependencyEdge `json:"edges"`
	Depth int              `json:"depth"`
	Stats GraphStatistics  `json:"stats"`
}

type DependencyGraphAnalyzer

type DependencyGraphAnalyzer interface {
	BuildDependencyGraph(ctx context.Context, packages []*types.Package) (*DependencyGraph, error)
	AnalyzeTransitiveDependencies(ctx context.Context, graph *DependencyGraph) ([]TransitiveThreat, error)
	DetectDependencyConfusion(ctx context.Context, graph *DependencyGraph) ([]ConfusionThreat, error)
	AnalyzeSupplyChainRisk(ctx context.Context, graph *DependencyGraph) (*SupplyChainRiskAnalysis, error)
}

DependencyGraphAnalyzer interface for analyzing dependency relationships

type DependencyNode

type DependencyNode struct {
	ID       string                 `json:"id"`
	Package  *types.Package         `json:"package"`
	Level    int                    `json:"level"`
	Direct   bool                   `json:"direct"`
	RiskData *NodeRiskData          `json:"risk_data"`
	Metadata map[string]interface{} `json:"metadata"`
}

type DepthAnalysisResult added in v1.0.1

type DepthAnalysisResult struct {
	MaxDepth          int                    `json:"max_depth"`
	AverageDepth      float64                `json:"average_depth"`
	DepthDistribution map[int]int            `json:"depth_distribution"`
	CriticalPaths     []CriticalPath         `json:"critical_paths"`
	DeepDependencies  []DeepDependency       `json:"deep_dependencies"`
	RiskByDepth       map[int]float64        `json:"risk_by_depth"`
	TransitiveRisks   []TransitiveRisk       `json:"transitive_risks"`
	DepthMetrics      DepthMetrics           `json:"depth_metrics"`
	Recommendations   []string               `json:"recommendations"`
	AnalysisMetadata  map[string]interface{} `json:"analysis_metadata"`
	AnalyzedAt        time.Time              `json:"analyzed_at"`
}

DepthAnalysisResult contains comprehensive depth analysis results

type DepthMetrics added in v1.0.1

type DepthMetrics struct {
	TotalPackages      int     `json:"total_packages"`
	DirectDependencies int     `json:"direct_dependencies"`
	TransitiveDeps     int     `json:"transitive_dependencies"`
	MaxDepth           int     `json:"max_depth"`
	AverageDepth       float64 `json:"average_depth"`
	MedianDepth        float64 `json:"median_depth"`
	DepthVariance      float64 `json:"depth_variance"`
	ComplexityIndex    float64 `json:"complexity_index"`
	RiskConcentration  float64 `json:"risk_concentration"`
}

DepthMetrics contains statistical metrics about dependency depths

type DotNetAnalyzer

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

DotNetAnalyzer analyzes .NET projects

func NewDotNetAnalyzer

func NewDotNetAnalyzer(cfg *config.Config) *DotNetAnalyzer

func (*DotNetAnalyzer) AnalyzeDependencies

func (a *DotNetAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*DotNetAnalyzer) ExtractPackages

func (a *DotNetAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type DotNetDetector

type DotNetDetector struct{}

DotNetDetector detects .NET projects

func (*DotNetDetector) Detect

func (d *DotNetDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*DotNetDetector) GetManifestFiles

func (d *DotNetDetector) GetManifestFiles() []string

func (*DotNetDetector) GetProjectType

func (d *DotNetDetector) GetProjectType() string

type DotNetPackageAnalyzer

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

DotNetPackageAnalyzer analyzes .NET projects

func NewDotNetPackageAnalyzer

func NewDotNetPackageAnalyzer(cfg *config.Config) *DotNetPackageAnalyzer

NewDotNetPackageAnalyzer creates a new .NET analyzer

func (*DotNetPackageAnalyzer) AnalyzeDependencies

func (a *DotNetPackageAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*DotNetPackageAnalyzer) ExtractPackages

func (a *DotNetPackageAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type EnhancedGoAnalyzer

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

EnhancedGoAnalyzer provides comprehensive Go module analysis

func NewEnhancedGoAnalyzer

func NewEnhancedGoAnalyzer(config *config.Config) *EnhancedGoAnalyzer

NewEnhancedGoAnalyzer creates a new enhanced Go analyzer

func (*EnhancedGoAnalyzer) AnalyzeDependencies

func (a *EnhancedGoAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

AnalyzeDependencies builds a comprehensive dependency tree

func (*EnhancedGoAnalyzer) DetectVulnerableVersions

func (a *EnhancedGoAnalyzer) DetectVulnerableVersions(packages []*types.Package) ([]*types.Package, error)

DetectVulnerableVersions checks for known vulnerable versions

func (*EnhancedGoAnalyzer) ExtractPackages

func (a *EnhancedGoAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

ExtractPackages extracts packages from go.mod with enhanced parsing

func (*EnhancedGoAnalyzer) ValidateChecksums

func (a *EnhancedGoAnalyzer) ValidateChecksums(projectPath string) ([]string, error)

ValidateChecksums validates go.sum checksums against Go proxy

type EnhancedScanner

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

EnhancedScanner provides advanced supply chain security scanning capabilities

func NewEnhancedScanner

func NewEnhancedScanner(baseScanner *Scanner, config *config.SupplyChainConfig) (*EnhancedScanner, error)

NewEnhancedScanner creates a new enhanced scanner instance

func (*EnhancedScanner) Close

func (es *EnhancedScanner) Close() error

Close shuts down the enhanced scanner

func (*EnhancedScanner) ScanWithSupplyChainAnalysis

func (es *EnhancedScanner) ScanWithSupplyChainAnalysis(ctx context.Context, projectPath string) (*SupplyChainScanResult, error)

ScanWithSupplyChainAnalysis performs enhanced scanning with supply chain security analysis

type FileOperation

type FileOperation struct {
	Type string `json:"type"`
	Path string `json:"path"`
	Mode string `json:"mode"`
}

type Framework

type Framework struct {
	TargetAlias         string                        `json:"targetAlias"`
	Imports             []string                      `json:"imports"`
	AssetTargetFallback bool                          `json:"assetTargetFallback"`
	Warn                bool                          `json:"warn"`
	FrameworkReferences map[string]FrameworkReference `json:"frameworkReferences"`
	Dependencies        map[string]Dependency         `json:"dependencies"`
}

type FrameworkReference

type FrameworkReference struct {
	PrivateAssets string `json:"privateAssets"`
}

type GemLockEntry

type GemLockEntry struct {
	Name         string   `json:"name"`
	Version      string   `json:"version"`
	Dependencies []string `json:"dependencies"`
	Source       string   `json:"source"`
}

type GemSpec

type GemSpec struct {
	Name         string            `json:"name"`
	Version      string            `json:"version"`
	Description  string            `json:"description"`
	Authors      []string          `json:"authors"`
	Dependencies map[string]string `json:"dependencies"`
}

GemSpec represents basic gem specification

type GemfileLock

type GemfileLock struct {
	Gems []GemLockEntry `json:"gems"`
}

GemfileLock represents the structure of Gemfile.lock

type GenericAnalyzer

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

GenericAnalyzer handles projects without specific manifest files

func (*GenericAnalyzer) AnalyzeDependencies

func (a *GenericAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*GenericAnalyzer) ExtractPackages

func (a *GenericAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type GoAnalyzer

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

GoAnalyzer analyzes Go projects

func (*GoAnalyzer) AnalyzeDependencies

func (a *GoAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*GoAnalyzer) ExtractPackages

func (a *GoAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type GoDetector

type GoDetector struct{}

GoDetector detects Go projects

func (*GoDetector) Detect

func (d *GoDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*GoDetector) GetManifestFiles

func (d *GoDetector) GetManifestFiles() []string

func (*GoDetector) GetProjectType

func (d *GoDetector) GetProjectType() string

type GoExclude

type GoExclude struct {
	Path    string
	Version string
}

GoExclude represents an exclude directive

type GoModuleInfo

type GoModuleInfo struct {
	Module    string
	GoVersion string
	Requires  []GoRequirement
	Replaces  []GoReplace
	Excludes  []GoExclude
	Retracts  []GoRetract
}

GoModuleInfo represents information from go.mod

type GoProxyInfo

type GoProxyInfo struct {
	Version string    `json:"Version"`
	Time    time.Time `json:"Time"`
}

GoProxyInfo represents module information from Go proxy

type GoProxyVersions

type GoProxyVersions struct {
	Versions []string `json:"versions"`
}

GoProxyVersions represents available versions from Go proxy

type GoReplace

type GoReplace struct {
	OldPath    string
	OldVersion string
	NewPath    string
	NewVersion string
}

GoReplace represents a replace directive

type GoRequirement

type GoRequirement struct {
	Path     string
	Version  string
	Indirect bool
}

GoRequirement represents a require directive

type GoRetract

type GoRetract struct {
	Version string
	Reason  string
}

GoRetract represents a retract directive

type GoSumEntry

type GoSumEntry struct {
	Path     string
	Version  string
	Checksum string
}

GoSumEntry represents an entry in go.sum

type GradleDependency

type GradleDependency struct {
	Configuration string
	Group         string
	Name          string
	Version       string
}

Gradle build structures

type GraphStatistics

type GraphStatistics struct {
	TotalNodes     int `json:"total_nodes"`
	TotalEdges     int `json:"total_edges"`
	DirectDeps     int `json:"direct_deps"`
	TransitiveDeps int `json:"transitive_deps"`
	MaxDepth       int `json:"max_depth"`
	CyclicDeps     int `json:"cyclic_deps"`
}

type HoneypotDetection

type HoneypotDetection struct {
	ID          string                 `json:"id"`
	Type        string                 `json:"type"`
	Description string                 `json:"description"`
	Evidence    []types.Evidence       `json:"evidence"`
	Confidence  float64                `json:"confidence"`
	Metadata    map[string]interface{} `json:"metadata"`
	DetectedAt  time.Time              `json:"detected_at"`
}

type HoneypotManager

type HoneypotManager interface {
	DetectHoneypotPackages(ctx context.Context, pkg *types.Package) ([]HoneypotDetection, error)
	AnalyzePackageTraps(ctx context.Context, pkg *types.Package) ([]PackageTrap, error)
	ValidatePackageAuthenticity(ctx context.Context, pkg *types.Package) (*AuthenticityValidation, error)
}

HoneypotManager interface for honeypot detection

type ItemGroup

type ItemGroup struct {
	PackageReferences []PackageReference `xml:"PackageReference"`
	ProjectReferences []ProjectReference `xml:"ProjectReference"`
	References        []Reference        `xml:"Reference"`
	Compile           []Compile          `xml:"Compile"`
	Content           []Content          `xml:"Content"`
	None              []None             `xml:"None"`
}

type JavaAnalyzer

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

JavaAnalyzer analyzes Java projects

func NewJavaAnalyzer

func NewJavaAnalyzer(cfg *config.Config) *JavaAnalyzer

func (*JavaAnalyzer) AnalyzeDependencies

func (a *JavaAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*JavaAnalyzer) ExtractPackages

func (a *JavaAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type JavaDetector

type JavaDetector struct{}

JavaDetector detects Java projects

func (*JavaDetector) Detect

func (d *JavaDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*JavaDetector) GetManifestFiles

func (d *JavaDetector) GetManifestFiles() []string

func (*JavaDetector) GetProjectType

func (d *JavaDetector) GetProjectType() string

type JavaPackageAnalyzer

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

JavaPackageAnalyzer analyzes Java projects

func NewJavaPackageAnalyzer

func NewJavaPackageAnalyzer(cfg *config.Config) *JavaPackageAnalyzer

NewJavaPackageAnalyzer creates a new Java analyzer

func (*JavaPackageAnalyzer) AnalyzeDependencies

func (a *JavaPackageAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*JavaPackageAnalyzer) ExtractPackages

func (a *JavaPackageAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type LanguageAnalyzer

type LanguageAnalyzer interface {
	// GetName returns the unique name/identifier for this analyzer
	GetName() string

	// GetSupportedExtensions returns file extensions this analyzer can handle
	GetSupportedExtensions() []string

	// GetSupportedFiles returns specific filenames this analyzer can handle
	GetSupportedFiles() []string

	// ExtractPackages extracts package information from a project
	ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

	// AnalyzeDependencies performs dependency analysis and returns a dependency tree
	AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

	// ValidateProject checks if the project structure is valid for this analyzer
	ValidateProject(projectInfo *ProjectInfo) error

	// GetMetadata returns metadata about this analyzer
	GetMetadata() *AnalyzerMetadata
}

LanguageAnalyzer defines the interface that all language analyzers must implement

type Library

type Library struct {
	Sha512      string   `json:"sha512"`
	Type        string   `json:"type"`
	Path        string   `json:"path"`
	Files       []string `json:"files"`
	HashPath    string   `json:"hashPath"`
	Serviceable bool     `json:"serviceable"`
}

type Logger

type Logger interface {
	Debug(msg string, args ...interface{})
	Info(msg string, args ...interface{})
	Warn(msg string, args ...interface{})
	Error(msg string, args ...interface{})
}

Logger interface for analyzer logging

type MaintenanceInfo added in v1.0.1

type MaintenanceInfo struct {
	LastUpdate      time.Time `json:"last_update"`
	UpdateFrequency string    `json:"update_frequency"`
	MaintainerCount int       `json:"maintainer_count"`
	IsActive        bool      `json:"is_active"`
	RiskLevel       string    `json:"risk_level"`
}

MaintenanceInfo contains package maintenance information

type MaliciousIndicator

type MaliciousIndicator struct {
	Type        string  `json:"type"`
	Value       string  `json:"value"`
	Confidence  float64 `json:"confidence"`
	Description string  `json:"description"`
}

type MavenDependencies

type MavenDependencies struct {
	Dependency []MavenDependency `xml:"dependency"`
}

type MavenDependency

type MavenDependency struct {
	GroupID    string `xml:"groupId"`
	ArtifactID string `xml:"artifactId"`
	Version    string `xml:"version"`
	Scope      string `xml:"scope"`
	Type       string `xml:"type"`
	Classifier string `xml:"classifier"`
	Optional   bool   `xml:"optional"`
}

type MavenPOM

type MavenPOM struct {
	XMLName      xml.Name           `xml:"project"`
	GroupID      string             `xml:"groupId"`
	ArtifactID   string             `xml:"artifactId"`
	Version      string             `xml:"version"`
	Packaging    string             `xml:"packaging"`
	Name         string             `xml:"name"`
	Description  string             `xml:"description"`
	URL          string             `xml:"url"`
	Parent       *MavenParent       `xml:"parent"`
	Properties   *MavenProperties   `xml:"properties"`
	Dependencies *MavenDependencies `xml:"dependencies"`
	Plugins      *MavenPlugins      `xml:"build>plugins"`
}

Maven POM structures

type MavenParent

type MavenParent struct {
	GroupID    string `xml:"groupId"`
	ArtifactID string `xml:"artifactId"`
	Version    string `xml:"version"`
}

type MavenPlugin

type MavenPlugin struct {
	GroupID    string `xml:"groupId"`
	ArtifactID string `xml:"artifactId"`
	Version    string `xml:"version"`
}

type MavenPlugins

type MavenPlugins struct {
	Plugin []MavenPlugin `xml:"plugin"`
}

type MavenProperties

type MavenProperties struct {
	Properties map[string]string `xml:",any"`
}

type MetadataEnricher added in v1.0.1

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

MetadataEnricher enriches package metadata by fetching information from registries

func NewMetadataEnricher added in v1.0.1

func NewMetadataEnricher() *MetadataEnricher

NewMetadataEnricher creates a new metadata enricher

func (*MetadataEnricher) EnrichPackages added in v1.0.1

func (e *MetadataEnricher) EnrichPackages(ctx context.Context, packages []*types.Package) error

EnrichPackages enriches package metadata by fetching from registries

type NetworkCall

type NetworkCall struct {
	Destination string `json:"destination"`
	Port        int    `json:"port"`
	Protocol    string `json:"protocol"`
	Data        string `json:"data"`
}

type NodeJSAnalyzer

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

NodeJSAnalyzer analyzes Node.js projects

func (*NodeJSAnalyzer) AnalyzeDependencies

func (a *NodeJSAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*NodeJSAnalyzer) ExtractPackages

func (a *NodeJSAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type NodeJSDetector

type NodeJSDetector struct{}

NodeJSDetector detects Node.js projects

func (*NodeJSDetector) Detect

func (d *NodeJSDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*NodeJSDetector) GetManifestFiles

func (d *NodeJSDetector) GetManifestFiles() []string

func (*NodeJSDetector) GetProjectType

func (d *NodeJSDetector) GetProjectType() string

type NodeRiskData

type NodeRiskData struct {
	RiskScore    float64 `json:"risk_score"`
	ThreatCount  int     `json:"threat_count"`
	IsVulnerable bool    `json:"is_vulnerable"`
}

type None

type None struct {
	Include string `xml:"Include,attr"`
}

type OptimizedScanner

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

OptimizedScanner provides high-performance scanning with parallel processing

func NewOptimizedScanner

func NewOptimizedScanner(scanner *Scanner, cfg *config.Config) *OptimizedScanner

NewOptimizedScanner creates a new optimized scanner

func (*OptimizedScanner) ScanPackageParallel

func (os *OptimizedScanner) ScanPackageParallel(pkg *types.Package) (*types.Package, error)

ScanPackageParallel scans a single package with optimizations

func (*OptimizedScanner) ScanPackagesBatch

func (os *OptimizedScanner) ScanPackagesBatch(packages []*types.Package, timeout time.Duration) ([]*types.Package, error)

ScanPackagesBatch scans multiple packages in parallel

type PHPAnalyzer

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

PHPAnalyzer analyzes PHP projects

func NewPHPAnalyzer

func NewPHPAnalyzer(cfg *config.Config) *PHPAnalyzer

func (*PHPAnalyzer) AnalyzeDependencies

func (a *PHPAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*PHPAnalyzer) ExtractPackages

func (a *PHPAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type PHPDetector

type PHPDetector struct{}

PHPDetector detects PHP projects

func (*PHPDetector) Detect

func (d *PHPDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*PHPDetector) GetManifestFiles

func (d *PHPDetector) GetManifestFiles() []string

func (*PHPDetector) GetProjectType

func (d *PHPDetector) GetProjectType() string

type PHPPackageAnalyzer

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

PHPPackageAnalyzer analyzes PHP projects

func NewPHPPackageAnalyzer

func NewPHPPackageAnalyzer(cfg *config.Config) *PHPPackageAnalyzer

NewPHPPackageAnalyzer creates a new PHP analyzer

func (*PHPPackageAnalyzer) AnalyzeDependencies

func (a *PHPPackageAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*PHPPackageAnalyzer) ExtractPackages

func (a *PHPPackageAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type PackageConfigEntry

type PackageConfigEntry struct {
	ID                    string `xml:"id,attr"`
	Version               string `xml:"version,attr"`
	TargetFramework       string `xml:"targetFramework,attr"`
	DevelopmentDependency bool   `xml:"developmentDependency,attr"`
}

type PackageReference

type PackageReference struct {
	Include       string `xml:"Include,attr"`
	Version       string `xml:"Version,attr"`
	PrivateAssets string `xml:"PrivateAssets,attr"`
	IncludeAssets string `xml:"IncludeAssets,attr"`
	ExcludeAssets string `xml:"ExcludeAssets,attr"`
	Condition     string `xml:"Condition,attr"`
}

type PackageSignature

type PackageSignature struct {
	Algorithm string `json:"algorithm"`
	Value     string `json:"value"`
	Signer    string `json:"signer"`
}

type PackageTrap

type PackageTrap struct {
	Type        string  `json:"type"`
	Description string  `json:"description"`
	Confidence  float64 `json:"confidence"`
}

type PackagesConfig

type PackagesConfig struct {
	XMLName  xml.Name             `xml:"packages"`
	Packages []PackageConfigEntry `xml:"package"`
}

packages.config structure

type PluginAnalyzer

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

PluginAnalyzer represents an analyzer loaded from a plugin

type PluginInfo

type PluginInfo struct {
	Name        string                 `json:"name"`
	Path        string                 `json:"path"`
	Version     string                 `json:"version"`
	Author      string                 `json:"author"`
	Description string                 `json:"description"`
	LoadedAt    time.Time              `json:"loaded_at"`
	Enabled     bool                   `json:"enabled"`
	Config      map[string]interface{} `json:"config"`
	Analyzer    LanguageAnalyzer       `json:"-"`
}

PluginInfo contains information about a loaded plugin

type PluginManager

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

PluginManager manages the plugin lifecycle and provides advanced plugin management

func NewPluginManager

func NewPluginManager(cfg *config.Config, registry *AnalyzerRegistry) *PluginManager

NewPluginManager creates a new plugin manager

func (*PluginManager) DisablePlugin

func (pm *PluginManager) DisablePlugin(name string) error

DisablePlugin disables a plugin

func (*PluginManager) EnablePlugin

func (pm *PluginManager) EnablePlugin(name string) error

EnablePlugin enables a plugin

func (*PluginManager) GetLoadedPlugins

func (pm *PluginManager) GetLoadedPlugins() map[string]*PluginInfo

GetLoadedPlugins returns information about all loaded plugins

func (*PluginManager) GetPluginInfo

func (pm *PluginManager) GetPluginInfo(name string) (*PluginInfo, bool)

GetPluginInfo returns information about a specific plugin

func (*PluginManager) Initialize

func (pm *PluginManager) Initialize() error

Initialize initializes the plugin manager

func (*PluginManager) ListAvailablePlugins

func (pm *PluginManager) ListAvailablePlugins() ([]string, error)

ListAvailablePlugins returns a list of available plugin files in the plugin directory

func (*PluginManager) LoadAllPlugins

func (pm *PluginManager) LoadAllPlugins() error

LoadAllPlugins loads all configured plugins

func (*PluginManager) LoadPlugin

func (pm *PluginManager) LoadPlugin(pluginEntry config.PluginEntry) error

LoadPlugin loads a single plugin from a plugin entry

func (*PluginManager) ReloadPlugin

func (pm *PluginManager) ReloadPlugin(name string) error

ReloadPlugin reloads a plugin

func (*PluginManager) Shutdown

func (pm *PluginManager) Shutdown() error

Shutdown gracefully shuts down the plugin manager

func (*PluginManager) StopWatcher

func (pm *PluginManager) StopWatcher()

StopWatcher stops the plugin file watcher

func (*PluginManager) UnloadPlugin

func (pm *PluginManager) UnloadPlugin(name string) error

UnloadPlugin unloads a plugin

func (*PluginManager) ValidatePlugin

func (pm *PluginManager) ValidatePlugin(pluginPath string) error

ValidatePlugin validates a plugin file without loading it

type PluginWatcher

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

PluginWatcher watches for plugin file changes

type ProcessCall

type ProcessCall struct {
	Command   string   `json:"command"`
	Arguments []string `json:"arguments"`
	RiskLevel string   `json:"risk_level"`
}

type ProjectAssets

type ProjectAssets struct {
	Version   int                          `json:"version"`
	Targets   map[string]map[string]Target `json:"targets"`
	Libraries map[string]Library           `json:"libraries"`
	Project   ProjectAssetsProject         `json:"project"`
}

project.assets.json structure (NuGet lock file)

type ProjectAssetsProject

type ProjectAssetsProject struct {
	Version    string               `json:"version"`
	Restore    ProjectRestore       `json:"restore"`
	Frameworks map[string]Framework `json:"frameworks"`
}

type ProjectDetector

type ProjectDetector interface {
	Detect(projectPath string) (*ProjectInfo, error)
	GetManifestFiles() []string
	GetProjectType() string
}

ProjectDetector interface for detecting different project types

type ProjectInfo

type ProjectInfo struct {
	Type         string            `json:"type"`
	Path         string            `json:"path"`
	ManifestFile string            `json:"manifest_file"`
	LockFile     string            `json:"lock_file,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

ProjectInfo contains information about a detected project

type ProjectReference

type ProjectReference struct {
	Include string `xml:"Include,attr"`
}

type ProjectRestore

type ProjectRestore struct {
	ProjectUniqueName        string            `json:"projectUniqueName"`
	ProjectName              string            `json:"projectName"`
	ProjectPath              string            `json:"projectPath"`
	PackagesPath             string            `json:"packagesPath"`
	OutputPath               string            `json:"outputPath"`
	ProjectStyle             string            `json:"projectStyle"`
	OriginalTargetFrameworks []string          `json:"originalTargetFrameworks"`
	Sources                  map[string]Source `json:"sources"`
	FallbackFolders          []string          `json:"fallbackFolders"`
	ConfigFilePaths          []string          `json:"configFilePaths"`
}

type ProjectTarget

type ProjectTarget struct {
	Name string `xml:"Name,attr"`
}

type PropertyGroup

type PropertyGroup struct {
	TargetFramework          string `xml:"TargetFramework"`
	TargetFrameworks         string `xml:"TargetFrameworks"`
	OutputType               string `xml:"OutputType"`
	RootNamespace            string `xml:"RootNamespace"`
	AssemblyName             string `xml:"AssemblyName"`
	Version                  string `xml:"Version"`
	AssemblyVersion          string `xml:"AssemblyVersion"`
	FileVersion              string `xml:"FileVersion"`
	PackageVersion           string `xml:"PackageVersion"`
	Description              string `xml:"Description"`
	Authors                  string `xml:"Authors"`
	Company                  string `xml:"Company"`
	Product                  string `xml:"Product"`
	Copyright                string `xml:"Copyright"`
	PackageLicenseExpression string `xml:"PackageLicenseExpression"`
	RepositoryUrl            string `xml:"RepositoryUrl"`
	PackageProjectUrl        string `xml:"PackageProjectUrl"`
	PackageTags              string `xml:"PackageTags"`
}

type PythonAnalyzer

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

PythonAnalyzer analyzes Python projects

func NewPythonAnalyzer

func NewPythonAnalyzer(cfg *config.Config) *PythonAnalyzer

NewPythonAnalyzer creates a new Python analyzer

func (*PythonAnalyzer) AnalyzeDependencies

func (a *PythonAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*PythonAnalyzer) ExtractPackages

func (a *PythonAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type PythonDetector

type PythonDetector struct{}

PythonDetector detects Python projects

func (*PythonDetector) Detect

func (d *PythonDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*PythonDetector) GetManifestFiles

func (d *PythonDetector) GetManifestFiles() []string

func (*PythonDetector) GetProjectType

func (d *PythonDetector) GetProjectType() string

type PythonPackageAnalyzer

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

PythonPackageAnalyzer analyzes Python projects

func NewPythonPackageAnalyzer

func NewPythonPackageAnalyzer(cfg *config.Config) *PythonPackageAnalyzer

func (*PythonPackageAnalyzer) AnalyzeDependencies

func (a *PythonPackageAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*PythonPackageAnalyzer) ExtractPackages

func (a *PythonPackageAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type Reference

type Reference struct {
	Include         string `xml:"Include,attr"`
	HintPath        string `xml:"HintPath"`
	Private         string `xml:"Private"`
	SpecificVersion string `xml:"SpecificVersion"`
}

type ReputationAnalysis

type ReputationAnalysis struct {
	Score      float64  `json:"score"`
	TrustLevel string   `json:"trust_level"`
	Factors    []string `json:"factors"`
}

type RiskFactor

type RiskFactor struct {
	Type  string  `json:"type"`
	Score float64 `json:"score"`
}

type RubyAnalyzer

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

RubyAnalyzer analyzes Ruby projects

func NewRubyAnalyzer

func NewRubyAnalyzer(cfg *config.Config) *RubyAnalyzer

func (*RubyAnalyzer) AnalyzeDependencies

func (a *RubyAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*RubyAnalyzer) ExtractPackages

func (a *RubyAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type RubyDetector

type RubyDetector struct{}

RubyDetector detects Ruby projects

func (*RubyDetector) Detect

func (d *RubyDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*RubyDetector) GetManifestFiles

func (d *RubyDetector) GetManifestFiles() []string

func (*RubyDetector) GetProjectType

func (d *RubyDetector) GetProjectType() string

type RubyGemDependency

type RubyGemDependency struct {
	Name         string `json:"name"`
	Requirements string `json:"requirements"`
}

RubyGemDependency represents a gem dependency

type RubyGemsAPIResponse

type RubyGemsAPIResponse struct {
	Name             string                 `json:"name"`
	Version          string                 `json:"version"`
	Authors          string                 `json:"authors"`
	Info             string                 `json:"info"`
	Licenses         []string               `json:"licenses"`
	Metadata         map[string]interface{} `json:"metadata"`
	SHA              string                 `json:"sha"`
	ProjectURI       string                 `json:"project_uri"`
	GemURI           string                 `json:"gem_uri"`
	HomepageURI      string                 `json:"homepage_uri"`
	WikiURI          string                 `json:"wiki_uri"`
	DocumentationURI string                 `json:"documentation_uri"`
	MailingListURI   string                 `json:"mailing_list_uri"`
	SourceCodeURI    string                 `json:"source_code_uri"`
	BugTrackerURI    string                 `json:"bug_tracker_uri"`
	ChangelogURI     string                 `json:"changelog_uri"`
	Dependencies     struct {
		Development []RubyGemDependency `json:"development"`
		Runtime     []RubyGemDependency `json:"runtime"`
	} `json:"dependencies"`
	BuiltAt      time.Time `json:"built_at"`
	CreatedAt    time.Time `json:"created_at"`
	Description  string    `json:"description"`
	Downloads    int       `json:"downloads"`
	Number       string    `json:"number"`
	Summary      string    `json:"summary"`
	Platform     string    `json:"platform"`
	RubyVersion  string    `json:"ruby_version"`
	Prerelease   bool      `json:"prerelease"`
	Requirements []string  `json:"requirements"`
}

RubyGemsAPIResponse represents the response from RubyGems API

type RubyPackageAnalyzer

type RubyPackageAnalyzer struct {
	*BaseAnalyzer
	// contains filtered or unexported fields
}

RubyPackageAnalyzer analyzes Ruby projects with enhanced Bundler integration

func NewRubyPackageAnalyzer

func NewRubyPackageAnalyzer(cfg *config.Config) *RubyPackageAnalyzer

NewRubyPackageAnalyzer creates a new Ruby analyzer with RubyGems API integration

func (*RubyPackageAnalyzer) AnalyzeDependencies

func (a *RubyPackageAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*RubyPackageAnalyzer) ExtractPackages

func (a *RubyPackageAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type RuntimeAnalysis

type RuntimeAnalysis struct {
	Behaviors      []RuntimeBehavior      `json:"behaviors"`
	NetworkCalls   []NetworkCall          `json:"network_calls"`
	FileOperations []FileOperation        `json:"file_operations"`
	ProcessCalls   []ProcessCall          `json:"process_calls"`
	RiskScore      float64                `json:"risk_score"`
	Metadata       map[string]interface{} `json:"metadata"`
	AnalyzedAt     time.Time              `json:"analyzed_at"`
}

type RuntimeAsset

type RuntimeAsset struct {
	Rid string `json:"rid"`
}

type RuntimeBehavior

type RuntimeBehavior struct {
	Type        string                 `json:"type"`
	Description string                 `json:"description"`
	RiskLevel   string                 `json:"risk_level"`
	Metadata    map[string]interface{} `json:"metadata"`
}

type RustAnalyzer

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

RustAnalyzer analyzes Rust projects

func NewRustAnalyzer

func NewRustAnalyzer(cfg *config.Config) *RustAnalyzer

func (*RustAnalyzer) AnalyzeDependencies

func (a *RustAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*RustAnalyzer) ExtractPackages

func (a *RustAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type RustDetector

type RustDetector struct{}

RustDetector detects Rust projects

func (*RustDetector) Detect

func (d *RustDetector) Detect(projectPath string) (*ProjectInfo, error)

func (*RustDetector) GetManifestFiles

func (d *RustDetector) GetManifestFiles() []string

func (*RustDetector) GetProjectType

func (d *RustDetector) GetProjectType() string

type RustPackageAnalyzer

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

RustPackageAnalyzer analyzes Rust projects

func NewRustPackageAnalyzer

func NewRustPackageAnalyzer(cfg *config.Config) *RustPackageAnalyzer

NewRustPackageAnalyzer creates a new Rust analyzer

func (*RustPackageAnalyzer) AnalyzeDependencies

func (a *RustPackageAnalyzer) AnalyzeDependencies(projectInfo *ProjectInfo) (*types.DependencyTree, error)

func (*RustPackageAnalyzer) ExtractPackages

func (a *RustPackageAnalyzer) ExtractPackages(projectInfo *ProjectInfo) ([]*types.Package, error)

type ScanJob

type ScanJob struct {
	ID       string
	Package  *types.Package
	Priority int
	Timeout  time.Duration
}

ScanJob represents a scanning job

type ScanJobResult

type ScanJobResult struct {
	JobID     string
	Result    *types.Package
	Error     error
	Duration  time.Duration
	FromCache bool
}

ScanJobResult represents the result of a scanning job

type ScanResult

type ScanResult struct {
	Package *types.Package `json:"package"`
	Threats []Threat       `json:"threats"`
}

ScanResult represents a single package scan result

type ScanResults

type ScanResults struct {
	Results []ScanResult `json:"results"`
}

ScanResults contains the results of a security scan

type Scanner

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

Scanner handles project scanning and dependency analysis

func New

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

New creates a new scanner instance

func (*Scanner) BuildDependencyTree

func (s *Scanner) BuildDependencyTree(projectPath string) (*types.DependencyTree, error)

BuildDependencyTree builds a dependency tree for the project

func (*Scanner) ClearCache

func (s *Scanner) ClearCache() error

ClearCache clears all cached scan results

func (*Scanner) Close

func (s *Scanner) Close() error

Close closes the scanner and its resources

func (*Scanner) GetAnalyzerForProject

func (s *Scanner) GetAnalyzerForProject(projectInfo *ProjectInfo) (LanguageAnalyzer, error)

GetAnalyzerForProject gets the appropriate analyzer for a project

func (*Scanner) GetCacheStats

func (s *Scanner) GetCacheStats() cache.CacheStats

GetCacheStats returns cache statistics

func (*Scanner) GetLoadedPlugins

func (s *Scanner) GetLoadedPlugins() map[string]*PluginAnalyzer

GetLoadedPlugins returns information about loaded plugins

func (*Scanner) InvalidatePackageCache

func (s *Scanner) InvalidatePackageCache(packagePath string) error

InvalidatePackageCache invalidates cache for a specific package

func (*Scanner) IsCacheEnabled

func (s *Scanner) IsCacheEnabled() bool

IsCacheEnabled returns whether caching is enabled

func (*Scanner) LoadPlugin

func (s *Scanner) LoadPlugin(pluginPath string) error

LoadPlugin loads a plugin at runtime

func (*Scanner) ScanProject

func (s *Scanner) ScanProject(projectPath string) (*types.ScanResult, error)

ScanProject scans a project for dependencies and security threats

func (*Scanner) SetCacheConfig

func (s *Scanner) SetCacheConfig(config *cache.CacheConfig) error

SetCacheConfig updates the cache configuration

func (*Scanner) UnloadPlugin

func (s *Scanner) UnloadPlugin(name string) error

UnloadPlugin unloads a plugin at runtime

func (*Scanner) WatchProject

func (s *Scanner) WatchProject(projectPath string, interval time.Duration) error

WatchProject watches a project for changes and automatically scans

type SecurityIssue

type SecurityIssue struct {
	Type        string         `json:"type"`
	Severity    types.Severity `json:"severity"`
	Description string         `json:"description"`
	Location    string         `json:"location"`
}

type SignatureValidation

type SignatureValidation struct {
	Valid       bool                   `json:"valid"`
	Signatures  []PackageSignature     `json:"signatures"`
	TrustChain  []TrustChainElement    `json:"trust_chain"`
	Metadata    map[string]interface{} `json:"metadata"`
	ValidatedAt time.Time              `json:"validated_at"`
}

type Source

type Source struct {
	ProtocolVersion int `json:"protocolVersion"`
}

type SupplyChainRiskAnalysis

type SupplyChainRiskAnalysis struct {
	OverallRisk     float64                `json:"overall_risk"`
	RiskFactors     []RiskFactor           `json:"risk_factors"`
	CriticalPaths   [][]string             `json:"critical_paths"`
	Recommendations []string               `json:"recommendations"`
	Metadata        map[string]interface{} `json:"metadata"`
}

type SupplyChainRiskScore

type SupplyChainRiskScore struct {
	OverallScore    float64                `json:"overall_score"`
	RiskLevel       types.Severity         `json:"risk_level"`
	Factors         []RiskFactor           `json:"factors"`
	Recommendations []string               `json:"recommendations"`
	Metadata        map[string]interface{} `json:"metadata"`
	CalculatedAt    time.Time              `json:"calculated_at"`
}

type SupplyChainScanMetadata

type SupplyChainScanMetadata struct {
	ScanID          string                 `json:"scan_id"`
	ScanType        string                 `json:"scan_type"`
	DetectorsUsed   []string               `json:"detectors_used"`
	ScanDuration    time.Duration          `json:"scan_duration"`
	PackagesScanned int                    `json:"packages_scanned"`
	FindingsCount   map[string]int         `json:"findings_count"`
	Configuration   map[string]interface{} `json:"configuration"`
	Timestamp       time.Time              `json:"timestamp"`
}

type SupplyChainScanResult

type SupplyChainScanResult struct {
	*types.ScanResult
	BuildIntegrityFindings []BuildIntegrityFinding `json:"build_integrity_findings"`
	ZeroDayFindings        []ZeroDayFinding        `json:"zero_day_findings"`
	DependencyGraph        *DependencyGraph        `json:"dependency_graph"`
	ThreatIntelFindings    []ThreatIntelFinding    `json:"threat_intel_findings"`
	HoneypotDetections     []HoneypotDetection     `json:"honeypot_detections"`
	SupplyChainRisk        SupplyChainRiskScore    `json:"supply_chain_risk"`
	ScanMetadata           SupplyChainScanMetadata `json:"scan_metadata"`
}

SupplyChainScanResult extends the basic scan result with supply chain specific findings

type TamperingEvidence

type TamperingEvidence struct {
	Type        string                 `json:"type"`
	Description string                 `json:"description"`
	Severity    types.Severity         `json:"severity"`
	Evidence    []types.Evidence       `json:"evidence"`
	Confidence  float64                `json:"confidence"`
	Metadata    map[string]interface{} `json:"metadata"`
}

type Target

type Target struct {
	Type         string                  `json:"type"`
	Framework    string                  `json:"framework"`
	Dependencies map[string]string       `json:"dependencies"`
	Runtime      map[string]RuntimeAsset `json:"runtime"`
	Compile      map[string]CompileAsset `json:"compile"`
}

type Threat

type Threat struct {
	Type           string  `json:"type"`
	Severity       string  `json:"severity"`
	Score          float64 `json:"score"`
	Description    string  `json:"description"`
	Recommendation string  `json:"recommendation"`
	Evidence       string  `json:"evidence"`
	Source         string  `json:"source"`
	Confidence     float64 `json:"confidence"`
}

Threat represents a security threat found in a package

type ThreatContext

type ThreatContext struct {
	ThreatID    string   `json:"threat_id"`
	Description string   `json:"description"`
	Severity    string   `json:"severity"`
	References  []string `json:"references"`
}

type ThreatIntelFinding

type ThreatIntelFinding struct {
	ID          string                 `json:"id"`
	Source      string                 `json:"source"`
	Type        string                 `json:"type"`
	Severity    types.Severity         `json:"severity"`
	Description string                 `json:"description"`
	Indicators  []MaliciousIndicator   `json:"indicators"`
	Confidence  float64                `json:"confidence"`
	References  []string               `json:"references"`
	Metadata    map[string]interface{} `json:"metadata"`
	DetectedAt  time.Time              `json:"detected_at"`
}

type ThreatIntelligenceEngine

type ThreatIntelligenceEngine interface {
	QueryThreatIntelligence(ctx context.Context, pkg *types.Package) ([]ThreatIntelFinding, error)
	CheckMaliciousIndicators(ctx context.Context, pkg *types.Package) ([]MaliciousIndicator, error)
	AnalyzeReputationData(ctx context.Context, pkg *types.Package) (*ReputationAnalysis, error)
	GetThreatContext(ctx context.Context, threatID string) (*ThreatContext, error)
}

ThreatIntelligenceEngine interface for threat intelligence integration

type TransitiveRisk added in v1.0.1

type TransitiveRisk struct {
	SourcePackage   string   `json:"source_package"`
	TargetPackage   string   `json:"target_package"`
	Path            []string `json:"path"`
	Depth           int      `json:"depth"`
	RiskScore       float64  `json:"risk_score"`
	PropagationType string   `json:"propagation_type"`
	Severity        string   `json:"severity"`
	MitigationCost  float64  `json:"mitigation_cost"`
}

TransitiveRisk represents risk propagated through dependency chains

type TransitiveThreat

type TransitiveThreat struct {
	Package     string         `json:"package"`
	ThreatType  string         `json:"threat_type"`
	Severity    types.Severity `json:"severity"`
	Description string         `json:"description"`
	Path        []string       `json:"path"`
}

type TrustChainElement

type TrustChainElement struct {
	Entity      string `json:"entity"`
	Certificate string `json:"certificate"`
	Valid       bool   `json:"valid"`
}

type WorkerPool

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

WorkerPool manages concurrent scanning operations

func NewWorkerPool

func NewWorkerPool(workers int) *WorkerPool

NewWorkerPool creates a new worker pool

func (*WorkerPool) Results

func (wp *WorkerPool) Results() <-chan ScanJobResult

Results returns the result channel

func (*WorkerPool) Start

func (wp *WorkerPool) Start(scanner *OptimizedScanner)

Start starts the worker pool

func (*WorkerPool) Stop

func (wp *WorkerPool) Stop()

Stop stops the worker pool

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(job ScanJob) error

Submit submits a job to the worker pool

type ZeroDayDetector

type ZeroDayDetector interface {
	DetectZeroDayThreats(ctx context.Context, pkg *types.Package) ([]ZeroDayFinding, error)
	AnalyzeBehavioralPatterns(ctx context.Context, pkg *types.Package) (*BehavioralAnalysis, error)
	DetectAnomalousCode(ctx context.Context, pkg *types.Package) ([]CodeAnomaly, error)
	AnalyzeRuntimeBehavior(ctx context.Context, pkg *types.Package) (*RuntimeAnalysis, error)
}

ZeroDayDetector interface for detecting zero-day threats

type ZeroDayFinding

type ZeroDayFinding struct {
	ID             string                 `json:"id"`
	Type           string                 `json:"type"`
	Severity       types.Severity         `json:"severity"`
	Description    string                 `json:"description"`
	BehaviorType   string                 `json:"behavior_type"`
	AnomalyScore   float64                `json:"anomaly_score"`
	Evidence       []types.Evidence       `json:"evidence"`
	Confidence     float64                `json:"confidence"`
	Recommendation string                 `json:"recommendation"`
	Metadata       map[string]interface{} `json:"metadata"`
	DetectedAt     time.Time              `json:"detected_at"`
}

Jump to

Keyboard shortcuts

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