cveschema5

package
v0.0.0-...-210767f Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package cveschema5 contains the schema for a CVE Record in CVE JSON 5.0 format. The package implements a subset of the schema needed to publish reports for the vulnerability database.

https://github.com/CVEProject/cve-schema/blob/master/schema/v5.0/CVE_JSON_5.0_schema.json contains the full JSON schema and documentation for each field.

Index

Constants

View Source
const Regex = `CVE-\d{4}-\d{4,}`

Variables

This section is empty.

Functions

func IsCVE

func IsCVE(s string) bool

Types

type Affected

type Affected struct {
	Vendor          string           `json:"vendor,omitempty"`
	Product         string           `json:"product,omitempty"`
	CollectionURL   string           `json:"collectionURL,omitempty"`
	PackageName     string           `json:"packageName,omitempty"`
	Versions        []VersionRange   `json:"versions,omitempty"`
	Platforms       []string         `json:"platforms,omitempty"`
	ProgramRoutines []ProgramRoutine `json:"programRoutines,omitempty"`
	DefaultStatus   VersionStatus    `json:"defaultStatus,omitempty"`
}

type CNAPublishedContainer

type CNAPublishedContainer struct {
	ProviderMetadata ProviderMetadata `json:"providerMetadata"`
	Title            string           `json:"title,omitempty"`
	Descriptions     []Description    `json:"descriptions"`
	Affected         []Affected       `json:"affected"`
	ProblemTypes     []ProblemType    `json:"problemTypes,omitempty"`
	References       []Reference      `json:"references"`
	Credits          []Credit         `json:"credits,omitempty"`
}

type CVERecord

type CVERecord struct {
	DataType    string     `json:"dataType"`
	DataVersion string     `json:"dataVersion"`
	Metadata    Metadata   `json:"cveMetadata"`
	Containers  Containers `json:"containers"`
}

func Read

func Read(filename string) (*CVERecord, error)

Read unmarshals the JSON CVE Record in `filename` into a CVE Record.

type Containers

type Containers struct {
	CNAContainer CNAPublishedContainer `json:"cna"`
}

func ReadForPublish

func ReadForPublish(filename string) (cveID string, toPublish *Containers, err error)

ReadForPublish reads the portion of a CVE record that can be published via the CVE Services API from filename.

type Credit

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

type Description

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

type Metadata

type Metadata struct {
	ID     string `json:"cveId"`
	OrgID  string `json:"assignerOrgId,omitempty"`
	Serial int    `json:"serial,omitempty"`
	State  State  `json:"state,omitempty"`
}

type ProblemType

type ProblemType struct {
	Descriptions []ProblemTypeDescription `json:"descriptions"`
}

type ProblemTypeDescription

type ProblemTypeDescription struct {
	Lang        string `json:"lang"`
	Description string `json:"description"`
}

type ProgramRoutine

type ProgramRoutine struct {
	Name string `json:"name"`
}

type ProviderMetadata

type ProviderMetadata struct {
	OrgID string `json:"orgId"`
}

type Reference

type Reference struct {
	URL string `json:"url"`
}

type State

type State string
const (
	StateReserved  State = "RESERVED"
	StatePublished State = "PUBLISHED"
	StateRejected  State = "REJECTED"
)

type Version

type Version string

type VersionRange

type VersionRange struct {
	Introduced  Version       `json:"version"`
	Fixed       Version       `json:"lessThan"`
	Status      VersionStatus `json:"status"`
	VersionType string        `json:"versionType"`
}

type VersionStatus

type VersionStatus string
const (
	StatusAffected   VersionStatus = "affected"
	StatusUnaffected VersionStatus = "unaffected"
	StatusUnknown    VersionStatus = "unknown"
)

Jump to

Keyboard shortcuts

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