Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddAssetDepInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "AddAssetDepInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(graphql.String), }, }, })
View Source
var AddAssetInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "AddAssetInput", Fields: graphql.InputObjectConfigFieldMap{ "name": { Type: graphql.NewNonNull(graphql.String), }, "cpe23": { Type: graphql.NewNonNull(scalar.CPE23), }, "dependents": { Type: &graphql.List{ OfType: graphql.NewNonNull(AddAssetDepInput), }, }, "dependencies": { Type: &graphql.List{ OfType: graphql.NewNonNull(AddAssetDepInput), }, }, }, })
View Source
var AddCVEInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "AddCVEInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(scalar.CVEID), }, "description": { Type: graphql.NewNonNull(graphql.String), }, "publicationDate": { Type: graphql.NewNonNull(scalar.NVDDateTime), }, "lastUpdate": { Type: graphql.NewNonNull(scalar.NVDDateTime), }, "cvss2vector": { Type: scalar.CVSS2Vector, }, "cvss3vector": { Type: scalar.CVSS3Vector, }, "configurations": { Type: AddCVENodeInput, }, "references": { Type: AddCVEReferencesInput, }, }, })
View Source
var AddCVENodeCPEMatchInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "AddCVENodeCPEMatchInput", Fields: graphql.InputObjectConfigFieldMap{ "vulnerable": { Type: graphql.NewNonNull(graphql.Boolean), }, "cpe23": { Type: graphql.NewNonNull(scalar.CPE23), }, "versionStartIncluding": { Type: graphql.Boolean, }, "versionStartExcluding": { Type: graphql.Boolean, }, "versionEndIncluding": { Type: graphql.Boolean, }, "versionEndExcluding": { Type: graphql.Boolean, }, }, })
View Source
var AddCVENodeInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "AddCVENodeInput", Fields: graphql.InputObjectConfigFieldMap{ "negate": { Type: graphql.Boolean, }, "operator": { Type: graphql.NewNonNull(graphql.String), }, "cpeMatches": { Type: &graphql.List{ OfType: graphql.NewNonNull(AddCVENodeCPEMatchInput), }, }, }, })
View Source
var AddCVEReferencesInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "AddCVEReferencesInput", Fields: graphql.InputObjectConfigFieldMap{ "url": { Type: graphql.NewNonNull(graphql.String), }, "name": { Type: graphql.NewNonNull(graphql.String), }, "refsource": { Type: graphql.NewNonNull(graphql.String), }, "tags": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(graphql.String), }), }, }, })
View Source
var Asset = graphql.NewObject(graphql.ObjectConfig{ Name: "Asset", Description: "Asset could represent anything in an IT system. It could be also named \"Component\" as its achieved by the NIST-IR 7695.", Fields: graphql.Fields{ "id": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if asset, ok := p.Source.(*model.Asset); ok { return asset.ID, nil } return nil, nil }, }, "name": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if asset, ok := p.Source.(*model.Asset); ok { return asset.Name, nil } return nil, nil }, }, "cpe23": { Type: graphql.NewNonNull(scalar.CPE23), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if asset, ok := p.Source.(*model.Asset); ok { return asset.CPE23, nil } return nil, nil }, }, "cves": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(CVE), }), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if asset, ok := p.Source.(*model.Asset); ok { return apidb.Mem.GetAssetCVEs(asset), nil } return nil, nil }, }, }, })
View Source
var CPEMatch = graphql.NewObject(graphql.ObjectConfig{ Name: "CPEMatch", Description: "CPEMatch is a CPE match configuration as defined by the NVD.", Fields: graphql.Fields{ "vulnerable": { Type: graphql.NewNonNull(graphql.Boolean), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cpeMatch, ok := p.Source.(*model.CPEMatch); ok { return cpeMatch.Vulnerable, nil } return nil, nil }, }, "cpe23": { Type: graphql.NewNonNull(scalar.CPE23), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cpeMatch, ok := p.Source.(*model.CPEMatch); ok { return cpeMatch.CPE23, nil } return nil, nil }, }, "versionStartIncluding": { Type: graphql.String, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cpeMatch, ok := p.Source.(*model.CPEMatch); ok { return cpeMatch.VersionStartIncluding, nil } return nil, nil }, }, "versionStartExcluding": { Type: graphql.String, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cpeMatch, ok := p.Source.(*model.CPEMatch); ok { return cpeMatch.VersionStartExcluding, nil } return nil, nil }, }, "versionEndIncluding": { Type: graphql.String, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cpeMatch, ok := p.Source.(*model.CPEMatch); ok { return cpeMatch.VersionEndIncluding, nil } return nil, nil }, }, "versionEndExcluding": { Type: graphql.String, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cpeMatch, ok := p.Source.(*model.CPEMatch); ok { return cpeMatch.VersionEndExcluding, nil } return nil, nil }, }, }, })
View Source
var CVE = graphql.NewObject(graphql.ObjectConfig{ Name: "CVE", Description: "CVE object according to the NVD.", Fields: graphql.Fields{ "id": { Type: graphql.NewNonNull(scalar.CVEID), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.ID, nil } return nil, nil }, }, "description": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.Description, nil } return nil, nil }, }, "publicationDate": { Type: graphql.NewNonNull(scalar.NVDDateTime), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.PublicationDate, nil } return nil, nil }, }, "lastUpdate": { Type: graphql.NewNonNull(scalar.NVDDateTime), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.LastUpdate, nil } return nil, nil }, }, "cvss2": { Type: CVSS2, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.CVSS2Vector, nil } return nil, nil }, }, "cvss3": { Type: CVSS3, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.CVSS3Vector, nil } return nil, nil }, }, "configurations": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(Node), }), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { return cve.Configurations, nil } return nil, nil }, }, "references": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(Reference), }), Args: graphql.FieldConfigArgument{ "tags": { Type: &graphql.List{ OfType: graphql.NewNonNull(graphql.String), }, }, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if cve, ok := p.Source.(*model.CVE); ok { t := p.Args["tags"].([]any) if len(t) == 0 { return cve.References, nil } tags := make([]string, len(t)) for i, tref := range t { tags[i] = tref.(string) } references := []*model.Reference{} for _, ref := range cve.References { if containsAny(ref.Tags, tags) { references = append(references, ref) } } return references, nil } return nil, nil }, }, }, })
View Source
var CVSS2 = graphql.NewObject(graphql.ObjectConfig{ Name: "CVSS2", Description: "Representation of a CVSS v2.0 vector.", Fields: graphql.Fields{ "vector": { Type: graphql.NewNonNull(scalar.CVSS2Vector), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } return vector, nil } return nil, nil }, }, "version": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } return "2.0", nil } return nil, nil }, }, "baseScore": { Type: graphql.NewNonNull(graphql.Float), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } cvss20, _ := gocvss20.ParseVector(*vector) return cvss20.BaseScore(), nil } return nil, nil }, }, "temporalScore": { Type: graphql.NewNonNull(graphql.Float), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } cvss20, _ := gocvss20.ParseVector(*vector) return cvss20.TemporalScore(), nil } return nil, nil }, }, "environmentalScore": { Type: graphql.NewNonNull(graphql.Float), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } cvss20, _ := gocvss20.ParseVector(*vector) return cvss20.EnvironmentalScore(), nil } return nil, nil }, }, }, })
View Source
var CVSS3 = graphql.NewObject(graphql.ObjectConfig{ Name: "CVSS3", Description: "Representation of a CVSS v3 vector.", Fields: graphql.Fields{ "vector": { Type: graphql.NewNonNull(scalar.CVSS3Vector), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } return vector, nil } return nil, nil }, }, "version": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } return (*vector)[5:8], nil } return nil, nil }, }, "baseScore": { Type: graphql.NewNonNull(graphql.Float), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } if strings.HasPrefix(*vector, "CVSS:3.0") { cvss30, _ := gocvss30.ParseVector(*vector) return cvss30.BaseScore(), nil } cvss31, _ := gocvss31.ParseVector(*vector) return cvss31.BaseScore(), nil } return nil, nil }, }, "temporalScore": { Type: graphql.NewNonNull(graphql.Float), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } if strings.HasPrefix(*vector, "CVSS:3.0") { cvss30, _ := gocvss30.ParseVector(*vector) return cvss30.TemporalScore(), nil } cvss31, _ := gocvss31.ParseVector(*vector) return cvss31.TemporalScore(), nil } return nil, nil }, }, "environmentalScore": { Type: graphql.NewNonNull(graphql.Float), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if vector, ok := p.Source.(*string); ok { if vector == nil { return nil, nil } if strings.HasPrefix(*vector, "CVSS:3.0") { cvss30, _ := gocvss30.ParseVector(*vector) return cvss30.EnvironmentalScore(), nil } cvss31, _ := gocvss31.ParseVector(*vector) return cvss31.EnvironmentalScore(), nil } return nil, nil }, }, }, })
View Source
var DeleteAssetInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "DeleteAssetInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(graphql.String), }, }, })
View Source
var DeleteCVEInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "DeleteCVEInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(scalar.CVEID), }, }, })
View Source
var GetAssetInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "GetAssetInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(graphql.String), }, }, })
View Source
var GetCVEInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "GetCVEInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(scalar.CVEID), }, }, })
View Source
var Node = graphql.NewObject(graphql.ObjectConfig{ Name: "Node", Description: "Node is a configuration node as defined by the NVD.", Fields: graphql.Fields{ "negate": { Type: graphql.Boolean, Resolve: func(p graphql.ResolveParams) (interface{}, error) { if node, ok := p.Source.(*model.Node); ok { return node.Negate, nil } return nil, nil }, }, "operator": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if node, ok := p.Source.(*model.Node); ok { return node.Operator, nil } return nil, nil }, }, "cpeMatches": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(CPEMatch), }), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if node, ok := p.Source.(*model.Node); ok { return node.CPEMatches, nil } return nil, nil }, }, }, })
View Source
var QueryAssetsInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "QueryAssetsInput", Fields: graphql.InputObjectConfigFieldMap{ "vp": { Type: graphql.String, Description: "\"vendor:product\" couple to look for.", }, }, })
View Source
var QueryCVEsInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "QueryCVEsInput", Fields: graphql.InputObjectConfigFieldMap{ "vp": { Type: graphql.String, Description: "\"vendor:product\" couple to look for.", }, }, })
TODO add filtering on score
View Source
var Reference = graphql.NewObject(graphql.ObjectConfig{ Name: "Reference", Fields: graphql.Fields{ "url": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if ref, ok := p.Source.(*model.Reference); ok { return ref.URL, nil } return nil, nil }, }, "name": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if ref, ok := p.Source.(*model.Reference); ok { return ref.Name, nil } return nil, nil }, }, "refsource": { Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if ref, ok := p.Source.(*model.Reference); ok { return ref.Refsource, nil } return nil, nil }, }, "tags": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(graphql.String), }), Resolve: func(p graphql.ResolveParams) (interface{}, error) { if ref, ok := p.Source.(*model.Reference); ok { return ref.Tags, nil } return nil, nil }, }, }, })
View Source
var UpdateAssetDepInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "UpdateAssetDepInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(graphql.String), }, }, })
View Source
var UpdateAssetInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "UpdateAssetInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(graphql.String), }, "name": { Type: graphql.String, }, "cpe23": { Type: scalar.CPE23, }, "dependents": { Type: &graphql.List{ OfType: graphql.NewNonNull(UpdateAssetDepInput), }, }, "dependencies": { Type: &graphql.List{ OfType: graphql.NewNonNull(UpdateAssetDepInput), }, }, }, })
View Source
var UpdateCVEInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "UpdateCVEInput", Fields: graphql.InputObjectConfigFieldMap{ "id": { Type: graphql.NewNonNull(scalar.CVEID), }, "description": { Type: graphql.String, }, "lastUpdate": { Type: scalar.NVDDateTime, }, "cvss2vector": { Type: scalar.CVSS2Vector, }, "cvss3vector": { Type: scalar.CVSS3Vector, }, "configurations": { Type: UpdateCVENodeInput, }, "references": { Type: UpdateCVEReferencesInput, }, }, })
View Source
var UpdateCVENodeCPEMatchInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "UpdateCVENodeCPEMatchInput", Fields: graphql.InputObjectConfigFieldMap{ "vulnerable": { Type: graphql.NewNonNull(graphql.Boolean), }, "cpe23": { Type: graphql.NewNonNull(scalar.CPE23), }, "versionStartIncluding": { Type: graphql.Boolean, }, "versionStartExcluding": { Type: graphql.Boolean, }, "versionEndIncluding": { Type: graphql.Boolean, }, "versionEndExcluding": { Type: graphql.Boolean, }, }, })
View Source
var UpdateCVENodeInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "UpdateCVENodeInput", Fields: graphql.InputObjectConfigFieldMap{ "negate": { Type: graphql.Boolean, }, "operator": { Type: graphql.NewNonNull(graphql.String), }, "cpeMatches": { Type: &graphql.List{ OfType: graphql.NewNonNull(UpdateCVENodeCPEMatchInput), }, }, }, })
View Source
var UpdateCVEReferencesInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "UpdateCVEReferencesInput", Fields: graphql.InputObjectConfigFieldMap{ "url": { Type: graphql.NewNonNull(graphql.String), }, "name": { Type: graphql.NewNonNull(graphql.String), }, "refsource": { Type: graphql.NewNonNull(graphql.String), }, "tags": { Type: graphql.NewNonNull(&graphql.List{ OfType: graphql.NewNonNull(graphql.String), }), }, }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.