edge

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: 12 Imported by: 0

Documentation

Overview

Package edge implements the AICC (Attestation Internal Consistency Check) algorithm for advanced attestation chain forgery detection and policy violation detection

Package edge implements cutting-edge supply chain security algorithms This module contains 51 advanced algorithms across three tiers: - Tier G: Production-Ready (19 algorithms) - Tier Y: Development-Ready (19 algorithms) - Tier R: Research Phase (13 algorithms)

Package edge implements the DIRT (Dependency Impact Risk Traversal) algorithm with Asset Criticality scoring for business-aware risk assessment

Package edge implements the GTR (Graph Traversal Reconnaissance) algorithm for advanced dependency graph analysis and attack path detection

Edge Algorithm Registry Central registry for managing all edge detection algorithms

RUNT - Release-Unusual Name Tokenizer Advanced typosquatting detection using multiple string similarity metrics and Bayesian mixture models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeDefaultAlgorithms

func InitializeDefaultAlgorithms() error

InitializeDefaultAlgorithms initializes all default algorithms

func ListAlgorithms

func ListAlgorithms() []string

ListAlgorithms returns all registered algorithms

func ListAlgorithmsByTier

func ListAlgorithmsByTier(tier AlgorithmTier) []string

ListAlgorithmsByTier returns algorithms filtered by tier

func RegisterAlgorithm

func RegisterAlgorithm(algorithm Algorithm) error

RegisterAlgorithm registers an algorithm in the global registry

Types

type AICCAlgorithm

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

AICCAlgorithm implements attestation internal consistency checking

func NewAICCAlgorithm

func NewAICCAlgorithm(config *AICCConfig) *AICCAlgorithm

NewAICCAlgorithm creates a new AICC algorithm instance

func (*AICCAlgorithm) Analyze

func (a *AICCAlgorithm) Analyze(ctx context.Context, packages []string) (*AlgorithmResult, error)

Analyze performs attestation consistency analysis on a package

func (*AICCAlgorithm) Configure

func (a *AICCAlgorithm) Configure(config map[string]interface{}) error

Configure configures the algorithm with provided settings

func (*AICCAlgorithm) Description

func (a *AICCAlgorithm) Description() string

Description returns the algorithm description

func (*AICCAlgorithm) GetMetrics

func (a *AICCAlgorithm) GetMetrics() *AlgorithmMetrics

GetMetrics returns algorithm metrics

func (*AICCAlgorithm) Name

func (a *AICCAlgorithm) Name() string

Name returns the algorithm name

func (*AICCAlgorithm) Reset

func (a *AICCAlgorithm) Reset() error

Reset resets the AICC algorithm's metrics and state

func (*AICCAlgorithm) Tier

func (a *AICCAlgorithm) Tier() AlgorithmTier

Tier returns the algorithm tier

type AICCConfig

type AICCConfig struct {
	MaxChainDepth     int           `yaml:"max_chain_depth"`
	MinTrustScore     float64       `yaml:"min_trust_score"`
	RequireTimestamps bool          `yaml:"require_timestamps"`
	AllowSelfSigned   bool          `yaml:"allow_self_signed"`
	MaxClockSkew      time.Duration `yaml:"max_clock_skew"`
	PolicyStrictness  string        `yaml:"policy_strictness"`
}

AICCConfig holds configuration for the AICC algorithm

type AICCMetrics

type AICCMetrics struct {
	AttestationsProcessed int64         `json:"attestations_processed"`
	ChainsAnalyzed        int64         `json:"chains_analyzed"`
	ViolationsDetected    int64         `json:"violations_detected"`
	ForgeriesDetected     int64         `json:"forgeries_detected"`
	ProcessingTime        time.Duration `json:"processing_time"`
	TotalAnalyses         int64         `json:"total_analyses"`
	AverageLatency        time.Duration `json:"average_latency"`
	TruePositives         int64         `json:"true_positives"`
	FalsePositives        int64         `json:"false_positives"`
	TrueNegatives         int64         `json:"true_negatives"`
	FalseNegatives        int64         `json:"false_negatives"`
	Accuracy              float64       `json:"accuracy"`
	Precision             float64       `json:"precision"`
	Recall                float64       `json:"recall"`
	F1Score               float64       `json:"f1_score"`
	LastUpdated           time.Time     `json:"last_updated"`
}

