Skip to content

Commit

Permalink
fix cypher query in diff (#2093)
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshvardhan Karn authored Apr 17, 2024
1 parent e74bb52 commit 716dca3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions deepfence_server/reporters/scan/scan_reporters.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,12 @@ func GetScanResultDiff[T any](ctx context.Context, scanType utils.Neo4jScanType,
OPTIONAL MATCH (n) -[:SCANNED]-> (f)
OPTIONAL MATCH (c:ContainerImage{node_id: f.docker_image_id}) -[:ALIAS] ->(t) -[ma:MASKED]-> (d)
OPTIONAL MATCH (cb:ContainerImage{node_id: n.docker_image_id}) -[:IS] ->(is) -[mis:MASKED]-> (d)
WITH e, d, r, collect(ma) as ma_list, collect(mis) as mis_list
WITH apoc.map.merge( e{.*},
d{.*, masked: coalesce(d.masked or r.masked or e.masked or head(collect(ma.masked)) or head(collect(mis.masked)), false),
name: coalesce(e.name, d.name, '')}) AS d` +
d{.*, masked: coalesce(d.masked or r.masked or e.masked or head(ma_list).masked or head(mis_list).masked, false),
name: coalesce(e.name, d.name, '')}) AS merged_data` +
reporters.ParseFieldFilters2CypherWhereConditions("d", mo.Some(ff), true) +
ffCondition + ` RETURN d ` +
ffCondition + ` RETURN merged_data ` +
fw.FetchWindow2CypherQuery()
log.Debug().Msgf("diff query: %v", query)
nres, err := tx.Run(ctx, query,
Expand Down

0 comments on commit 716dca3

Please sign in to comment.