scan

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: GPL-2.0, GPL-2.0-only Imports: 23 Imported by: 0

Documentation

Overview

Package scan contains reusable scan utilities shared by CLI commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGraphFragmentExport added in v0.6.0

func BuildGraphFragmentExport(result *engine.DepScanResult) graphfrag.GraphFragmentExport

BuildGraphFragmentExport projects a dependency scan result onto the public graph-fragment export schema.

func CountFindings

func CountFindings(report *entities.InterimReport) int

CountFindings counts total cryptographic assets across all findings.

func DetectEcosystem

func DetectEcosystem(target string) string

DetectEcosystem checks the target directory for known manifest files and returns the corresponding ecosystem name ("go", "python", "java", "rust"). Returns empty string if no ecosystem is detected.

Polyglot resolution: when a pyproject.toml declares a Python package (via [project] / [tool.*] / PEP 517 build backend), it wins over Cargo.toml — this captures Python packages that embed Rust via PyO3, maturin or setuptools-rust (pyca/cryptography, pydantic-core, orjson, polars, ...). Polyglot conflicts outside the Python↔Rust pair are not disambiguated here; they keep the original precedence (Go → Java → Rust → Python fallback).

func DetectRootModule

func DetectRootModule(targetDir, ecosystem string) string

DetectRootModule returns a best-effort root module/package name for callgraph export. It is manifest-based when possible and falls back to the target directory name.

func ExportCallGraph

func ExportCallGraph(path, format string, result *engine.DepScanResult) error

ExportCallGraph writes a finding-centric call graph export (schema v4.3).

func ExportGraphFragment added in v0.6.0

func ExportGraphFragment(path, format string, result *engine.DepScanResult) error

ExportGraphFragment writes the dependency scan result's call graph as a graph-fragment export in the requested format.

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string supporting standard Go formats plus: - "d" for days (e.g., "30d" = 720 hours) - "w" for weeks (e.g., "2w" = 336 hours)

Standard formats (ns, us, ms, s, m, h) are parsed by time.ParseDuration.

func PrintSummary

func PrintSummary(outputPath string, filesCount, findingsCount int) error

PrintSummary displays scan summary in a user-friendly format.

func ValidateFlags

func ValidateFlags(target string, opts ValidationOptions) ([]string, error)

ValidateFlags validates scan inputs and returns normalized language hints.

Types

type ValidationOptions

type ValidationOptions struct {
	RuleFiles        []string
	RuleDirs         []string
	NoRemoteRules    bool
	Scanner          string
	AllowedScanners  []string
	Interfile        bool
	InterfileScanner string
	Format           string
	SupportedFormats []string
	Languages        []string
	ScanDependencies bool
	ExportCallgraph  string
}

ValidationOptions contains scan flag values required for validation.

Jump to

Keyboard shortcuts

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