AICCMetrics tracks AICC algorithm performance

type Algorithm

type Algorithm interface {
	Name() string
	Tier() AlgorithmTier
	Description() string
	Analyze(ctx context.Context, packages []string) (*AlgorithmResult, error)
	Configure(config map[string]interface{}) error
	GetMetrics() *AlgorithmMetrics
	Reset() error
}

Algorithm interface that all edge algorithms must implement

func GetAlgorithm

func GetAlgorithm(name string) (Algorithm, error)

GetAlgorithm retrieves an algorithm from the global registry

type AlgorithmInfo

type AlgorithmInfo struct {
	Name        string        `json:"name"`
	Tier        AlgorithmTier `json:"tier"`
	Description string        `json:"description"`
	Version     string        `json:"version"`
	Enabled     bool          `json:"enabled"`
	Registered  time.Time     `json:"registered"`
	LastUsed    time.Time     `json:"last_used"`
	UsageCount  int           `json:"usage_count"`
}

AlgorithmInfo contains metadata about an algorithm

type AlgorithmMetrics

type AlgorithmMetrics struct {
	PackagesProcessed int           `json:"packages_processed"`
	ThreatsDetected   int           `json:"threats_detected"`
	ProcessingTime    time.Duration `json:"processing_time"`
	Accuracy          float64       `json:"accuracy"`
	Precision         float64       `json:"precision"`
	Recall            float64       `json:"recall"`
	F1Score           float64       `json:"f1_score"`
	LastUpdated       time.Time     `json:"last_updated"`
}

AlgorithmMetrics represents performance metrics for an algorithm

type AlgorithmResult

type AlgorithmResult struct {
	Algorithm string                 `json:"algorithm"`
	Timestamp time.Time              `json:"timestamp"`
	Packages  []string               `json:"packages"`
	Findings  []Finding              `json:"findings"`
	Metadata  map[string]interface{} `json:"metadata"`
}

AlgorithmResult represents the result of an algorithm analysis

type AlgorithmTier

type AlgorithmTier string

AlgorithmTier represents the tier/level of an algorithm

const (
	TierCore AlgorithmTier = "core" // Core algorithms (AICC, GTR, DIRT, RUNT)
	TierX    AlgorithmTier = "x"    // Experimental algorithms (QUANTUM, NEURAL, ADAPTIVE)
	TierPro  AlgorithmTier = "pro"  // Professional algorithms
	TierDev  AlgorithmTier = "dev"  // Development algorithms
)

type AnalysisResult

type AnalysisResult struct {
	AlgorithmName  string                 `json:"algorithm_name"`
	Tier           AlgorithmTier          `json:"tier"`
	ThreatScore    float64                `json:"threat_score"` // 0.0 - 1.0
	Confidence     float64                `json:"confidence"`   // 0.0 - 1.0
	AttackVectors  []string               `json:"attack_vectors"`
	Findings       []Finding              `json:"findings"`
	Metadata       map[string]interface{} `json:"metadata"`
	ProcessingTime time.Duration          `json:"processing_time"`
	Timestamp      time.Time              `json:"timestamp"`
}

AnalysisResult contains the output of an algorithm analysis

type AssetCriticality

type AssetCriticality string

AssetCriticality defines the business value of the target application/repository

