types

package
v0.0.19-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Description: This file contains the NVD struct and all the functions that are used to parse the NVD data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanName

func CleanName(value string) string

func ConvertComposerAuthor

func ConvertComposerAuthor(authors []Author) []string

func ConvertNpmVersion

func ConvertNpmVersion(npm Npm) []knowledge.Version

func GetLatestVersion

func GetLatestVersion(npmVersions map[string]NpmVersion) string

Types

type Author

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type CVE

type CVE struct {
	Key              string        `json:"_key,omitempty"`
	Id               string        `json:"id"`
	SourceIdentifier string        `json:"sourceIdentifier"`
	Published        string        `json:"published"`
	LastModified     string        `json:"lastModified"`
	VulnStatus       string        `json:"vulnStatus"`
	Descriptions     []Description `json:"descriptions"`
	Metrics          any           `json:"metrics"`
	// Weaknesses       []Weakness    `json:"weaknesses"`
	Weaknesses        []any           `json:"weaknesses"`
	Configurations    []Configuration `json:"configurations,omitempty"`
	Affected          []NVDAffected   `json:"affected"`
	References        []ReferenceNVD  `json:"references"`
	AffectedFlattened []CpeMatch      `json:"affectedFlattened"`
}

func GetVulns

func GetVulns(nvd NVD) []CVE

type Composer

type Composer struct {
	Minified string                       `json:"minified"`
	Packages map[string][]ComposerPackage `json:"packages"`
}

type ComposerPackage

type ComposerPackage struct {
	Name              string            `json:"name"`
	Description       string            `json:"description"`
	Homepage          string            `json:"homepage"`
	Version           string            `json:"version"`
	VersionNormalized string            `json:"version_normalized"`
	Authors           []Author          `json:"authors"`
	Time              string            `json:"time"`
	Keywords          []string          `json:"keywords"`
	Source            ComposerSource    `json:"source"`
	Dist              ComposerSource    `json:"dist"`
	License           []string          `json:"license"`
	Require           map[string]string `json:"require"`
	RequireDev        map[string]string `json:"require-dev"`
}

type ComposerSource

type ComposerSource struct {
	Url  string `json:"url"`
	Type string `json:"type"`
}

type Configuration

type Configuration struct {
	Nodes []Node `json:"nodes"`
}

type CpeMatch

type CpeMatch struct {
	Vulnerable            bool         `json:"vulnerable"`
	Criteria              string       `json:"criteria"`
	MatchCriteriaId       string       `json:"matchCriteriaId"`
	VersionEndIncluding   string       `json:"versionEndIncluding"`
	VersionEndExcluding   string       `json:"versionEndExcluding"`
	VersionStartIncluding string       `json:"versionStartIncluding"`
	VersionStartExcluding string       `json:"versionStartExcluding"`
	CriteriaDict          CriteriaDict `json:"criteriaDict"`
}

type CriteriaDict

type CriteriaDict struct {
	Part       string `json:"part"`
	Vendor     string `json:"vendor"`
	Product    string `json:"product"`
	Version    string `json:"version"`
	Update     string `json:"update"`
	Edition    string `json:"edition"`
	Language   string `json:"language"`
	Sw_edition string `json:"sw_edition"`
	Target_sw  string `json:"target_sw"`
	Target_hw  string `json:"target_hw"`
	Other      string `json:"other"`
}

type Description

type Description struct {
	Lang  string `json:"lang"`
	Value string `json:"value"`
}

type Dist

type Dist struct {
	Shasum     string      `json:"shasum"`
	Tarball    string      `json:"tarball"`
	Integrity  string      `json:"integrity"`
	Signatures []Signature `json:"signatures"`
}

type LicenseMaven

type LicenseMaven struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type LicenseNpm

type LicenseNpm struct {
	Type string `json:"type"`
	Url  string `json:"url"`
}

type LinkLicensePackage

type LinkLicensePackage struct {
	FromKey    string `json:"packageKey"`
	LicenseKey string `json:"licenseKey"`
}

type Maintainers

type Maintainers struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type Maven

type Maven struct {
	Name        string `xml:"name"`
	Description string `xml:"description"`
	Url         string `xml:"url"`
	Version     string `xml:"version"`
	Packaging   string `xml:"packaging"`

	SCM SCM `xml:"scm"`

	// Versions map[string]NpmVersion `json:"versions"`
	// License  any                   `json:"license"`
	Licenses []LicenseMaven `json:"licenses"`
}

type NVD

type NVD struct {
	Vulnerabilities []map[string]CVE `json:"vulnerabilities"`
}

