oval

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advisory

type Advisory struct {
	XMLName         xml.Name       `xml:"advisory"`
	Severity        string         `xml:"severity"`
	Cves            []Cve          `xml:"cve"`
	Bugzillas       []Bugzilla     `xml:"bugzilla"`
	AffectedCPEList []string       `xml:"affected_cpe_list>cpe"`
	Refs            []Ref          `xml:"ref"` // Ubuntu Only
	Bugs            []Bug          `xml:"bug"` // Ubuntu Only
	PublicDate      Date           `xml:"public_date"`
	Issued          Date           `xml:"issued"`
	Updated         Date           `xml:"updated"`
	Affected        AffectedStatus `xml:"affected"` // Red Hat Only
}

Advisory : >definitions>definition>metadata>advisory RedHat and Ubuntu OVAL

type Affected

type Affected struct {
	XMLName   xml.Name `xml:"affected"`
	Family    string   `xml:"family,attr"`
	Platforms []string `xml:"platform"`
}

Affected : >definitions>definition>metadata>affected

type AffectedStatus

type AffectedStatus struct {
	Resolutions []Resolution `xml:"resolution"`
}

AffectedStatus documentation: https://access.redhat.com/articles/5554431 section Oct 13, 2021 Oval

type Arch

type Arch struct {
	XMLName   xml.Name  `xml:"arch"`
	Operation Operation `xml:"operation,attr"`
	Body      string    `xml:",chardata"`
}

Arch

type Bug

type Bug struct {
	XMLName xml.Name `xml:"bug"`
	URL     string   `xml:",chardata"`
}

Bug : >definitions>definition>metadata>advisory>bug Ubuntu OVAL

type Bugzilla

type Bugzilla struct {
	XMLName xml.Name `xml:"bugzilla"`
	ID      string   `xml:"id,attr"`
	URL     string   `xml:"href,attr"`
	Title   string   `xml:",chardata"`
}

Bugzilla : >definitions>definition>metadata>advisory>bugzilla RedHat OVAL

type ConfigLine

type ConfigLine struct {
	XMLName   xml.Name `xml:"config_line"`
	Body      string   `xml:",chardata"`
	Operation string   `xml:"operation,attr"`
}

ConfigLine : >states>line_state>config_line

type ConstantVariable

type ConstantVariable struct {
	XMLName  xml.Name `xml:"constant_variable"`
	ID       string   `xml:"id,attr"`
	Version  string   `xml:"version,attr"`
	Datatype string   `xml:"datatype,attr"`
	Comment  string   `xml:"comment,attr"`
	Values   []Value  `xml:"value"`
}

ConstantVariable

type Criteria

type Criteria struct {
	XMLName    xml.Name    `xml:"criteria"`
	Operator   string      `xml:"operator,attr"`
	Criterias  []Criteria  `xml:"criteria"`
	Criterions []Criterion `xml:"criterion"`
}

Criteria : >definitions>definition>criteria

type Criterion

type Criterion struct {
	XMLName xml.Name `xml:"criterion"`
	Negate  bool     `xml:"negate,attr"`
	TestRef string   `xml:"test_ref,attr"`
	Comment string   `xml:"comment,attr"`
}

Criterion : >definitions>definition>criteria>*>criterion

type Cve

type Cve struct {
	XMLName      xml.Name `xml:"cve"`
	CveID        string   `xml:",chardata"`
	Cvss2        string   `xml:"cvss2,attr"`
	Cvss3        string   `xml:"cvss3,attr"`
	CvssScore    string   `xml:"cvss_score,attr"`
	CvssSeverity string   `xml:"cvss_severity,attr"`
	Priority     string   `xml:"priority,attr"`
	Cwe          string   `xml:"cwe,attr"`
	Impact       string   `xml:"impact,attr"`
	Href         string   `xml:"href,attr"`
	Public       string   `xml:"public,attr"`
}

Cve : >definitions>definition>metadata>advisory>cve RedHat OVAL

type Date

type Date struct {
	Date time.Time
}

Date is a wrapper type for decoding a range of date, datestamp, and timestamp strings seen in the wild.

Currently, it will only examine attributes with the key "date".

func (*Date) UnmarshalXML

func (d *Date) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements xml.Unmarshaler.

func (*Date) UnmarshalXMLAttr

func (d *Date) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr implements xml.UnmarshalerAttr.

type Debian

