models

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const LatestSchemaVersion = 3

LatestSchemaVersion manages the Schema version used in the latest Gost.

Variables

This section is empty.

Functions

func ConvertMicrosoft added in v0.4.1

func ConvertMicrosoft(vulns []MicrosoftVulnerability, supercedences []MicrosoftSupercedence) ([]MicrosoftCVE, []MicrosoftKBRelation)

ConvertMicrosoft :

Types

type DebianCVE

type DebianCVE struct {
	ID          int64  `json:"-"`
	CveID       string `gorm:"index:idx_debian_cves_cveid;type:varchar(255);"`
	Scope       string `gorm:"type:varchar(255)"`
	Description string `gorm:"type:text"`
	Package     []DebianPackage
}

DebianCVE :

func ConvertDebian added in v0.4.1

func ConvertDebian(cveJSONs DebianJSON) []DebianCVE

ConvertDebian :

type DebianCveJSON

type DebianCveJSON struct {
	Scope       string                       `json:"scope"`
	Debianbug   int                          `json:"debianbug"`
	Description string                       `json:"description"`
	Releases    map[string]DebianReleaseJSON `json:"releases"`
}

DebianCveJSON :

type DebianCveMap

type DebianCveMap map[string]DebianCveJSON

DebianCveMap :

type DebianJSON

type DebianJSON map[string]DebianCveMap

DebianJSON :

type DebianPackage

type DebianPackage struct {
	ID          int64  `json:"-"`
	DebianCVEID int64  `json:"-" gorm:"index:idx_debian_packages_debian_cve_id"`
	PackageName string `gorm:"type:varchar(255);index:idx_debian_packages_package_name"`
	Release     []DebianRelease
}

DebianPackage :

type DebianRelease

type DebianRelease struct {
	ID              int64  `json:"-"`
	DebianPackageID int64  `json:"-" gorm:"index:idx_debian_releases_debian_package_id"`
	ProductName     string `gorm:"type:varchar(255);index:idx_debian_releases_product_name"`
	Status          string `gorm:"type:varchar(255);index:idx_debian_releases_status"`
	FixedVersion    string `gorm:"type:varchar(255);"`
	Urgency         string `gorm:"type:varchar(255);"`
	Version         string `gorm:"type:varchar(255);"`
}

DebianRelease :

type DebianReleaseJSON

type DebianReleaseJSON struct {
	Status       string            `json:"status"`
	Repositories map[string]string `json:"repositories"`
	FixedVersion string            `json:"fixed_version"`
	Urgency      string            `json:"urgency"`
}

DebianReleaseJSON :

type FetchMeta added in v0.3.0

type FetchMeta struct {
	gorm.Model    `json:"-"`
	GostRevision  string
	SchemaVersion uint
	LastFetchedAt time.Time
}

FetchMeta has meta information about fetched security tracker

func (FetchMeta) OutDated added in v0.3.0

func (f FetchMeta) OutDated() bool

OutDated checks whether last fetched feed is out dated

type MicrosoftCVE added in v0.3.0

type MicrosoftCVE struct {
	ID              int64              `json:"-"`
	CveID           string             `json:"cve_id" gorm:"type:varchar(255);index:idx_microsoft_cves_cveid"`
	Title           string             `json:"title" gorm:"type:varchar(255)"`
	Description     string             `json:"description" gorm:"type:text"`
	FAQ             string             `json:"faq" gorm:"type:text"`
	Tag             string             `json:"tag" gorm:"type:varchar(255)"`
	CNA             string             `json:"cna" gorm:"type:varchar(255)"`
	ExploitStatus   string             `json:"exploit_status" gorm:"type:varchar(255)"`
	Mitigation      string             `json:"mitigation" gorm:"type:text"`
	Workaround      string             `json:"workaround" gorm:"type:text"`
	Products        []MicrosoftProduct `json:"products"`
	URL             string             `json:"url" gorm:"type:varchar(255)"`
	Acknowledgments string             `json:"acknowledgments" gorm:"type:text"`
	PublishDate     time.Time          `json:"publish_date"`
	LastUpdateDate  time.Time          `json:"last_update_date"`
}

MicrosoftCVE :

type MicrosoftKB added in v0.4.2

