Documentation
¶
Index ¶
- Constants
- Variables
- func ArtifactPurl(scanner string, assetName string) string
- func BeautifyPURL(pURL string) (string, error)
- func ConvertToSemver(originalVersion string) string
- func FixFixedVersion(purl string, fixedVersion *string) *string
- func MapCDXToEventType(a *cdx.VulnerabilityAnalysis) string
- func MapCDXToVulnStatus(a *cdx.VulnerabilityAnalysis) string
- func PackageToPurl(ecosystem, packageName string) string
- func Purl(component cdx.Component) string
- func PurlToEcosystem(purlType string) string
- func RemoveOriginTypePrefixIfExists(origin string) (nodeType, string)
- func SemverFix(version string) (string, error)
- func SemverSort(versions []string)
- func StructuralCompareCdxBoms(a, b *cdx.BOM) error
- type CdxBom
- func (bom *CdxBom) AddChild(parent *TreeNode[cdxBomNode], child *TreeNode[cdxBomNode])
- func (bom *CdxBom) AddDirectChildWhichInheritsChildren(parent cdxBomNode, child cdxBomNode)
- func (bom *CdxBom) AddSourceChildrenToTarget(source *TreeNode[cdxBomNode], target *TreeNode[cdxBomNode])
- func (bom *CdxBom) CalculateDepth() map[string]int
- func (bom *CdxBom) CountParentTypes() map[string]map[nodeType]int
- func (bom *CdxBom) EjectMinimalDependencyTree() *minimalTreeNode
- func (bom *CdxBom) EjectSBOM(assetID *uuid.UUID) *cdx.BOM
- func (bom *CdxBom) EjectVex(assetID *uuid.UUID) *cdx.BOM
- func (bom *CdxBom) GetComponents() *[]cdx.Component
- func (bom *CdxBom) GetComponentsIncludingFakeNodes() *[]cdx.Component
- func (bom *CdxBom) GetDependencies() *[]cdx.Dependency
- func (bom *CdxBom) GetDependenciesIncludingFakeNodes() *[]cdx.Dependency
- func (bom *CdxBom) GetDependenciesOfComponent(componentRef string) *cdx.Dependency
- func (bom *CdxBom) GetDirectDependencies() *[]cdx.Dependency
- func (bom *CdxBom) GetInformationSourceNodes() []*TreeNode[cdxBomNode]
- func (bom *CdxBom) GetInformationSources() []string
- func (bom *CdxBom) GetMetadata() *cdx.Metadata
- func (bom *CdxBom) GetTransitiveDependencies() *[]cdx.Dependency
- func (bom *CdxBom) GetVulnerabilities() *[]cdx.Vulnerability
- func (bom *CdxBom) InformationFromVexOrMultipleSBOMs() []string
- func (bom *CdxBom) ReplaceOrAddInformationSourceNode(subTree *TreeNode[cdxBomNode])
- func (bom *CdxBom) ReplaceRoot(newRoot cdxBomNode)
- type Node
- type Tree
- func (tree *Tree[Element]) AddChild(parent *TreeNode[Element], child *TreeNode[Element])
- func (tree *Tree[Element]) AddDirectChildWhichInheritsChildren(parent Element, child Element)
- func (tree *Tree[Element]) AddSourceChildrenToTarget(source *TreeNode[Element], target *TreeNode[Element])
- func (tree *Tree[Data]) Reachable(id string) bool
- func (tree *Tree[Data]) RenderToMermaid() string
- func (tree *Tree[Element]) ReplaceNode(old *TreeNode[Element], new *TreeNode[Element])
- func (tree *Tree[Element]) ReplaceRoot(node Element)
- func (tree *Tree[Element]) ReplaceSubtree(other *TreeNode[Element])
- func (tree *Tree[Element]) Visitable() ([]string, []string)
- type TreeNode
Constants ¶
View Source
const ( NodeTypeComponent nodeType = "component" NodeTypeSbomInformationSource nodeType = "sbom" NodeTypeVexInformationSource nodeType = "vex" NodeTypeUnknown nodeType = "unknown" )
Variables ¶
View Source
var (
ErrInvalidVersion = fmt.Errorf("invalid version")
)
View Source
var PURLEcosystems = map[string]string{
"Alpine": "apk",
"crates.io": "cargo",
"Debian": "deb",
"Go": "golang",
"Hackage": "hackage",
"Hex": "hex",
"Maven": "maven",
"npm": "npm",
"NuGet": "nuget",
"OSS-Fuzz": "generic",
"Packagist": "composer",
"Pub": "pub",
"PyPI": "pypi",
"RubyGems": "gem",
}
View Source
var ValidSemverRegex = regexp.MustCompile(`^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`)
Regex for validating a correct semver.
Functions ¶
func ArtifactPurl ¶ added in v0.17.0
func BeautifyPURL ¶ added in v0.19.0
function to make purl look more visually appealing
func ConvertToSemver ¶
ConvertToSemver converts any versioning scheme to a semver-like versioning scheme
func FixFixedVersion ¶ added in v0.17.0
func MapCDXToEventType ¶ added in v0.19.0
func MapCDXToEventType(a *cdx.VulnerabilityAnalysis) string
func MapCDXToVulnStatus ¶ added in v0.19.0
func MapCDXToVulnStatus(a *cdx.VulnerabilityAnalysis) string
map CycloneDX Analysis State / Response to internal status strings used by CreateVulnEventAndApply
func PackageToPurl ¶
func PurlToEcosystem ¶
func RemoveOriginTypePrefixIfExists ¶ added in v0.19.0
func SemverSort ¶ added in v0.5.14
func SemverSort(versions []string)
func StructuralCompareCdxBoms ¶ added in v0.19.0
Types ¶
type CdxBom ¶ added in v0.19.0
type CdxBom struct {
// contains filtered or unexported fields
}
func FromNormalizedCdxBom ¶ added in v0.19.0
func MergeCdxBoms ¶ added in v0.17.0
func (*CdxBom) AddDirectChildWhichInheritsChildren ¶ added in v0.19.0
func (bom *CdxBom) AddDirectChildWhichInheritsChildren(parent cdxBomNode, child cdxBomNode)
func (*CdxBom) AddSourceChildrenToTarget ¶ added in v0.19.0
func (*CdxBom) CalculateDepth ¶ added in v0.19.0
func (*CdxBom) CountParentTypes ¶ added in v0.19.0
func (*CdxBom) EjectMinimalDependencyTree ¶ added in v0.19.0
func (bom *CdxBom) EjectMinimalDependencyTree() *minimalTreeNode
func (*CdxBom) GetComponents ¶ added in v0.19.0
func (*CdxBom) GetComponentsIncludingFakeNodes ¶ added in v0.19.0
func (*CdxBom) GetDependencies ¶ added in v0.19.0
func (bom *CdxBom) GetDependencies() *[]cdx.Dependency
func (*CdxBom) GetDependenciesIncludingFakeNodes ¶ added in v0.19.0
func (bom *CdxBom) GetDependenciesIncludingFakeNodes() *[]cdx.Dependency
func (*CdxBom) GetDependenciesOfComponent ¶ added in v0.19.0
func (bom *CdxBom) GetDependenciesOfComponent(componentRef string) *cdx.Dependency
func (*CdxBom) GetDirectDependencies ¶ added in v0.19.0
func (bom *CdxBom) GetDirectDependencies() *[]cdx.Dependency
func (*CdxBom) GetInformationSourceNodes ¶ added in v0.19.0
func (*CdxBom) GetInformationSources ¶ added in v0.19.0
func (*CdxBom) GetMetadata ¶ added in v0.19.0
func (*CdxBom) GetTransitiveDependencies ¶ added in v0.19.0
func (bom *CdxBom) GetTransitiveDependencies() *[]cdx.Dependency
func (*CdxBom) GetVulnerabilities ¶ added in v0.19.0
func (bom *CdxBom) GetVulnerabilities() *[]cdx.Vulnerability
func (*CdxBom) InformationFromVexOrMultipleSBOMs ¶ added in v0.19.0
func (*CdxBom) ReplaceOrAddInformationSourceNode ¶ added in v0.19.0
func (*CdxBom) ReplaceRoot ¶ added in v0.19.0
func (bom *CdxBom) ReplaceRoot(newRoot cdxBomNode)
type Tree ¶ added in v0.19.0
type Tree[Element Node] struct { Root *TreeNode[Element] `json:"root"` // contains filtered or unexported fields }
func BuildDependencyTree ¶ added in v0.19.0
func (*Tree[Element]) AddDirectChildWhichInheritsChildren ¶ added in v0.19.0
func (tree *Tree[Element]) AddDirectChildWhichInheritsChildren(parent Element, child Element)
func (*Tree[Element]) AddSourceChildrenToTarget ¶ added in v0.19.0
func (*Tree[Data]) RenderToMermaid ¶ added in v0.19.0
func (*Tree[Element]) ReplaceNode ¶ added in v0.19.0
func (*Tree[Element]) ReplaceRoot ¶ added in v0.19.0
func (tree *Tree[Element]) ReplaceRoot(node Element)
func (*Tree[Element]) ReplaceSubtree ¶ added in v0.19.0
Click to show internal directories.
Click to hide internal directories.