type Debian struct {
	XMLName  xml.Name `xml:"debian"`
	MoreInfo string   `xml:"moreinfo"`
	Date     Date     `xml:"date"`
}

Debian : >definitions>definition>metadata>debian

type Definition

type Definition struct {
	XMLName     xml.Name    `xml:"definition"`
	ID          string      `xml:"id,attr"`
	Class       string      `xml:"class,attr"`
	Title       string      `xml:"metadata>title"`
	Affecteds   []Affected  `xml:"metadata>affected"`
	References  []Reference `xml:"metadata>reference"`
	Description string      `xml:"metadata>description"`
	Advisory    Advisory    `xml:"metadata>advisory"` // RedHat, Oracle, Ubuntu
	Debian      Debian      `xml:"metadata>debian"`   // Debian
	Criteria    Criteria    `xml:"criteria"`
}

Definition : >definitions>definition

type Definitions

type Definitions struct {
	XMLName     xml.Name     `xml:"definitions"`
	Definitions []Definition `xml:"definition"`
}

Definitions : >definitions

type DpkgInfoObject

type DpkgInfoObject struct {
	XMLName xml.Name  `xml:"dpkginfo_object"`
	ID      string    `xml:"id,attr"`
	Version int       `xml:"version,attr"`
	Name    *DpkgName `xml:"name"`
}

DpkgInfoObject : >objects>dpkginfo_object

type DpkgInfoState

type DpkgInfoState struct {
	XMLName     xml.Name `xml:"dpkginfo_state"`
	ID          string   `xml:"id,attr"`
	Version     int      `xml:"version,attr"`
	Arch        *Arch    `xml:"arch"`
	Epoch       *Epoch   `xml:"epoch"`
	Release     *Release `xml:"release"`
	DpkgVersion *Version `xml:"version"`
	EVR         *EVR     `xml:"evr"`
}

DpkgInfoState : >states>dpkginfo_state

type DpkgInfoTest

type DpkgInfoTest struct {
	XMLName xml.Name `xml:"dpkginfo_test"`
	ID      string   `xml:"id,attr"`
	Comment string   `xml:"comment,attr"`
	Check   string   `xml:"check,attr"`
	Version int      `xml:"version,attr"`
	// contains filtered or unexported fields
}

DpkgInfoTest : >tests>dpkginfo_test

func (*DpkgInfoTest) ObjectRef

func (t *DpkgInfoTest) ObjectRef() []ObjectRef

func (*DpkgInfoTest) StateRef

func (t *DpkgInfoTest) StateRef() []StateRef

type DpkgName

type DpkgName struct {
	XMLName xml.Name `xml:"name"`
	Ref     string   `xml:"var_ref,attr"`
	Body    string   `xml:",chardata"`
}

DpkgName : >objects>dpkginfo_object>name

when parsing ubuntu var_ref is a reference to the <variables> section of the document

when parsing debian var_ref is empty and the Body field is used directly

type EVR

type EVR struct {
	XMLName   xml.Name  `xml:"evr"`
	Operation Operation `xml:"operation,attr"`
	Body      string    `xml:",chardata"`
}

EVR

type Epoch

type Epoch struct {
	XMLName   xml.Name  `xml:"epoch"`
	Operation Operation `xml:"operation,attr"`
	Body      string    `xml:",chardata"`
}

Epoch

type ErrNotFound

type ErrNotFound string

ErrNotFound is returned by Lookup methods when the specified identifier is not found.

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type Generator

type Generator struct {
	XMLName        xml.Name `xml:"generator"`
	ProductName    string   `xml:"product_name"`
	ProductVersion string   `xml:"product_version"`
	SchemaVersion  string   `xml:"schema_version"`
	Timestamp      string   `xml:"timestamp"`
}

Generator : >generator

type ID

type ID struct {
	Namespace string
	Type      IDType
	Value     int64
}

ID is an OVAL identifier.

func ParseID

func ParseID(ref string) (*ID, error)

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type IDType

type IDType int

IDType enumerates the valid OVAL identifier types.

const (
	OvalDefinition IDType // def
	OvalTest              // tst
	OvalObject            // obj
	OvalState             // ste
	OvalVariable          // var
)

This block declares the valid OVAL identifier types.

func (IDType) String

func (i IDType) String() string

func (*IDType) UnmarshalText

func (i *IDType) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type LineObject

type LineObject struct {
	XMLName         xml.Name `xml:"line_object"`
	ID              string   `xml:"id,attr"`
	ShowSubcommands []string `xml:"show_subcommand"`
}