const (
	CriticalityUnknown  AssetCriticality = "UNKNOWN"  // Not yet assessed
	CriticalityPublic   AssetCriticality = "PUBLIC"   // Marketing sites, blogs (low impact)
	CriticalityInternal AssetCriticality = "INTERNAL" // Admin tools, internal apps (medium impact)
	CriticalityCritical AssetCriticality = "CRITICAL" // Billing, Auth, Core Services (high impact)
)

type Attestation

type Attestation struct {
	ID         string                 `json:"id"`
	Subject    string                 `json:"subject"`
	Predicate  string                 `json:"predicate"`
	Timestamp  time.Time              `json:"timestamp"`
	Signature  string                 `json:"signature"`
	Metadata   map[string]interface{} `json:"metadata"`
	TrustScore float64                `json:"trust_score"`
	Verified   bool                   `json:"verified"`
}

Attestation represents a single attestation record

type BayesianMixtureModel

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

BayesianMixtureModel implements Bayesian mixture modeling

type BusinessRiskAssessment

type BusinessRiskAssessment struct {
	PackageName          string                 `json:"package_name"`
	TechnicalRisk        float64                `json:"technical_risk"` // 0.0 - 1.0
	BusinessRisk         float64                `json:"business_risk"`  // Technical * Criticality
	AssetCriticality     AssetCriticality       `json:"asset_criticality"`
	ImpactMultiplier     float64                `json:"impact_multiplier"`
	RiskLevel            string                 `json:"risk_level"`         // LOW/MEDIUM/HIGH/CRITICAL
	RecommendedAction    string                 `json:"recommended_action"` // ALLOW/REVIEW/ALERT/BLOCK
	DependencyDepth      int                    `json:"dependency_depth"`
	DirectDependency     bool                   `json:"direct_dependency"`
	VulnerabilityCount   int                    `json:"vulnerability_count"`
	TransitiveDependents int                    `json:"transitive_dependents"` // How many packages depend on this
	Justification        string                 `json:"justification"`
	Metadata             map[string]interface{} `json:"metadata"`
}

BusinessRiskAssessment contains the business-aware risk analysis

type DIRTAlgorithm

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

DIRTAlgorithm implements business-aware dependency impact analysis

func NewDIRTAlgorithm

func NewDIRTAlgorithm(config *DIRTConfig) *DIRTAlgorithm

NewDIRTAlgorithm creates a new DIRT algorithm instance

func (*DIRTAlgorithm) Analyze

func (d *DIRTAlgorithm) Analyze(ctx context.Context, packages []string) (*AlgorithmResult, error)

Analyze implements the Algorithm interface for compatibility

func (*DIRTAlgorithm) AnalyzeWithCriticality

func (d *DIRTAlgorithm) AnalyzeWithCriticality(
	ctx context.Context,
	pkg *types.Package,
	criticality AssetCriticality,
) (*BusinessRiskAssessment, error)

AnalyzeWithCriticality performs business-aware risk analysis

func (*DIRTAlgorithm) Configure

func (d *DIRTAlgorithm) Configure(config map[string]interface{}) error

Configure implements the Algorithm interface

func (*DIRTAlgorithm) Description

func (d *DIRTAlgorithm) Description() string

Description returns the algorithm description

func (*DIRTAlgorithm) GetMetrics

func (d *DIRTAlgorithm) GetMetrics() *AlgorithmMetrics

GetMetrics returns algorithm performance metrics

func (*DIRTAlgorithm) Name

func (d *DIRTAlgorithm) Name() string

Name returns the algorithm name

func (*DIRTAlgorithm) Reset

func (d *DIRTAlgorithm) Reset() error

Reset resets algorithm metrics

func (*DIRTAlgorithm) Tier

func (d *DIRTAlgorithm) Tier() AlgorithmTier

Tier returns the algorithm tier

type DIRTConfig

