Versions in this module Expand all Collapse all v0 v0.10.3 Apr 12, 2023 Changes in this version + var ErrAPICouldNotMarshalPayload = errors.New("could not marshal payload") + var ErrAPIRequestFailed = errors.New("api request failed") + var ErrAPIRequestInvalid = errors.New("api request invalid") + var ErrAPIResponseNotJSON = errors.New("api response could not be parsed as json") + var ErrAPIResultsCountMismatch = errors.New("api results count mismatch") + var ErrAPIUnexpectedResponse = errors.New("api returned unexpected status") + var ErrAPIUnreadableResponse = errors.New("could not read response body") + var ErrDirPathWrongProtocol = errors.New("directory path must start with \"file:\" protocol") + var ErrInvalidBatchSize = errors.New("batch size must be greater than 0") + var ErrOfflineDatabaseNotFound = errors.New("no offline version of the OSV database is available") + var ErrOfflineDatabaseNotSupported = errors.New("API database does not support being used offline") + var ErrUnsupportedDatabaseType = errors.New("unsupported database source type") + type APIDB struct + BaseURL *url.URL + BatchSize int + func NewAPIDB(config Config, offline bool, batchSize int) (*APIDB, error) + func (db APIDB) Check(pkgs []internal.PackageDetails) ([]Vulnerabilities, error) + func (db APIDB) Fetch(id string) (OSV, error) + func (db APIDB) FetchAll(ids []string) Vulnerabilities + func (db APIDB) Identifier() string + func (db APIDB) Name() string + type Affected struct + Package Package + Ranges Affects + Versions Versions + type Affects []AffectsRange + type AffectsRange struct + Events []RangeEvent + Type AffectsRangeType + type AffectsRangeType string + const TypeEcosystem + const TypeGit + const TypeSemver + type Cache struct + Body []byte + Date string + ETag string + URL string + type Config struct + Name string + Type string + URL string + WorkingDirectory string + func (dbc Config) Identifier() string + type DB interface + Check func(pkgs []internal.PackageDetails) ([]Vulnerabilities, error) + Identifier func() string + Name func() string + func Load(config Config, offline bool, batchSize int) (DB, error) + type DirDB struct + LocalPath string + Offline bool + WorkingDirectory string + func NewDirDB(config Config, offline bool) (*DirDB, error) + func (db *DirDB) Check(pkgs []internal.PackageDetails) ([]Vulnerabilities, error) + func (db *DirDB) Identifier() string + func (db *DirDB) Name() string + func (db *DirDB) Vulnerabilities(includeWithdrawn bool) []OSV + func (db *DirDB) VulnerabilitiesAffectingPackage(pkg internal.PackageDetails) Vulnerabilities + type Ecosystem = internal.Ecosystem + type OSV struct + Affected []Affected + Aliases []string + Details string + ID string + Modified time.Time + Published time.Time + Summary string + Withdrawn *time.Time + func (osv *OSV) AffectsEcosystem(ecosystem internal.Ecosystem) bool + func (osv *OSV) Describe() string + func (osv *OSV) IsAffected(pkg internal.PackageDetails) bool + func (osv *OSV) Link() string + type ObjectWithID struct + ID string + type Package struct + Ecosystem Ecosystem + Name string + func (p Package) NormalizedName() string + type RangeEvent struct + Fixed string + Introduced string + LastAffected string + type Reference struct + Type string + URL string + type Versions []string + func (vs Versions) MarshalJSON() ([]byte, error) + type Vulnerabilities []OSV + func (vs Vulnerabilities) Includes(vulnerability OSV) bool + func (vs Vulnerabilities) MarshalJSON() ([]byte, error) + func (vs Vulnerabilities) Unique() Vulnerabilities + type ZipDB struct + ArchiveURL string + Offline bool + UpdatedAt string + WorkingDirectory string + func NewZippedDB(config Config, offline bool) (*ZipDB, error) + func (db *ZipDB) Check(pkgs []internal.PackageDetails) ([]Vulnerabilities, error) + func (db *ZipDB) Identifier() string + func (db *ZipDB) Name() string + func (db *ZipDB) Vulnerabilities(includeWithdrawn bool) []OSV + func (db *ZipDB) VulnerabilitiesAffectingPackage(pkg internal.PackageDetails) Vulnerabilities