scanner

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTestFile

func FormatTestFile(src string) string

func GetDiff

func GetDiff(opts types.DiffOptions) ([]types.DiffFile, error)

func ParseDiffContent

func ParseDiffContent(raw string) ([]types.DiffFile, error)

Types

type CacheEntry

type CacheEntry struct {
	ContentHash string          `json:"content_hash"`
	Findings    []types.Finding `json:"findings"`
	Score       int             `json:"score"`
	ScannedAt   string          `json:"scanned_at"`
}

type ContractInfo

type ContractInfo struct {
	Package    string
	FuncName   string
	Params     []ParamInfo
	Returns    []ReturnInfo
	IsMethod   bool
	Receiver   string
	SourceFile string
}

type DeepASTAnalyzer

type DeepASTAnalyzer struct{}

func NewDeepASTAnalyzer

func NewDeepASTAnalyzer() *DeepASTAnalyzer

func (*DeepASTAnalyzer) Analyze

func (a *DeepASTAnalyzer) Analyze(path string, content string) []types.Finding

type FingerprintResult

type FingerprintResult struct {
	Score   int                 `json:"score"`
	Signals []FingerprintSignal `json:"signals"`
	Verdict string              `json:"verdict"`
}

type FingerprintSignal

type FingerprintSignal struct {
	Name   string  `json:"name"`
	Value  float64 `json:"value"`
	Weight float64 `json:"weight"`
	Detail string  `json:"detail,omitempty"`
}

type Fingerprinter

type Fingerprinter struct{}

func NewFingerprinter

func NewFingerprinter() *Fingerprinter

func (*Fingerprinter) Analyze

func (f *Fingerprinter) Analyze(content, path string) FingerprintResult

type FuzzEngine

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

func NewFuzzEngine

func NewFuzzEngine(iterations int) *FuzzEngine

func (*FuzzEngine) Cleanup

func (e *FuzzEngine) Cleanup(files []types.DiffFile)

func (*FuzzEngine) Fuzz

func (e *FuzzEngine) Fuzz(files []types.DiffFile) FuzzOutput

func (*FuzzEngine) RunTests

func (e *FuzzEngine) RunTests(files []types.DiffFile) []FuzzResult

type FuzzError

type FuzzError struct {
	Iteration int    `json:"iteration"`
	Message   string `json:"message"`
}

type FuzzOutput

type FuzzOutput struct {
	Functions    []FuzzResult `json:"functions"`
	Total        int          `json:"total"`
	FilesScanned int          `json:"files_scanned"`
	Errors       int          `json:"errors"`
}

type FuzzResult

type FuzzResult struct {
	Function   string      `json:"function"`
	File       string      `json:"file"`
	Iterations int         `json:"iterations"`
	Panics     int         `json:"panics"`
	Errors     []FuzzError `json:"errors,omitempty"`
	Status     string      `json:"status"`
}

type History

type History struct {
	Entries []HistoryEntry `json:"entries"`
	// contains filtered or unexported fields
}

func LoadHistory

func LoadHistory(path string) *History

func (*History) Compare

func (h *History) Compare(entry HistoryEntry) string

func (*History) Record

func (h *History) Record(score int, totalIssues, errors, warnings, infos, filesCount int) HistoryEntry

func (*History) Save

func (h *History) Save() error

type HistoryEntry

type HistoryEntry struct {
	Timestamp   string `json:"timestamp"`
	TrustScore  int    `json:"trust_score"`
	TotalIssues int    `json:"total_issues"`
	Errors      int    `json:"errors"`
	Warnings    int    `json:"warnings"`
	Infos       int    `json:"infos"`
	FilesCount  int    `json:"files_count"`
}

type IntentAnalyzer

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

func NewIntentAnalyzer

func NewIntentAnalyzer(provider llm.Provider) *IntentAnalyzer

func (*IntentAnalyzer) Analyze

func (a *IntentAnalyzer) Analyze(ctx context.Context, files []types.DiffFile, opts types.DiffOptions) ([]IntentResult, error)

type IntentResult

type IntentResult struct {
	File     string          `json:"file"`
	Findings []types.Finding `json:"findings"`
	Intent   string          `json:"intent,omitempty"`
}

type LogicDetector

type LogicDetector struct{}

func NewLogicDetector

func NewLogicDetector() *LogicDetector

func (*LogicDetector) Detect

func (d *LogicDetector) Detect(files []types.DiffFile) []types.Finding

type PackageResult

type PackageResult struct {
	Path   string            `json:"path"`
	Result *types.ScanResult `json:"result"`
	Error  string            `json:"error,omitempty"`
}

type ParamInfo

type ParamInfo struct {
	Name string
	Type string
}

type ReturnInfo

type ReturnInfo struct {
	Type string
}

type ScanCache

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

func NewScanCache

func NewScanCache(cachePath string) *ScanCache

func (*ScanCache) Clear

func (c *ScanCache) Clear()

func (*ScanCache) Enabled

func (c *ScanCache) Enabled() bool

func (*ScanCache) Flush

func (c *ScanCache) Flush()

func (*ScanCache) Get

func (c *ScanCache) Get(path, content string) ([]types.Finding, int, bool)

func (*ScanCache) Invalidate

func (c *ScanCache) Invalidate(path string)

func (*ScanCache) Set

func (c *ScanCache) Set(path, content string, findings []types.Finding, score int)

func (*ScanCache) SetEnabled

func (c *ScanCache) SetEnabled(enabled bool)

type Scanner

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

func NewScanner

func NewScanner(cfg *config.Config, llmProvider llm.Provider) *Scanner

func (*Scanner) FlushCache

func (s *Scanner) FlushCache()

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context, opts types.DiffOptions) (*types.ScanResult, error)

func (*Scanner) ScanAllPackages

func (s *Scanner) ScanAllPackages(ctx context.Context, opts types.DiffOptions) ([]PackageResult, error)

func (*Scanner) SetCacheEnabled

func (s *Scanner) SetCacheEnabled(enabled bool)

type SecurityScanner

type SecurityScanner struct{}

func NewSecurityScanner

func NewSecurityScanner() *SecurityScanner

func (*SecurityScanner) Scan

func (s *SecurityScanner) Scan(files []types.DiffFile) []types.Finding

type SemanticAnalyzer

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

func NewSemanticAnalyzer

func NewSemanticAnalyzer(provider llm.Provider) *SemanticAnalyzer

func (*SemanticAnalyzer) Analyze

func (s *SemanticAnalyzer) Analyze(ctx context.Context, file types.DiffFile, projectContext string) ([]types.Finding, error)

type StaticAnalyzer

type StaticAnalyzer struct{}

func NewStaticAnalyzer

func NewStaticAnalyzer() *StaticAnalyzer

func (*StaticAnalyzer) Analyze

func (s *StaticAnalyzer) Analyze(path, content string) []types.Finding

type TestGenerator

type TestGenerator struct{}

func NewTestGenerator

func NewTestGenerator() *TestGenerator

func (*TestGenerator) GenerateTests

func (g *TestGenerator) GenerateTests(files []types.DiffFile) ([]types.Finding, error)

type VerificationEngine

type VerificationEngine struct{}

func NewVerificationEngine

func NewVerificationEngine() *VerificationEngine

func (*VerificationEngine) Verify

func (v *VerificationEngine) Verify(ctx context.Context, files []types.DiffFile) ([]types.Finding, error)

type Watcher

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

func NewWatcher

func NewWatcher(cfg *config.Config, s *Scanner, dirs []string) *Watcher

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context) error

Jump to

Keyboard shortcuts

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