type DIRTConfig struct {
	// Business impact multipliers
	CriticalMultiplier float64 `yaml:"critical_multiplier" json:"critical_multiplier"` // e.g., 2.0
	InternalMultiplier float64 `yaml:"internal_multiplier" json:"internal_multiplier"` // e.g., 1.0
	PublicMultiplier   float64 `yaml:"public_multiplier" json:"public_multiplier"`     // e.g., 0.5

	// Technical analysis parameters
	MaxPropagationDepth       int     `yaml:"max_propagation_depth" json:"max_propagation_depth"`
	HighRiskThreshold         float64 `yaml:"high_risk_threshold" json:"high_risk_threshold"`
	EnableCascadeAnalysis     bool    `yaml:"enable_cascade_analysis" json:"enable_cascade_analysis"`
	EnableHiddenRiskDetection bool    `yaml:"enable_hidden_risk_detection" json:"enable_hidden_risk_detection"`
	CacheEnabled              bool    `yaml:"cache_enabled" json:"cache_enabled"`

	// Policy enforcement thresholds
	BlockThreshold  float64 `yaml:"block_threshold" json:"block_threshold"`   // Auto-block if risk >= this
	AlertThreshold  float64 `yaml:"alert_threshold" json:"alert_threshold"`   // Alert if risk >= this
	ReviewThreshold float64 `yaml:"review_threshold" json:"review_threshold"` // Manual review if risk >= this
}

DIRTConfig holds configuration for the DIRT algorithm with business context

func DefaultDIRTConfig

func DefaultDIRTConfig() *DIRTConfig

DefaultDIRTConfig returns a production-ready DIRT configuration

type DIRTMetrics

type DIRTMetrics struct {
	PackagesAnalyzed   int64         `json:"packages_analyzed"`
	DependenciesScored int64         `json:"dependencies_scored"`
	HighRiskDetected   int64         `json:"high_risk_detected"`
	ProcessingTime     time.Duration `json:"processing_time"`
	CacheHits          int64         `json:"cache_hits"`
	CacheMisses        int64         `json:"cache_misses"`
	LastUpdated        time.Time     `json:"last_updated"`
}

DIRTMetrics tracks DIRT algorithm performance

type EdgeAnalysisResult

type EdgeAnalysisResult struct {
	PackageName        string            `json:"package_name"`
	PackageVersion     string            `json:"package_version"`
	OverallThreatScore float64           `json:"overall_threat_score"`
	Results            []*AnalysisResult `json:"results"`
	ProcessingTime     time.Duration     `json:"processing_time"`
	Timestamp          time.Time         `json:"timestamp"`
}

EdgeAnalysisResult contains the combined results from all algorithms

type EdgeConfig

type EdgeConfig struct {
	EnabledTiers      []AlgorithmTier        `json:"enabled_tiers"`
	ParallelExecution bool                   `json:"parallel_execution"`
	MaxConcurrency    int                    `json:"max_concurrency"`
	Timeout           time.Duration          `json:"timeout"`
	AlgorithmConfigs  map[string]interface{} `json:"algorithm_configs"`
}

EdgeConfig contains configuration for the edge engine

type EdgeEngine

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

EdgeEngine orchestrates all edge algorithms

func NewEdgeEngine

func NewEdgeEngine(config *EdgeConfig) *EdgeEngine

NewEdgeEngine creates a new edge algorithm engine

func (*EdgeEngine) AnalyzePackage

func (e *EdgeEngine) AnalyzePackage(ctx context.Context, pkg *types.Package) (*EdgeAnalysisResult, error)

AnalyzePackage runs all enabled algorithms on a package

func (*EdgeEngine) GetAlgorithmNames

func (e *EdgeEngine) GetAlgorithmNames() []string

GetAlgorithmNames returns all registered algorithm names

func (*EdgeEngine) GetMetrics

func (e *EdgeEngine) GetMetrics() *EngineMetrics

GetMetrics returns current engine metrics

func (*EdgeEngine) RegisterAlgorithm

func (e *EdgeEngine) RegisterAlgorithm(algorithm Algorithm) error

