-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package utils | ||
|
||
type GraphNode struct { | ||
// Component Id in the JFrog standard. | ||
// For instance, for maven: gav://<groupId>:<artifactId>:<version> | ||
// For detailed format examples please see: | ||
// https://www.jfrog.com/confluence/display/JFROG/Xray+REST+API#XrayRESTAPI-ComponentIdentifiers | ||
Id string `json:"component_id,omitempty"` | ||
// Sha of the binary representing the component. | ||
Sha256 string `json:"sha256,omitempty"` | ||
Sha1 string `json:"sha1,omitempty"` | ||
// For root file shall be the file name. | ||
// For internal components shall be the internal path. (Relevant only for binary scan). | ||
Path string `json:"path,omitempty"` | ||
// Download url | ||
DownloadUrl string `json:"-"` | ||
// List of license names | ||
Licenses []string `json:"licenses,omitempty"` | ||
// Component properties | ||
Properties map[string]string `json:"properties,omitempty"` | ||
// List of subcomponents. | ||
Nodes []*GraphNode `json:"nodes,omitempty"` | ||
// Other component IDs field is populated by the Xray indexer to get a better accuracy in '.deb' files. | ||
OtherComponentIds []OtherComponentIds `json:"other_component_ids,omitempty"` | ||
// Node parent (for internal use) | ||
Parent *GraphNode `json:"-"` | ||
} | ||
|
||
type OtherComponentIds struct { | ||
Id string `json:"component_id,omitempty"` | ||
Origin int `json:"origin,omitempty"` | ||
} | ||
|
||
func (currNode *GraphNode) NodeHasLoop() bool { | ||
parent := currNode.Parent | ||
for parent != nil { | ||
if currNode.Id == parent.Id { | ||
return true | ||
} | ||
parent = parent.Parent | ||
} | ||
return false | ||
} |