LineObject : >objects>line_object

type LineState

type LineState struct {
	XMLName        xml.Name   `xml:"line_state"`
	ID             string     `xml:"id,attr"`
	ShowSubcommand string     `xml:"show_subcommand"`
	ConfigLine     ConfigLine `xml:"config_line"`
}

LineState : >states>line_state

type LineTest

type LineTest struct {
	XMLName       xml.Name `xml:"line_test"`
	ID            string   `xml:"id,attr"`
	StateOperator string   `xml:"state_operator,attr"`
	Comment       string   `xml:"comment,attr"`
	// contains filtered or unexported fields
}

LineTest : >tests>line_test

func (*LineTest) ObjectRef

func (t *LineTest) ObjectRef() []ObjectRef

func (*LineTest) StateRef

func (t *LineTest) StateRef() []StateRef

type ObjectRef

type ObjectRef struct {
	XMLName   xml.Name `xml:"object"`
	ObjectRef string   `xml:"object_ref,attr"`
}

ObjectRef : >tests>line_test>object-object_ref

: >tests>version55_test>object-object_ref

type Objects

type Objects struct {
	XMLName                  xml.Name                  `xml:"objects"`
	LineObjects              []LineObject              `xml:"line_object"`
	Version55Objects         []Version55Object         `xml:"version55_object"`
	TextfileContent54Objects []TextfileContent54Object `xml:"textfilecontent54_object"`
	RPMInfoObjects           []RPMInfoObject           `xml:"rpminfo_object"`
	RPMVerifyFileObjects     []RPMVerifyFileObject     `xml:"rpmverifyfile_object"`
	DpkgInfoObjects          []DpkgInfoObject          `xml:"dpkginfo_object"`
	// contains filtered or unexported fields
}

Objects : >objects

func (*Objects) Lookup

func (o *Objects) Lookup(ref string) (kind string, index int, err error)

Lookup returns the kind of object and index into that kind-specific slice, if found.

type Operation

type Operation int
const (
	OpEquals                   Operation // equals
	OpNotEquals                          // not equals
	OpCaseInsensitiveEquals              // case insensitive equals
	OpCaseInsensitiveNotEquals           // case insensitive not equals
	OpGreaterThan                        // greater than
	OpLessThan                           // less than
	OpGreaterThanOrEqual                 // greater than or equal
	OpLessThanOrEqual                    // less than or equal
	OpBitwiseAnd                         // bitwise and
	OpBitwiseOr                          // bitwise or
	OpPatternMatch                       // pattern match
	OpSubset                             // subset of
	OpSuperset                           // superset of
)

func (Operation) String

func (i Operation) String() string

func (*Operation) UnmarshalText

func (o *Operation) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type RPMInfoObject

type RPMInfoObject struct {
	XMLName xml.Name `xml:"rpminfo_object"`
	ID      string   `xml:"id,attr"`
	Version int      `xml:"version,attr"`
	Name    string   `xml:"name"`
}

RPMInfoObject : >objects>RPMInfo_object

type RPMInfoState

type RPMInfoState struct {
	XMLName        xml.Name           `xml:"rpminfo_state"`
	ID             string             `xml:"id,attr"`
	Version        int                `xml:"version,attr"`
	Arch           *Arch              `xml:"arch"`
	Epoch          *Epoch             `xml:"epoch"`
	Release        *Release           `xml:"release"`
	RPMVersion     *Version           `xml:"version"`
	EVR            *EVR               `xml:"evr"`
	SignatureKeyID *RPMSignatureKeyID `xml:"signature_keyid"`
}

RPMInfoState : >states>rpminfo_state

type RPMInfoTest

type RPMInfoTest struct {
	XMLName xml.Name `xml:"rpminfo_test"`
	ID      string   `xml:"id,attr"`
	Comment string   `xml:"comment,attr"`
	Check   string   `xml:"check,attr"`
	Version int      `xml:"version,attr"`
	// contains filtered or unexported fields
}

RPMInfoTest : >tests>rpminfo_test

func (*RPMInfoTest) ObjectRef

func (t *RPMInfoTest) ObjectRef() []ObjectRef

func (*RPMInfoTest) StateRef

func (t *RPMInfoTest) StateRef() []StateRef

type RPMSignatureKeyID

type RPMSignatureKeyID struct {
	XMLName   xml.Name  `xml:"signature_keyid"`
	Operation Operation `xml:"operation,attr"`
	Body      string    `xml:",chardata"`
}

type RPMVerifyFileObject

type RPMVerifyFileObject struct {
	XMLName    xml.Name            `xml:"rpmverifyfile_object"`
	ID         string              `xml:"id,attr"`
	Version    int                 `xml:"version,attr"`
	Behaviors  VerifyFileBehaviors `xml:"behaviors"`
	Name       VerifyFileOp        `xml:"name"`
	Epoch      VerifyFileOp        `xml:"epoch"`
	Release    VerifyFileOp        `xml:"release"`
	RPMVersion VerifyFileOp        `xml:"version"`
	Arch       VerifyFileOp        `xml:"arch"`
	Filepath   string              `xml:"filepath"`
}

type RPMVerifyFileTest

type RPMVerifyFileTest struct {
	XMLName xml.Name `xml:"rpmverifyfile_test"`
	ID      string   `xml:"id,attr"`
	Comment string   `xml:"comment,attr"`
	Check   string   `xml:"check,attr"`
	Version int      `xml:"version,attr"`
	// contains filtered or unexported fields
}

RPMVerifyFileTest : >tests>rpmverifyfile_test

func (*RPMVerifyFileTest) ObjectRef

func (t *RPMVerifyFileTest) ObjectRef() []ObjectRef

func (*RPMVerifyFileTest) StateRef

func (t *RPMVerifyFileTest) StateRef() []StateRef

type Ref

type Ref struct {
	XMLName xml.Name `xml:"ref"`
	URL     string   `xml:",chardata"`
}

Ref : >definitions>definition>metadata>advisory>ref Ubuntu OVAL

type Reference

type Reference struct {
	XMLName xml.Name `xml:"reference"`
	Source  string   `xml:"source,attr"`
	RefID   string   `xml:"ref_id,attr"`
	RefURL  string   `xml:"ref_url,attr"`
}

Reference : >definitions>definition>metadata>reference

type Release

type Release struct {
	XMLName   xml.Name  `xml:"release"`
	Operation Operation `xml:"operation,attr"`
	Body      string    `xml:",chardata"`
}

Release

type Resolution

type Resolution struct {
	State      string   `xml:"state,attr"`
	Components []string `xml:"component"`
}

Resolution state values are one of: Affected, Under investigation, Will not fix, Out of support scope, and Fix deferred

type Root

type Root struct {
	XMLName     xml.Name    `xml:"oval_definitions"`
	Generator   Generator   `xml:"generator"`
	Definitions Definitions `xml:"definitions"`
	Tests       Tests       `xml:"tests"`
	Objects     Objects     `xml:"objects"`
	States      States      `xml:"states"`
	Variables   Variables   `xml:"variables"`
}

Root : root object

type StateRef

type StateRef struct {
	XMLName  xml.Name `xml:"state"`
	StateRef string   `xml:"state_ref,attr"`
}

StateRef : >tests>line_test>state-state_ref

: >tests>version55_test>state-state_ref

type States

type States struct {
	XMLName         xml.Name         `xml:"states"`
	LineStates      []LineState      `xml:"line_state"`
	Version55States []Version55State `xml:"version55_state"`
	RPMInfoStates   []RPMInfoState   `xml:"rpminfo_state"`
	DpkgInfoStates  []DpkgInfoState  `xml:"dpkginfo_state"`
	// contains filtered or unexported fields
}

States : >states

func (*States) Lookup

func (s *States) Lookup(ref string) (kind string, index int, err error)

Lookup returns the kind of object and index into that kind-specific slice, if found.

type TCInstance

type TCInstance struct {
	XMLName  xml.Name `xml:"instance"`
	Instance string   `xml:",chardata"`
	Kind     string   `xml:"datatype,attr"`
}

type Test

type Test interface {
	ObjectRef() []ObjectRef
	StateRef() []StateRef
}

Test is an interface for OVAL objects that reports Object and State refs.

type Tests

type Tests struct {
	XMLName                xml.Name                `xml:"tests"`
	LineTests              []LineTest              `xml:"line_test"`
	Version55Tests         []Version55Test         `xml:"version55_test"`
	RPMInfoTests           []RPMInfoTest           `xml:"rpminfo_test"`
	DpkgInfoTests          []DpkgInfoTest          `xml:"dpkginfo_test"`
	RPMVerifyFileTests     []RPMVerifyFileTest     `xml:"rpmverifyfile_test"`
	UnameTests             []UnameTest             `xml:"uname_test"`
	TextfileContent54Tests []TextfileContent54Test `xml:"textfilecontent54_test"`
	// contains filtered or unexported fields
}