NVD struct This struct contains all the fields that are needed to parse the NVD data The fields are based on the NVD JSON schema https://nvd.nist.gov/vuln/data-feeds#JSON_FEED

type NVDAffected

type NVDAffected struct {
	Sources                      []CpeMatch `json:"sources"`
	Running_on                   []CpeMatch `json:"running-on"`
	Running_on_applications_only []CpeMatch `json:"running-on-applications-only"`
}

type Node

type Node struct {
	Operator string     `json:"operator"`
	Negate   bool       `json:"negate"`
	CpeMatch []CpeMatch `json:"cpematch"`
	Children []Node     `json:"children"`
}

type Notification

type Notification struct {
	Key         string                  `json:"_key"`
	Title       string                  `json:"title"`
	Description string                  `json:"description"`
	Content     map[string]string       `json:"content"`
	Type        NotificationType        `json:"type"`
	ContentType NotificationContentType `json:"content_type"`
}

type NotificationContentType

type NotificationContentType string
const (
	NewVersion NotificationContentType = "new_version"
)

type NotificationType

type NotificationType string
const (
	Info    NotificationType = "info"
	Warning NotificationType = "warning"
	Error   NotificationType = "error"
)

type Npm

type Npm struct {
	Name        string                `json:"name"`
	Description string                `json:"description"`
	Revision    string                `json:"_rev"`
	Homepage    string                `json:"homepage"`
	Versions    map[string]NpmVersion `json:"versions"`
	Time        map[string]time.Time  `json:"time"`
	Repository  any                   `json:"repository"`
	Keywords    any                   `json:"keywords"`
	DistTags    map[string]string     `json:"dist-tags"`
	Maintainers []Maintainers         `json:"maintainers"`
	Author      any                   `json:"author"`
	License     any                   `json:"license"`
	Licenses    []LicenseNpm          `json:"licenses"`
}

type NpmVersion

type NpmVersion struct {
	Version              string            `json:"version"`
	Author               interface{}       `json:"author"`
	Engines              any               `json:"engines"`
	Dist                 Dist              `json:"dist"`
	License              any               `json:"license"`
	Licenses             any               `json:"licenses"`
	Dependencies         map[string]string `json:"dependencies"`
	DevDependencies      map[string]string `json:"devDependencies"`
	PeerDependencies     any               `json:"peerDependencies"`
	PeerDependenciesMeta any               `json:"peerDependenciesMeta"`
	BundleDependencies   any               `json:"bundleDependencies"`
	BundledDependencies  any               `json:"bundledDependencies"`
	OptionalDependencies any               `json:"optionalDependencies"`
	Deprecated           interface{}       `json:"deprecated"`
}

type Package

type Package struct {
	Key         string    `json:"_key"`
	Revision    string    `json:"Revision"`
	Name        string    `json:"Name"`
	Description string    `json:"Description"`
	Homepage    string    `json:"Homepage"`
	Version     string    `json:"Version"`
	Versions    []Version `json:"-"`
	Time        string    `json:"Time"`
	Keywords    []string  `json:"Keywords"`
	Source      Source    `json:"Source"`
	Licenses    []string  `json:"Licenses"`
	Extra       any       `json:"Extra"`
}

type ReferenceNVD

type ReferenceNVD struct {
	Url    string   `json:"url"`
	Source string   `json:"source"`
	Tags   []string `json:"tags"`
}

type Repository

type Repository struct {
	Type      string `json:"type"`
	Url       string `json:"url"`
	Directory string `json:"directory"`
}

type Revision

type Revision struct {
	Revision    string `json:"revision"`
	OldRevision string `json:"old_revision"`
	Id          string `json:"id"`
	Data        any    `json:"data"`
}

type SCM

type SCM struct {
	Connection string `xml:"connection"`
	Developer  string `xml:"developerConnection"`
	Url        string `xml:"url"`
}

type Signature

type Signature struct {
	Keyid string
	Sig   string
}

type Source

type Source struct {
	Url  string `json:"Url"`
	Type string `json:"Type"`
}

type Version

type Version struct {
	Key             string            `json:"_key"`
	Version         string            `json:"Version"`
	Time            string            `json:"Time"`
	Dependencies    map[string]string `json:"Dependencies"`
	DevDependencies map[string]string `json:"DevDependencies"`
	Licenses        []string          `json:"Licenses"`
	Extra           any               `json:"Extra"`
}

func ConvertComposerVersion

func ConvertComposerVersion(composerPackage []ComposerPackage, key string) []Version

type Weakness

type Weakness struct {
	Source       string        `json:"source"`
	Type         string        `json:"type"`
	Descriptions []Description `json:"descriptions"`
}

Jump to

Keyboard shortcuts

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