RegisterAlgorithm adds an algorithm to the engine

type EngineMetrics

type EngineMetrics struct {
	TotalPackagesAnalyzed int64                        `json:"total_packages_analyzed"`
	AlgorithmMetrics      map[string]*AlgorithmMetrics `json:"algorithm_metrics"`
	AverageProcessingTime time.Duration                `json:"average_processing_time"`
	ThreatDetectionRate   float64                      `json:"threat_detection_rate"`
	LastAnalysis          time.Time                    `json:"last_analysis"`
}

EngineMetrics tracks overall engine performance

type Evidence

type Evidence struct {
	Type        string      `json:"type"`
	Description string      `json:"description"`
	Value       interface{} `json:"value"`
	Score       float64     `json:"score"`
}

Evidence represents supporting evidence for a finding

type Finding

type Finding struct {
	ID              string     `json:"id"`
	Package         string     `json:"package"`
	Type            string     `json:"type"`
	Severity        string     `json:"severity"`
	Message         string     `json:"message"`
	Confidence      float64    `json:"confidence"`
	Evidence        []Evidence `json:"evidence"`
	DetectedAt      time.Time  `json:"detected_at"`
	DetectionMethod string     `json:"detection_method"`
}

Finding represents a security finding

type GTRAlgorithm

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

GTRAlgorithm implements graph traversal reconnaissance

func NewGTRAlgorithm

func NewGTRAlgorithm(config *GTRConfig) *GTRAlgorithm

NewGTRAlgorithm creates a new GTR algorithm instance

func (*GTRAlgorithm) Analyze

func (g *GTRAlgorithm) Analyze(ctx context.Context, packages []string) (*AlgorithmResult, error)

Analyze performs graph traversal reconnaissance on a package

func (*GTRAlgorithm) Configure

func (g *GTRAlgorithm) Configure(config map[string]interface{}) error

Configure configures the algorithm with provided settings

func (*GTRAlgorithm) Description

func (g *GTRAlgorithm) Description() string

Description returns the algorithm description

func (*GTRAlgorithm) GetMetrics

func (g *GTRAlgorithm) GetMetrics() *AlgorithmMetrics

GetMetrics returns algorithm metrics

func (*GTRAlgorithm) Name

func (g *GTRAlgorithm) Name() string

Name returns the algorithm name

func (*GTRAlgorithm) Reset

func (g *GTRAlgorithm) Reset() error

Reset resets the algorithm state

func (*GTRAlgorithm) Tier

func (g *GTRAlgorithm) Tier() AlgorithmTier

Tier returns the algorithm tier

type GTRConfig

type GTRConfig struct {
	MaxTraversalDepth    int     `yaml:"max_traversal_depth"`
	MinRiskThreshold     float64 `yaml:"min_risk_threshold"`
	EnablePathAnalysis   bool    `yaml:"enable_path_analysis"`
	MaxPathLength        int     `yaml:"max_path_length"`
	CriticalityWeight    float64 `yaml:"criticality_weight"`
	VulnerabilityWeight  float64 `yaml:"vulnerability_weight"`
	PopularityWeight     float64 `yaml:"popularity_weight"`
	TrustWeight          float64 `yaml:"trust_weight"`
	EnableCycleDetection bool    `yaml:"enable_cycle_detection"`
	MaxCycleLength       int     `yaml:"max_cycle_length"`
}

GTRConfig holds configuration for the GTR algorithm

type GTRMetrics