type MicrosoftKB struct {
	ID                 int64  `json:"-"`
	MicrosoftProductID int64  `json:"-" gorm:"index:idx_microsoft_kb_microsoft_product_id"`
	Article            string `json:"article" gorm:"type:varchar(255);index:idx_microsoft_kb_article"`
	RestartRequired    string `json:"restart_required" gorm:"type:varchar(255)"`
	SubType            string `json:"sub_type" gorm:"type:varchar(255)"`
	FixedBuild         string `json:"fixed_build" gorm:"type:varchar(255)"`
	ArticleURL         string `json:"article_url" gorm:"type:varchar(255)"`
	DownloadURL        string `json:"download_url" gorm:"type:varchar(255)"`
}

MicrosoftKB :

type MicrosoftKBRelation added in v0.4.1

type MicrosoftKBRelation struct {
	ID           int64  `json:"-"`
	KBID         string `json:"kbid" gorm:"type:varchar(255);index:idx_microsoft_relation_kb_id"`
	SupersededBy []MicrosoftSupersededBy
}

MicrosoftKBRelation :

type MicrosoftProduct added in v0.3.0

type MicrosoftProduct struct {
	ID             int64             `json:"-"`
	MicrosoftCVEID int64             `json:"-" gorm:"index:idx_microsoft_product_microsoft_cve_id"`
	ProductID      string            `json:"product_id" gorm:"type:varchar(255)"`
	Name           string            `json:"name" gorm:"type:varchar(255)"`
	Impact         string            `json:"impact" gorm:"type:varchar(255)"`
	Severity       string            `json:"severity" gorm:"type:varchar(255)"`
	ScoreSet       MicrosoftScoreSet `json:"score_set"`
	KBs            []MicrosoftKB     `json:"kbs"`
}

MicrosoftProduct :

type MicrosoftScoreSet added in v0.3.0

type MicrosoftScoreSet struct {
	ID                 int64  `json:"-"`
	MicrosoftProductID int64  `json:"-" gorm:"index:idx_microsoft_score_set_microsoft_product_id"`
	BaseScore          string `json:"base_score" gorm:"type:varchar(255)"`
	TemporalScore      string `json:"temporal_score" gorm:"type:varchar(255)"`
	Vector             string `json:"vector" gorm:"type:varchar(255)"`
}

MicrosoftScoreSet :

type MicrosoftSupercedence added in v0.4.2

type MicrosoftSupercedence struct {
	KBID         string `json:"KBID"`
	UpdateID     string `json:"UpdateID"`
	Product      string `json:"Product"`
	Supersededby struct {
		KBIDs     []string `json:"KBIDs"`
		UpdateIDs []string `json:"UpdateIDs"`
	} `json:"Supersededby"`
}

MicrosoftSupercedence :

type MicrosoftSupersededBy added in v0.4.1

type MicrosoftSupersededBy struct {
	ID                    int64  `json:"-"`
	MicrosoftKBRelationID int64  `json:"-" gorm:"index:idx_microsoft_superseded_by_microsoft_kb_relation_id"`
	KBID                  string `json:"kbid" gorm:"type:varchar(255);index:idx_microsoft_superseded_by_kb_id"`
}

MicrosoftSupersededBy :

type MicrosoftVulnerability added in v0.4.2

type MicrosoftVulnerability struct {
	CveID         string   `json:"CVEID"`
	Title         string   `json:"Title"`
	Description   string   `json:"Description"`
	FAQs          []string `json:"FAQs"`
	Tag           string   `json:"Tag"`
	CNA           string   `json:"CNA"`
	ExploitStatus string   `json:"ExploitStatus"`
	Mitigation    string   `json:"Mitigation"`
	Workaround    string   `json:"Workaround"`
	Products      []struct {
		ProductID string `json:"ProductID"`
		Name      string `json:"Name"`
		Impact    string `json:"Impact"`
		Severity  string `json:"Severity"`
		ScoreSet  struct {
			BaseScore     string `json:"BaseScore"`
			TemporalScore string `json:"TemporalScore"`
			Vector        string `json:"Vector"`
		} `json:"ScoreSet,omitempty"`
		KBs []struct {
			Article         string `json:"Article"`
			RestartRequired string `json:"RestartRequired"`
			SubType         string `json:"SubType"`
			FixedBuild      string `json:"FixedBuild"`
			ArticleURL      string `json:"ArticleURL"`
			DownloadURL     string `json:"DownloadURL"`
		} `json:"KBs,omitempty"`
	} `json:"Products"`
	URL             string `json:"URL"`
	Acknowledgments []struct {
		Name string `json:"Name"`
	} `json:"Acknowledgments"`
	Revisions []revision `json:"Revisions"`
}

