@@ -108,9 +108,9 @@ func (h *horizPlugin) addAssociatedRelationship(e *et.Event, since time.Time, as
108108 }
109109
110110 if match , result := e .Session .Scope ().IsAssetInScope (impacted .Asset , conf ); result >= conf && match != nil {
111- if a , err := e .Session .DB ().FindOneEntityByContent (ctx ,
112- match .AssetType (), since , assetToContentFilters (match )); err == nil && a ! = nil {
113- for _ , assoc2 := range e .Session .Scope ().AssetsWithAssociation (e .Session .DB (), a ) {
111+ if ents , err := e .Session .DB ().FindEntitiesByContent (ctx ,
112+ match .AssetType (), since , 1 , assetToContentFilters (match )); err == nil {
113+ for _ , assoc2 := range e .Session .Scope ().AssetsWithAssociation (e .Session .DB (), ents [ 0 ] ) {
114114 h .makeAssocRelationshipEntries (e , assoc .Match , assoc2 )
115115 }
116116 }
@@ -185,9 +185,11 @@ func (h *horizPlugin) process(e *et.Event, since time.Time, assets []*dbt.Entity
185185 h .sweepAroundIPs (ctx , e , asset , since )
186186 //h.sweepNetblock(e, v, src)
187187 case * oamreg.IPNetRecord :
188- if a , err := e .Session .DB ().FindOneEntityByContent (ctx , oam .Netblock , since , dbt.ContentFilters {
188+ if ents , err := e .Session .DB ().FindEntitiesByContent (ctx , oam .Netblock , since , 1 , dbt.ContentFilters {
189189 "cidr" : v .CIDR .String (),
190- }); err == nil && a != nil {
190+ }); err == nil {
191+ a := ents [0 ]
192+
191193 if _ , ok := a .Asset .(* oamnet.Netblock ); ok {
192194 h .ipPTRTargetsInScope (ctx , e , a , since )
193195 h .sweepAroundIPs (ctx , e , a , since )
@@ -222,10 +224,10 @@ func (h *horizPlugin) ipPTRTargetsInScope(ctx context.Context, e *et.Event, nb *
222224 continue
223225 }
224226
225- if a , err := e .Session .DB ().FindOneEntityByContent (ctx , oam .FQDN , since , dbt.ContentFilters {
227+ if ents , err := e .Session .DB ().FindEntitiesByContent (ctx , oam .FQDN , since , 1 , dbt.ContentFilters {
226228 "name" : utils .RemoveLastDot (reverse ),
227- }); err == nil && a != nil {
228- if edges , err := e .Session .DB ().OutgoingEdges (ctx , a , since , "dns_record" ); err == nil && len (edges ) > 0 {
229+ }); err == nil {
230+ if edges , err := e .Session .DB ().OutgoingEdges (ctx , ents [ 0 ] , since , "dns_record" ); err == nil && len (edges ) > 0 {
229231 for _ , edge := range edges {
230232 if rel , ok := edge .Relation .(* oamdns.BasicDNSRelation ); ! ok || rel .Header .RRType != 12 {
231233 continue
0 commit comments