type GTRMetrics struct {
	GraphsAnalyzed   int64         `json:"graphs_analyzed"`
	NodesTraversed   int64         `json:"nodes_traversed"`
	PathsAnalyzed    int64         `json:"paths_analyzed"`
	CyclesDetected   int64         `json:"cycles_detected"`
	AttackPathsFound int64         `json:"attack_paths_found"`
	ProcessingTime   time.Duration `json:"processing_time"`
	TotalAnalyses    int64         `json:"total_analyses"`
	AverageLatency   time.Duration `json:"average_latency"`
	TruePositives    int64         `json:"true_positives"`
	FalsePositives   int64         `json:"false_positives"`
	TrueNegatives    int64         `json:"true_negatives"`
	FalseNegatives   int64         `json:"false_negatives"`
	Accuracy         float64       `json:"accuracy"`
	Precision        float64       `json:"precision"`
	Recall           float64       `json:"recall"`
	F1Score          float64       `json:"f1_score"`
	LastUpdated      time.Time     `json:"last_updated"`
}

GTRMetrics tracks GTR algorithm performance

type MixtureComponent

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

MixtureComponent represents a single component in the mixture model

type PhoneticEncoder

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

PhoneticEncoder handles phonetic encoding for sound-alike detection

type RUNTAlgorithm

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

RUNTAlgorithm implements the RUNT algorithm for typosquatting detection

func NewRUNTAlgorithm

func NewRUNTAlgorithm(config *RUNTConfig) *RUNTAlgorithm

NewRUNTAlgorithm creates a new RUNT algorithm instance

func (*RUNTAlgorithm) Analyze

func (r *RUNTAlgorithm) Analyze(ctx context.Context, packages []string) (*AlgorithmResult, error)

func (*RUNTAlgorithm) ClassifyAttackType

func (r *RUNTAlgorithm) ClassifyAttackType(features *SimilarityFeatures) string

func (*RUNTAlgorithm) ComputeAllSimilarityFeatures

func (r *RUNTAlgorithm) ComputeAllSimilarityFeatures(name1, name2 string) *SimilarityFeatures

Exported helpers for testing and external use

func (*RUNTAlgorithm) Configure

func (r *RUNTAlgorithm) Configure(config map[string]interface{}) error

func (*RUNTAlgorithm) Description

func (r *RUNTAlgorithm) Description() string

func (*RUNTAlgorithm) GetMetrics

func (r *RUNTAlgorithm) GetMetrics() *AlgorithmMetrics

func (*RUNTAlgorithm) Name

func (r *RUNTAlgorithm) Name() string

func (*RUNTAlgorithm) Reset

func (r *RUNTAlgorithm) Reset() error

Reset resets the algorithm state

func (*RUNTAlgorithm) Tier

func (r *RUNTAlgorithm) Tier() AlgorithmTier

type RUNTConfig

type RUNTConfig struct {
	// Similarity thresholds
	LevenshteinThreshold float64 `json:"levenshtein_threshold"`
	JaroWinklerThreshold float64 `json:"jaro_winkler_threshold"`
	PhoneticThreshold    float64 `json:"phonetic_threshold"`
	VisualThreshold      float64 `json:"visual_threshold"`
	SemanticThreshold    float64 `json:"semantic_threshold"`

	// Bayesian model parameters
	MixtureComponents int     `json:"mixture_components"`
	PriorWeight       float64 `json:"prior_weight"`

	// Detection parameters
	OverallThreshold          float64 `json:"overall_threshold"`
	MinPackageLength          int     `json:"min_package_length"`
	MaxPackageLength          int     `json:"max_package_length"`
	EnableUnicodeAnalysis     bool    `json:"enable_unicode_analysis"`
	MaxDependencyDepth        int     `json:"max_dependency_depth"`
	EnableDependencyAnalysis  bool    `json:"enable_dependency_analysis"`
	DependencyCacheTTLMinutes int     `json:"dependency_cache_ttl_minutes"`
	UnicodeAttackThreshold    float64 `json:"unicode_attack_threshold"`
	KeyboardAttackThreshold   float64 `json:"keyboard_attack_threshold"`
	VisualAttackThreshold     float64 `json:"visual_attack_threshold"`
	PhoneticAttackThreshold   float64 `json:"phonetic_attack_threshold"`
}

RUNTConfig contains configuration for the RUNT algorithm