Tests : >tests

func (*Tests) Lookup

func (t *Tests) Lookup(ref string) (kind string, index int, err error)

Lookup returns the kind of test and index into that kind-specific slice, if found.

type TextfileContent54Object

type TextfileContent54Object struct {
	XMLName  xml.Name   `xml:"textfilecontent54_object"`
	ID       string     `xml:"id,attr"`
	Version  int        `xml:"version,attr"`
	Filepath string     `xml:"filepath"`
	Pattern  string     `xml:"pattern"`
	Instance TCInstance `xml:"instance"`
}

TextfileContent54Object : >tests>textfilecontent54_object

type TextfileContent54Test

type TextfileContent54Test struct {
	XMLName       xml.Name `xml:"textfilecontent54_test"`
	ID            string   `xml:"id,attr"`
	StateOperator string   `xml:"state_operator,attr"`
	Comment       string   `xml:"comment,attr"`
	// contains filtered or unexported fields
}

TextfileContent54Test : >tests>textfilecontent54_test

func (*TextfileContent54Test) ObjectRef

func (t *TextfileContent54Test) ObjectRef() []ObjectRef

func (*TextfileContent54Test) StateRef

func (t *TextfileContent54Test) StateRef() []StateRef

type UnameTest

type UnameTest struct {
	XMLName xml.Name `xml:"uname_test"`
	ID      string   `xml:"id,attr"`
	Comment string   `xml:"comment,attr"`
	Check   string   `xml:"check,attr"`
	Version int      `xml:"version,attr"`
	// contains filtered or unexported fields
}

UnameTest : >tests>uname_test

func (*UnameTest) ObjectRef

func (t *UnameTest) ObjectRef() []ObjectRef

func (*UnameTest) StateRef

func (t *UnameTest) StateRef() []StateRef

type Value

type Value struct {
	XMLName xml.Name `xml:"value"`
	Body    string   `xml:",chardata"`
}

Value

type Variables

type Variables struct {
	XMLName           xml.Name           `xml:"variables"`
	ConstantVariables []ConstantVariable `xml:"constant_variable"`
	// contains filtered or unexported fields
}

Variables : >variables

func (*Variables) Lookup

func (o *Variables) Lookup(ref string) (kind string, index int, err error)

Lookup returns the kind of object and index into that kind-specific slice, if found.

type VerifyFileBehaviors

type VerifyFileBehaviors struct {
	XMLName       xml.Name `xml:"behaviors"`
	NoConfigFiles bool     `xml:"noconfigfiles"`
	NoGhostFiles  bool     `xml:"noghostfiles"`
	NoGroup       bool     `xml:"nogroup"`
	NoLinkTo      bool     `xml:"nolinkto"`
	NoMD5         bool     `xml:"nomd5"`
	NoMode        bool     `xml:"nomode"`
	NoMTime       bool     `xml:"nomtime"`
	NoRDev        bool     `xml:"nordev"`
	NoSize        bool     `xml:"nosize"`
	NoUser        bool     `xml:"nouser"`
}

type VerifyFileOp

type VerifyFileOp struct {
	XMLName xml.Name
	Op      string `xml:"operation,attr"`
}

type Version

type Version struct {
	XMLName   xml.Name  `xml:"version"`
	Operation Operation `xml:"operation,attr"`
	Body      string    `xml:",chardata"`
}

Version

type Version55Object

type Version55Object struct {
	XMLName xml.Name `xml:"version55_object"`
	ID      string   `xml:"id,attr"`
}

Version55Object : >objects>version55_object

type Version55State

type Version55State struct {
	XMLName       xml.Name `xml:"version55_state"`
	ID            string   `xml:"id,attr"`
	VersionString string   `xml:"version_string"`
}

Version55State : >states>version55_state

type Version55Test

type Version55Test struct {
	XMLName       xml.Name `xml:"version55_test"`
	ID            string   `xml:"id,attr"`
	StateOperator string   `xml:"state_operator,attr"`
	Comment       string   `xml:"comment,attr"`
	// contains filtered or unexported fields
}

Version55Test : >tests>version55_test

func (*Version55Test) ObjectRef

func (t *Version55Test) ObjectRef() []ObjectRef

func (*Version55Test) StateRef

func (t *Version55Test) StateRef() []StateRef

Jump to

Keyboard shortcuts

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