MicrosoftVulnerability :

type RedhatAffectedRelease

type RedhatAffectedRelease struct {
	ID          int64  `json:"-"`
	RedhatCVEID int64  `json:"-" gorm:"index:idx_redhat_affected_releases_redhat_cve_id"`
	ProductName string `json:"product_name" gorm:"type:varchar(255)"`
	ReleaseDate string `json:"release_date" gorm:"type:varchar(255)"`
	Advisory    string `json:"advisory" gorm:"type:varchar(255)"`
	Package     string `json:"package" gorm:"type:varchar(255)"`
	Cpe         string `json:"cpe" gorm:"type:varchar(255)"`
}

RedhatAffectedRelease :

type RedhatBugzilla

type RedhatBugzilla struct {
	ID          int64  `json:"-"`
	RedhatCVEID int64  `json:"-" gorm:"index:idx_redhat_bugzillas_redhat_cve_id"`
	Description string `json:"description" gorm:"type:text"`

	BugzillaID string `json:"id" gorm:"type:varchar(255)"`
	URL        string `json:"url" gorm:"type:varchar(255)"`
}

RedhatBugzilla :

type RedhatCVE

type RedhatCVE struct {
	ID int64 `json:"-"`

	// gorm can't handle embedded struct
	ThreatSeverity       string `gorm:"type:varchar(255)"`
	PublicDate           time.Time
	Bugzilla             RedhatBugzilla
	Cvss                 RedhatCvss
	Cvss3                RedhatCvss3
	Iava                 string `gorm:"type:varchar(255)"`
	Cwe                  string `gorm:"type:varchar(255)"`
	Statement            string `gorm:"type:text"`
	Acknowledgement      string `gorm:"type:text"`
	Mitigation           string `gorm:"type:text"`
	AffectedRelease      []RedhatAffectedRelease
	PackageState         []RedhatPackageState
	Name                 string `gorm:"type:varchar(255);index:idx_redhat_cves_name"`
	DocumentDistribution string `gorm:"type:text"`

	Details    []RedhatDetail
	References []RedhatReference
}

RedhatCVE :

func ConvertRedhat added in v0.4.1

func ConvertRedhat(cveJSONs []RedhatCVEJSON) (cves []RedhatCVE, err error)

ConvertRedhat :

func (RedhatCVE) GetDetail

func (r RedhatCVE) GetDetail(sep string) string

GetDetail returns details

func (RedhatCVE) GetPackages

func (r RedhatCVE) GetPackages(sep string) (result string)

GetPackages returns package names

type RedhatCVEJSON

type RedhatCVEJSON struct {
	ThreatSeverity       string         `json:"threat_severity"`
	PublicDate           string         `json:"public_date"`
	Bugzilla             RedhatBugzilla `json:"bugzilla"`
	Cvss                 RedhatCvss     `json:"cvss"`
	Cvss3                RedhatCvss3    `json:"cvss3"`
	Iava                 string         `json:"iava"`
	Cwe                  string         `json:"cwe"`
	Statement            string         `json:"statement"`
	Acknowledgement      string         `json:"acknowledgement"`
	TempMitigation       interface{}    `json:"mitigation"`
	Mitigation           string
	TempAffectedRelease  interface{} `json:"affected_release"` // affected_release is array or object
	AffectedRelease      []RedhatAffectedRelease
	TempPackageState     interface{} `json:"package_state"` // package_state is array or object
	PackageState         []RedhatPackageState
	Name                 string `json:"name"`
	DocumentDistribution string `json:"document_distribution"`

	Details    []string `json:"details" gorm:"-"`
	References []string `json:"references" gorm:"-"`
}

RedhatCVEJSON :

type RedhatCVEJSONAffectedReleaseArray

type RedhatCVEJSONAffectedReleaseArray struct {
	AffectedRelease []RedhatAffectedRelease `json:"affected_release"`
}

RedhatCVEJSONAffectedReleaseArray :

type RedhatCVEJSONAffectedReleaseObject

type RedhatCVEJSONAffectedReleaseObject struct {
	AffectedRelease RedhatAffectedRelease `json:"affected_release"`
}