type Registry

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

Registry manages all edge algorithms

func GetGlobalRegistry

func GetGlobalRegistry() *Registry

GetGlobalRegistry returns the global registry instance

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new algorithm registry

func (*Registry) Analyze

func (r *Registry) Analyze(ctx context.Context, algorithmName string, packages []string) (*AlgorithmResult, error)

Analyze runs analysis using a specific algorithm

func (*Registry) AnalyzeByTier

func (r *Registry) AnalyzeByTier(ctx context.Context, tier AlgorithmTier, packages []string) (map[string]*AlgorithmResult, error)

AnalyzeByTier runs analysis using all algorithms in a specific tier

func (*Registry) AnalyzeMultiple

func (r *Registry) AnalyzeMultiple(ctx context.Context, algorithmNames []string, packages []string) (map[string]*AlgorithmResult, error)

AnalyzeMultiple runs analysis using multiple algorithms

func (*Registry) Configure

func (r *Registry) Configure(name string, config map[string]interface{}) error

Configure configures an algorithm

func (*Registry) Disable

func (r *Registry) Disable(name string) error

Disable disables an algorithm

func (*Registry) Enable

func (r *Registry) Enable(name string) error

Enable enables an algorithm

func (*Registry) Get

func (r *Registry) Get(name string) (Algorithm, error)

Get retrieves an algorithm by name

func (*Registry) GetAllInfo

func (r *Registry) GetAllInfo() map[string]*AlgorithmInfo

GetAllInfo returns information about all algorithms

func (*Registry) GetAllMetrics

func (r *Registry) GetAllMetrics() map[string]*AlgorithmMetrics

GetAllMetrics returns metrics for all algorithms

func (*Registry) GetInfo

func (r *Registry) GetInfo(name string) (*AlgorithmInfo, error)

GetInfo returns information about an algorithm

func (*Registry) GetMetrics

func (r *Registry) GetMetrics(name string) (*AlgorithmMetrics, error)

GetMetrics returns metrics for an algorithm

func (*Registry) List

func (r *Registry) List() []string

List returns all registered algorithms

func (*Registry) ListByTier

func (r *Registry) ListByTier(tier AlgorithmTier) []string

ListByTier returns algorithms filtered by tier

func (*Registry) Register

func (r *Registry) Register(algorithm Algorithm) error

Register registers a new algorithm

func (*Registry) Reset

func (r *Registry) Reset(name string) error

Reset resets an algorithm

func (*Registry) ResetAll

func (r *Registry) ResetAll() error

ResetAll resets all algorithms

func (*Registry) Unregister

func (r *Registry) Unregister(name string) error

Unregister removes an algorithm from the registry

type SemanticModel

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

SemanticModel handles semantic similarity using word embeddings

type SimilarityFeatures

type SimilarityFeatures struct {
	Levenshtein    float64 `json:"levenshtein"`
	JaroWinkler    float64 `json:"jaro_winkler"`
	Phonetic       float64 `json:"phonetic"`
	Visual         float64 `json:"visual"`
	Semantic       float64 `json:"semantic"`
	LCS            float64 `json:"lcs"` // Longest Common Subsequence
	Hamming        float64 `json:"hamming"`
	Cosine         float64 `json:"cosine"`
	Jaccard        float64 `json:"jaccard"`
	NGram          float64 `json:"ngram"`
	KeyboardLayout float64 `json:"keyboard_layout"`
	Unicode        float64 `json:"unicode"`
}

SimilarityFeatures contains all computed similarity features

type SuspiciousPackage

type SuspiciousPackage struct {
	Name            string              `json:"name"`
	SimilarityScore float64             `json:"similarity_score"`
	Features        *SimilarityFeatures `json:"features"`
	AttackType      string              `json:"attack_type"`
}

SuspiciousPackage represents a potentially malicious package

Jump to

Keyboard shortcuts

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