lsncatalog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CVEIdRegex is the regular expression used to extract CVE IDs from LSN data.
	CVEIdRegex = regexp.MustCompile(`^UBUNTU-CVE-\d+-\d+$`)
)

Functions

func ComputeDigest

func ComputeDigest(lsnMap map[string]LSNData) (string, error)

ComputeDigest returns a base64 digest for a map of LSN data. The digest is stable regardless of the ordering of LSNs in the map.

func ProcessZIP

func ProcessZIP(data []byte) (map[string]LSNData, error)

ProcessZIP processes ZIP data from a byte slice and returns LSN data. This is more memory-efficient than ReadZIP when the data is already in memory, as it avoids an additional io.ReadAll() call.

The LSN files in the archive must start with "LSN-" and end with ".json". Any files not matching these criteria will be ignored.

Returns a map of LSN ID to LSNData.

func ReadXZ

func ReadXZ(reader io.Reader) (map[string]LSNData, error)

ReadXZ reads LSN data from a .tar.xz stream.

The LSN files in the archive must be organised under the `osv/lsn/` prefix. They must also start with "LSN-" and end with ".json". Any files not matching these criteria will be ignored.

Returns a map of LSN ID to LSNData.

The caller is responsible for closing the provided stream.

func ReadZIP

func ReadZIP(reader io.Reader) (map[string]LSNData, error)

ReadZIP reads LSN data from a ZIP archive stream.

The LSN files in the archive must start with "LSN-" and end with ".json". Any files not matching these criteria will be ignored.

Returns a map of LSN ID to LSNData.

Types

type LSN

type LSN struct {
	SchemaVersion string   `json:"schema_version"`
	ID            string   `json:"id"`
	Published     string   `json:"published"`
	Modified      string   `json:"modified"`
	Upstream      []string `json:"upstream"` // This field contains the CVE IDs related to this LSN, among other information.
	Summary       string   `json:"summary"`
	Details       string   `json:"details"`
}

LSN represents a Livepatch Security Notice in OSV format.

type LSNData

type LSNData struct {
	// ID is the unique identifier of the LSN, typically in the format "LSN-YYYY-NNNN".
	ID string `json:"ID"`
	// Published is the time when the LSN was published.
	Published string `json:"Published"`
	// Modified is the last modification time of the LSN.
	Modified string `json:"Modified"`
	// CVEIDs is a list of CVE IDs extracted from the LSN Upstream field.
	CVEIDs []string `json:"CVEIDs"`
}

LSNData is a simplified representation of LSN data for storage and API responses.

Jump to

Keyboard shortcuts

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