mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
Fix pattern matching of purls and document categories. Extract purls from relationships.
This commit is contained in:
parent
effd4a01af
commit
7f9449a12f
2 changed files with 13 additions and 2 deletions
|
|
@ -106,7 +106,7 @@ var cpePattern = patternUnmarshal("^(cpe:2\\.3:[aho\\*\\-](:(((\\?*|\\*?)([a-zA-
|
||||||
// PURL represents a package URL in an advisory.
|
// PURL represents a package URL in an advisory.
|
||||||
type PURL string
|
type PURL string
|
||||||
|
|
||||||
var pURLPattern = patternUnmarshal(`^pkg:[A-Za-z\\.\\-\\+][A-Za-z0-9\\.\\-\\+]*/.+`)
|
var pURLPattern = patternUnmarshal("^pkg:[A-Za-z\\.\\-\\+][A-Za-z0-9\\.\\-\\+]*/.+")
|
||||||
|
|
||||||
// XGenericURI represents an identifier for a product.
|
// XGenericURI represents an identifier for a product.
|
||||||
type XGenericURI struct {
|
type XGenericURI struct {
|
||||||
|
|
@ -223,7 +223,7 @@ type AggregateSeverity struct {
|
||||||
// DocumentCategory represents a category of a document.
|
// DocumentCategory represents a category of a document.
|
||||||
type DocumentCategory string
|
type DocumentCategory string
|
||||||
|
|
||||||
var documentCategoryPattern = patternUnmarshal(`^[^\\s\\-_\\.](.*[^\\s\\-_\\.])?$`)
|
var documentCategoryPattern = patternUnmarshal("^[^\\s\\-_\\.](.*[^\\s\\-_\\.])?$")
|
||||||
|
|
||||||
// Version is the version of a document.
|
// Version is the version of a document.
|
||||||
type Version string
|
type Version string
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,15 @@ func (uf *urlFinder) findURLs(adv *csaf.Advisory) {
|
||||||
for _, b := range tree.Branches {
|
for _, b := range tree.Branches {
|
||||||
recBranch(b)
|
recBranch(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Third iterate over relationships.
|
||||||
|
if tree.RelationShips != nil {
|
||||||
|
for _, rel := range *tree.RelationShips {
|
||||||
|
if rel != nil {
|
||||||
|
if fpn := rel.FullProductName; fpn != nil && fpn.ProductID != nil {
|
||||||
|
add(slices.Index(uf.ids, *fpn.ProductID), fpn.ProductIdentificationHelper)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue