File: models.go

package info (click to toggle)
goval-dictionary 0.2.0-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 424 kB
  • sloc: makefile: 2
file content (116 lines) | stat: -rw-r--r-- 2,448 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package models

import (
	"time"
)

// FetchMeta has metadata
type FetchMeta struct {
	ID uint `gorm:"primary_key"`

	FileName  string
	Timestamp time.Time
}

// Root is root struct
type Root struct {
	ID uint `gorm:"primary_key"`
	//  Timestamp   time.Time
	Family      string
	OSVersion   string
	Definitions []Definition
	Timestamp   time.Time
}

// Definition : >definitions>definition
type Definition struct {
	ID     uint `gorm:"primary_key"`
	RootID uint `json:"-" xml:"-"`

	DefinitionID  string
	Title         string
	Description   string `sql:"type:text"`
	Advisory      Advisory
	Debian        Debian
	AffectedPacks []Package
	References    []Reference
}

// Package affedted
type Package struct {
	ID           uint `gorm:"primary_key"`
	DefinitionID uint `json:"-" xml:"-"`

	Name        string
	Version     string // affected earlier than this version
	Arch        string // Used for Amazon Linux
	NotFixedYet bool   // Ubuntu Only
}

// Reference : >definitions>definition>metadata>reference
type Reference struct {
	ID           uint `gorm:"primary_key"`
	DefinitionID uint `json:"-" xml:"-"`

	Source string
	RefID  string
	RefURL string
}

// Advisory : >definitions>definition>metadata>advisory
type Advisory struct {
	ID           uint `gorm:"primary_key"`
	DefinitionID uint `json:"-" xml:"-"`

	Severity        string
	Cves            []Cve
	Bugzillas       []Bugzilla
	AffectedCPEList []Cpe
	Issued          time.Time
	Updated         time.Time
}

// Cve : >definitions>definition>metadata>advisory>cve
// RedHat OVAL
type Cve struct {
	ID         uint `gorm:"primary_key"`
	AdvisoryID uint `json:"-" xml:"-"`

	CveID  string
	Cvss2  string
	Cvss3  string
	Cwe    string
	Impact string
	Href   string
	Public string
}

// Bugzilla : >definitions>definition>metadata>advisory>bugzilla
// RedHat OVAL
type Bugzilla struct {
	ID         uint `gorm:"primary_key"`
	AdvisoryID uint `json:"-" xml:"-"`

	BugzillaID string
	URL        string
	Title      string
}

// Cpe : >definitions>definition>metadata>advisory>affected_cpe_list
type Cpe struct {
	ID         uint `gorm:"primary_key"`
	AdvisoryID uint `json:"-" xml:"-"`

	Cpe string
}

// Debian : >definitions>definition>metadata>debian
type Debian struct {
	ID           uint `gorm:"primary_key"`
	DefinitionID uint `json:"-" xml:"-"`

	CveID    string
	MoreInfo string `sql:"type:text"` // https://github.com/jinzhu/gorm/issues/510#issuecomment-180669092

	Date time.Time
}