@@ -58,6 +58,10 @@ const (
5858 directRelation = "direct"
5959 indirectRelation = "indirect"
6060
61+ // TransitiveDepMarker is the extra segment added to version for transitive blocked packages with cvs
62+ // e.g., "5.1.6:TRANSITIVE" -> when split by ":", the third element indicates transitive, which we use it to know when to set the parent to "Unknown"
63+ TransitiveDepMarker = "TRANSITIVE"
64+
6165 BlockMessageKey = "jfrog packages curation"
6266 NotBeingFoundKey = "not being found"
6367 IsOnDemand = "on-demand"
@@ -792,6 +796,10 @@ func (nc *treeAnalyzer) fillGraphRelations(node *xrayUtils.GraphNode, preProcess
792796 packagesStatus * []* PackageStatus , parent , parentVersion string , visited * datastructures.Set [string ], isRoot bool ) {
793797 for _ , child := range node .Nodes {
794798 packageUrls , name , scope , version := getUrlNameAndVersionByTech (nc .tech , child , nc .downloadUrls , nc .url , nc .repo )
799+
800+ // Check if this is a transitive blocked package (has :TRANSITIVE marker in ID)
801+ isTransitiveBlocked := nc .tech == techutils .Npm && strings .Contains (child .Id , ":" + TransitiveDepMarker )
802+
795803 if isRoot {
796804 parent = name
797805 parentVersion = version
@@ -814,8 +822,14 @@ func (nc *treeAnalyzer) fillGraphRelations(node *xrayUtils.GraphNode, preProcess
814822 if isPkgStatus {
815823 pkgStatusClone := * pkgStatusCast
816824 pkgStatusClone .DepRelation = relation
817- pkgStatusClone .ParentName = parent
818- pkgStatusClone .ParentVersion = parentVersion
825+ // For transitive blocked packages, set parent to "Unknown"
826+ if isTransitiveBlocked {
827+ pkgStatusClone .ParentName = "Unknown"
828+ pkgStatusClone .ParentVersion = "Unknown"
829+ } else {
830+ pkgStatusClone .ParentName = parent
831+ pkgStatusClone .ParentVersion = parentVersion
832+ }
819833 * packagesStatus = append (* packagesStatus , & pkgStatusClone )
820834 }
821835 }
0 commit comments