github.com/khulnasoft-lab/tunnel-db@v0.0.0-20231117205118-74e1113bd007/pkg/vulnsrc/osv/types.go (about) 1 package osv 2 3 import ( 4 "encoding/json" 5 "time" 6 ) 7 8 const ( 9 RangeTypeGit RangeType = "GIT" 10 11 EcosystemGo Ecosystem = "Go" 12 EcosystemNpm Ecosystem = "npm" 13 EcosystemPyPI Ecosystem = "PyPI" 14 EcosystemRubygems Ecosystem = "RubyGems" 15 EcosystemCrates Ecosystem = "crates.io" 16 EcosystemPackagist Ecosystem = "Packagist" 17 EcosystemMaven Ecosystem = "Maven" 18 EcosystemNuGet Ecosystem = "NuGet" 19 ) 20 21 type Ecosystem string 22 type RangeType string 23 24 type Package struct { 25 Name string `json:"name"` 26 Ecosystem Ecosystem `json:"ecosystem"` 27 } 28 29 type RangeEvent struct { 30 Introduced string `json:"introduced,omitempty"` 31 Fixed string `json:"fixed,omitempty"` 32 LastAffected string `json:"last_affected,omitempty"` 33 } 34 35 type Range struct { 36 Type RangeType `json:"type"` 37 Events []RangeEvent `json:"events"` 38 } 39 40 type ReferenceType string 41 42 type Reference struct { 43 Type ReferenceType `json:"type"` 44 URL string `json:"url"` 45 } 46 47 type Severity struct { 48 Type string `json:"type"` 49 Score string `json:"score"` 50 } 51 52 type Affected struct { 53 Package Package `json:"package"` 54 Severities []Severity `json:"severity,omitempty"` 55 Ranges []Range `json:"ranges,omitempty"` 56 Versions []string `json:"versions,omitempty"` 57 EcosystemSpecific EcosystemSpecific `json:"ecosystem_specific"` 58 } 59 60 type Import struct { 61 Path string `json:"path,omitempty"` 62 GOOS []string `json:"goos,omitempty"` 63 GOARCH []string `json:"goarch,omitempty"` 64 Symbols []string `json:"symbols,omitempty"` 65 } 66 67 type EcosystemSpecific struct { 68 Imports []Import `json:"imports,omitempty"` 69 } 70 71 // source: https://ossf.github.io/osv-schema 72 type Entry struct { 73 SchemaVersion string `json:"schema_version,omitempty"` 74 ID string `json:"id"` 75 Modified time.Time `json:"modified,omitempty"` 76 Published time.Time `json:"published,omitempty"` 77 Withdrawn *time.Time `json:"withdrawn,omitempty"` 78 Aliases []string `json:"aliases,omitempty"` 79 Summary string `json:"summary,omitempty"` 80 Details string `json:"details"` 81 Severities []Severity `json:"severity"` 82 Affected []Affected `json:"affected"` 83 References []Reference `json:"references,omitempty"` 84 Credits []Credit `json:"credits,omitempty"` 85 DatabaseSpecific json.RawMessage `json:"database_specific,omitempty"` 86 } 87 88 type Credit struct { 89 Name string `json:"name"` 90 }