RedhatCVEJSONAffectedReleaseObject :

type RedhatCVEJSONMitigationObject added in v0.4.5

type RedhatCVEJSONMitigationObject struct {
	Value string `json:"value"`
	Lang  string `json:"lang"`
}

type RedhatCVEJSONPackageStateArray

type RedhatCVEJSONPackageStateArray struct {
	PackageState []RedhatPackageState `json:"package_state"`
}

RedhatCVEJSONPackageStateArray :

type RedhatCVEJSONPackageStateObject

type RedhatCVEJSONPackageStateObject struct {
	PackageState RedhatPackageState `json:"package_state"`
}

RedhatCVEJSONPackageStateObject :

type RedhatCvss

type RedhatCvss struct {
	ID                int64  `json:"-"`
	RedhatCVEID       int64  `json:"-" gorm:"index:idx_redhat_cvsses_redhat_cve_id"`
	CvssBaseScore     string `json:"cvss_base_score" gorm:"type:varchar(255)"`
	CvssScoringVector string `json:"cvss_scoring_vector" gorm:"type:varchar(255)"`
	Status            string `json:"status" gorm:"type:varchar(255)"`
}

RedhatCvss :

type RedhatCvss3

type RedhatCvss3 struct {
	ID                 int64  `json:"-"`
	RedhatCVEID        int64  `json:"-" gorm:"index:idx_redhat_cvss3_redhat_cve_id"`
	Cvss3BaseScore     string `json:"cvss3_base_score" gorm:"type:varchar(255)"`
	Cvss3ScoringVector string `json:"cvss3_scoring_vector" gorm:"type:varchar(255)"`
	Status             string `json:"status" gorm:"type:varchar(255)"`
}

RedhatCvss3 :

type RedhatDetail

type RedhatDetail struct {
	ID          int64  `json:"-"`
	RedhatCVEID int64  `json:"-" gorm:"index:idx_redhat_details_redhat_cve_id"`
	Detail      string `gorm:"type:text"`
}

RedhatDetail :

type RedhatEntry

type RedhatEntry struct {
	CveID              string        `json:"CVE"`
	Severity           string        `json:"severity"`
	PublicDate         time.Time     `json:"public_date"`
	Advisories         []interface{} `json:"advisories"`
	Bugzilla           string        `json:"bugzilla"`
	CvssScore          interface{}   `json:"cvss_score"`
	CvssScoringVector  interface{}   `json:"cvss_scoring_vector"`
	CWE                string        `json:"CWE"`
	AffectedPackages   []interface{} `json:"affected_packages"`
	ResourceURL        string        `json:"resource_url"`
	Cvss3Score         string        `json:"cvss3_score"`
	Cvss3ScoringVector string        `json:"cvss3_scoring_vector"`
}

RedhatEntry :

type RedhatPackageState

type RedhatPackageState struct {
	ID          int64  `json:"-"`
	RedhatCVEID int64  `json:"-" gorm:"index:idx_redhat_package_states_redhat_cve_id"`
	ProductName string `json:"product_name" gorm:"type:varchar(255)"`
	FixState    string `json:"fix_state" gorm:"type:varchar(255);index:idx_redhat_package_states_fix_state"`
	PackageName string `json:"package_name" gorm:"type:varchar(255);index:idx_redhat_package_states_package_name"`
	Cpe         string `json:"cpe" gorm:"type:varchar(255);index:idx_redhat_package_states_cpe"`
}

RedhatPackageState :

type RedhatReference

type RedhatReference struct {
	ID          int64  `json:"-"`
	RedhatCVEID int64  `json:"-" gorm:"index:idx_redhat_references_redhat_cve_id"`
	Reference   string `gorm:"type:text"`
}

RedhatReference :

type UbuntuBug added in v0.3.0

type UbuntuBug struct {
	ID          int64  `json:"-"`
	UbuntuCVEID int64  `json:"-" gorm:"index:idx_ubuntu_bug_ubuntu_cve_id"`
	Bug         string `json:"bug" gorm:"type:text"`
}

UbuntuBug :

type UbuntuCVE added in v0.3.0

