Documentation
¶
Index ¶
- Constants
- func CompileBlocklists() (outPath string, count int, err error)
- func MatchBlocklists(packages []schema.Package) ([]schema.Vulnerability, error)
- func ResourceDirs() []string
- func UpdateDB(log func(string)) (int, error)
- type Client
- type CompiledEntry
- type OSVAdvisory
- type OSVAffectedRange
- type UserAdvisory
Constants ¶
const CompiledIndexName = "devscan.json"
CompiledIndexName is the filename written by CompileBlocklists and given priority over raw source files during matching.
Variables ¶
This section is empty.
Functions ¶
func CompileBlocklists ¶ added in v0.2.2
CompileBlocklists merges all raw source files into a single compiled index at compiledIndexPath() and returns a summary of what was written. It returns the output path and total entry count.
func MatchBlocklists ¶ added in v0.2.2
func MatchBlocklists(packages []schema.Package) ([]schema.Vulnerability, error)
MatchBlocklists checks the given packages against all loaded blocklist files and returns synthetic Vulnerability entries for any matches.
func ResourceDirs ¶ added in v0.2.2
func ResourceDirs() []string
ResourceDirs returns the directories that are searched for raw blocklist source files (*.csv, *.json). Earlier entries take priority.
Priority:
- ~/.devscan/resources/ — primary user location
- <executable dir>/resources/ — bundled defaults
- <cwd>/resources/ — dev convenience
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) QueryPackages ¶
QueryPackages queries OSV for vulnerabilities across a set of packages.
type CompiledEntry ¶ added in v0.2.2
type CompiledEntry struct {
Ecosystem string `json:"ecosystem"`
Name string `json:"name"`
Version string `json:"version,omitempty"`
Reason string `json:"reason,omitempty"`
Sources []string `json:"sources,omitempty"`
}
CompiledEntry is the on-disk schema for a compiled blocklist entry. It is also the generic JSON shape accepted by parseGenericJSON.
type OSVAdvisory ¶ added in v0.3.5
type OSVAdvisory struct {
ID string
Severity string
Summary string
Details string
Ecosystem string
Package string
Affected []OSVAffectedRange
References []string
PublishedAt string
}
OSVAdvisory is a self-contained advisory result returned by the OSV search functions. It is richer than schema.Vulnerability because it includes the full affected version ranges and all references.
func LookupID ¶ added in v0.3.5
func LookupID(id string) (*OSVAdvisory, error)
LookupID fetches a single advisory by its OSV/CVE/GHSA ID.
func SearchByPackage ¶ added in v0.3.5
func SearchByPackage(name, ecosystem, version string, noCache bool) ([]OSVAdvisory, error)
SearchByPackage queries OSV for all advisories affecting the named package. If ecosystem is empty, all ecosystems defined in osvEcosystem are tried and results are merged. If version is non-empty, only advisories affecting that exact version are returned.
func SearchFreeText ¶ added in v0.3.5
func SearchFreeText(term, ecosystem string) ([]OSVAdvisory, error)
SearchFreeText queries OSV for each known ecosystem using the term as a package name, then filters results so that the term appears somewhere in the advisory ID, summary, details, or package name.
type OSVAffectedRange ¶ added in v0.3.5
OSVAffectedRange describes one affected version range for a package.
type UserAdvisory ¶ added in v0.3.3
type UserAdvisory struct {
Ecosystem string `yaml:"ecosystem"`
Package string `yaml:"package"`
// Version may be a specific version ("1.2.3") or "*" / "" to match all versions.
Version string `yaml:"version"`
Severity string `yaml:"severity"`
Reason string `yaml:"reason"`
Reference string `yaml:"reference"`
}
UserAdvisory is one entry in a .devscan/advisories.yaml file.