ovaltoosv

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ovaltoosv converts OVAL vulnerability definitions to OSV format.

Installation

go get github.com/jeffmendoza/ovaltoosv/ovaltoosv

Usage

Create a converter, parse OVAL XML, convert to OSV, and retrieve the results:

c := ovaltoosv.NewConverter()

err := c.ParseOVAL(ovalXMLContent)
if err != nil {
    // handle error
}

err = c.ConvertToOSV()
if err != nil {
    // handle error
}

// Get JSON output as map of ID -> JSON bytes
jsonOutput, err := c.GetJSON()
if err != nil {
    // handle error
}

for id, jsonBytes := range jsonOutput {
    // write each vulnerability to a file, etc.
}

// Or access vulnerabilities directly as OSV schema objects
vulns := c.GetVulnerabilities()
for id, vuln := range vulns {
    // work with osvschema.Vulnerability objects
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter converts OVAL vulnerability definitions to OSV format.

func NewConverter

func NewConverter() *Converter

NewConverter returns a new Converter.

func (*Converter) ConvertToOSV

func (c *Converter) ConvertToOSV() error

ConvertToOSV converts the parsed OVAL data to OSV format.

func (*Converter) GetJSON

func (c *Converter) GetJSON() (map[string][]byte, error)

GetJSON returns a map of vulnerability IDs to their JSON byte representations.

func (*Converter) GetVulnerabilities

func (c *Converter) GetVulnerabilities() map[string]*osvschema.Vulnerability

GetVulnerabilities returns a map of vulnerability IDs to their OSV representations.

func (*Converter) ParseOVAL

func (c *Converter) ParseOVAL(input string) error

ParseOVAL parses OVAL XML input and stores it internally for conversion.

Jump to

Keyboard shortcuts

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