-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from interlynk-io/51-hierarchical-merges-assum…
…es-dependencies-should-it-not-allow-simple-containment Add assembly sbom feature for cyclonedx
- Loading branch information
Showing
10 changed files
with
151 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import ( | |
"github.com/interlynk-io/sbomasm/pkg/logger" | ||
"github.com/mitchellh/copystructure" | ||
"github.com/mitchellh/hashstructure/v2" | ||
"sigs.k8s.io/release-utils/version" | ||
) | ||
|
||
func newSerialNumber() string { | ||
|
@@ -96,3 +97,45 @@ func utcNowTime() string { | |
locationTime := time.Now().In(location) | ||
return locationTime.Format(time.RFC3339) | ||
} | ||
|
||
func getAllTools(boms []*cydx.BOM) []cydx.Component { | ||
tools := []cydx.Component{} | ||
|
||
tools = append(tools, *toolInfo("sbomasm", version.GetVersionInfo().GitVersion, "Assembler for your sboms", "Interlynk", "https://interlynk.io", "[email protected]", "Apache-2.0")) | ||
|
||
for _, bom := range boms { | ||
if bom.Metadata != nil && bom.Metadata.Tools != nil { | ||
for _, tool := range *bom.Metadata.Tools.Tools { | ||
tools = append(tools, *toolInfo(tool.Name, tool.Version, "", tool.Vendor, "", "", "")) | ||
} | ||
} | ||
|
||
if bom.Metadata != nil && bom.Metadata.Tools != nil && bom.Metadata.Tools.Components != nil { | ||
for _, tool := range *bom.Metadata.Tools.Components { | ||
tools = append(tools, *toolInfo(tool.Name, tool.Version, "", "", "", "", "")) | ||
} | ||
} | ||
} | ||
return tools | ||
} | ||
|
||
func toolInfo(name, version, desc, sName, sUrl, sEmail, sLicense string) *cydx.Component { | ||
return &cydx.Component{ | ||
Type: cydx.ComponentTypeApplication, | ||
Name: name, | ||
Version: version, | ||
Description: desc, | ||
Supplier: &cydx.OrganizationalEntity{ | ||
Name: sName, | ||
URL: &[]string{sUrl}, | ||
Contact: &[]cydx.OrganizationalContact{{Email: sEmail}}, | ||
}, | ||
Licenses: &cydx.Licenses{ | ||
{ | ||
License: &cydx.License{ | ||
ID: sLicense, | ||
}, | ||
}, | ||
}, | ||
} | ||
} |
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