validation

package
v0.0.0-...-aa5ad11 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TimeLayout = schema.TimeLayout

Variables

This section is empty.

Functions

func Validate

func Validate(fileName string, cveFile *CVESchema) error

Validate ensures a given CVE file is valid.

Types

type AffectedSchema

type AffectedSchema struct {
	Range   string `json:"range"`
	FixedBy string `json:"fixedBy"`
}

AffectedSchema is the schema for the affected section of the CVE file.

type CVESchema

type CVESchema struct {
	CVE         string           `json:"cve"`
	URL         string           `json:"url"`
	IssueURL    string           `json:"issueUrl"`
	Published   Time             `json:"published"`
	Description string           `json:"description"`
	Components  []string         `json:"components"`
	CVSS        *CVSSSchema      `json:"cvss"`
	Affected    []AffectedSchema `json:"affected"`
}

CVESchema is the schema for the entire CVE file.

type CVSSSchema

type CVSSSchema struct {
	NVD        *NVDSchema        `json:"nvd"`
	Kubernetes *KubernetesSchema `json:"kubernetes"`
}

CVSSSchema is the schema for the CVSS section of the CVE file.

type KubernetesSchema

type KubernetesSchema struct {
	ScoreV3  float64 `json:"scoreV3"`
	VectorV3 string  `json:"vectorV3"`
}

KubernetesSchema is the schema for the Kubernetes subsection of the CVE file.

type NVDSchema

type NVDSchema struct {
	ScoreV2  float64 `json:"scoreV2"`
	VectorV2 string  `json:"vectorV2"`
	ScoreV3  float64 `json:"scoreV3"`
	VectorV3 string  `json:"vectorV3"`
}

NVDSchema is the schema for the NVD subsection of the CVE file.

type Time

type Time struct {
	time.Time
}

Time is a wrapper around time.Time. The default UnmarshalJSON for time.Time expects the time.RFC3339 format, which is not what is used in this repo.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON is inspired by the Go 1.18 (*time.Time).UnmarshalJSON implementation https://cs.opensource.google/go/go/+/refs/tags/go1.18:src/time/time.go;l=1298.

Jump to

Keyboard shortcuts

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