type UbuntuCVE struct {
	ID int64 `json:"-"`

	PublicDateAtUSN   time.Time         `json:"public_date_at_usn"`
	CRD               time.Time         `json:"crd"`
	Candidate         string            `json:"candidate" gorm:"type:varchar(255);index:idx_ubuntu_cve_candidate"`
	PublicDate        time.Time         `json:"public_date"`
	References        []UbuntuReference `json:"references"`
	Description       string            `json:"description" gorm:"type:text"`
	UbuntuDescription string            `json:"ubuntu_description" gorm:"type:text"`
	Notes             []UbuntuNote      `json:"notes"`
	Bugs              []UbuntuBug       `json:"bugs"`
	Priority          string            `json:"priority" gorm:"type:varchar(255)"`
	DiscoveredBy      string            `json:"discovered_by" gorm:"type:text"`
	AssignedTo        string            `json:"assigned_to" gorm:"type:varchar(255)"`
	Patches           []UbuntuPatch     `json:"patches"`
	Upstreams         []UbuntuUpstream  `json:"upstreams"`
}

UbuntuCVE :

func ConvertUbuntu added in v0.4.1

func ConvertUbuntu(cveJSONs []UbuntuCVEJSON) (cves []UbuntuCVE)

ConvertUbuntu :

type UbuntuCVEJSON added in v0.3.0

type UbuntuCVEJSON struct {
	PublicDateAtUSN   time.Time
	CRD               time.Time
	Candidate         string
	PublicDate        time.Time
	References        []string
	Description       string
	UbuntuDescription string
	Notes             []string
	Bugs              []string
	Priority          string
	DiscoveredBy      string
	AssignedTo        string
	Patches           map[string]map[string]UbuntuPatchJSON
	UpstreamLinks     map[string][]string
}

UbuntuCVEJSON :

type UbuntuNote added in v0.3.0

type UbuntuNote struct {
	ID          int64  `json:"-"`
	UbuntuCVEID int64  `json:"-" gorm:"index:idx_ubuntu_note_ubuntu_cve_id"`
	Note        string `json:"note" gorm:"type:text"`
}

UbuntuNote :

type UbuntuPatch added in v0.3.0

type UbuntuPatch struct {
	ID             int64                `json:"-"`
	UbuntuCVEID    int64                `json:"-" gorm:"index:idx_ubuntu_patch_ubuntu_cve_id"`
	PackageName    string               `json:"package_name" gorm:"type:varchar(255);index:idx_ubuntu_patch_package_name"`
	ReleasePatches []UbuntuReleasePatch `json:"release_patches"`
}

UbuntuPatch :

type UbuntuPatchJSON added in v0.3.0

type UbuntuPatchJSON struct {
	Status string
	Note   string
}

UbuntuPatchJSON :

type UbuntuReference added in v0.3.0

type UbuntuReference struct {
	ID          int64  `json:"-"`
	UbuntuCVEID int64  `json:"-" gorm:"index:idx_ubuntu_reference_ubuntu_cve_id"`
	Reference   string `json:"reference" gorm:"type:text"`
}

UbuntuReference :

type UbuntuReleasePatch added in v0.3.0

type UbuntuReleasePatch struct {
	ID            int64  `json:"-"`
	UbuntuPatchID int64  `json:"-" gorm:"index:idx_ubuntu_release_patch_ubuntu_patch_id"`
	ReleaseName   string `json:"release_name" gorm:"type:varchar(255);index:idx_ubuntu_release_patch_release_name"`
	Status        string `json:"status" gorm:"type:varchar(255);index:idx_ubuntu_release_patch_status"`
	Note          string `json:"note" gorm:"type:varchar(255)"`
}

UbuntuReleasePatch :

type UbuntuUpstream added in v0.3.0

type UbuntuUpstream struct {
	ID            int64                `json:"-"`
	UbuntuCVEID   int64                `json:"-" gorm:"index:idx_ubuntu_upstream_ubuntu_cve_id"`
	PackageName   string               `json:"package_name" gorm:"type:varchar(255)"`
	UpstreamLinks []UbuntuUpstreamLink `json:"upstream_links"`
}

UbuntuUpstream :

type UbuntuUpstreamLink struct {
	ID               int64  `json:"-"`
	UbuntuUpstreamID int64  `json:"-" gorm:"index:idx_ubuntu_upstream_link_ubuntu_upstream_id"`
	Link             string `json:"link" gorm:"type:text"`
}

UbuntuUpstreamLink :

Jump to

Keyboard shortcuts

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