mirror of
https://github.com/anchore/syft.git
synced 2026-11-04 16:36:40 +01:00
Add support for dependency relationships for alpine (apk) (#1063)
* Fix type of pull deps and add support for provides Signed-off-by: Dan Luhring <dan+github@luhrings.com> * [wip] apk dependency lookup Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update whitespace for linter Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * adjust test conditions Signed-off-by: Timothy Gerla <tim@gerla.net> * fix TODOs and improve Provides parser * run simports after main merge Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * add tests to cover apk relationship parsing cases Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * generate JSON schema for breaking changes to apk metadata Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update tests to account for additional dependencies Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * [wip] fix relationship encoding for cyclonedx Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * simplify package relationships that can be expressed Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: Dan Luhring <dan+github@luhrings.com> Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> Signed-off-by: Timothy Gerla <tim@gerla.net> Co-authored-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com> Co-authored-by: Timothy Gerla <tim@gerla.net>
This commit is contained in:
co-authored by
Alex Goodman
Christopher Phillips
Timothy Gerla
parent
e58d0aecb8
commit
949cff158d
@@ -1,6 +1,8 @@
|
||||
package syftjson
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"github.com/anchore/syft/internal/log"
|
||||
@@ -113,12 +115,15 @@ func toSyftRelationship(idMap map[string]interface{}, relationship model.Relatio
|
||||
typ := artifact.RelationshipType(relationship.Type)
|
||||
|
||||
switch typ {
|
||||
case artifact.OwnershipByFileOverlapRelationship:
|
||||
fallthrough
|
||||
case artifact.ContainsRelationship:
|
||||
case artifact.OwnershipByFileOverlapRelationship, artifact.ContainsRelationship, artifact.DependencyOfRelationship:
|
||||
default:
|
||||
log.Warnf("unknown relationship type: %s", typ)
|
||||
return nil
|
||||
if !strings.Contains(string(typ), "dependency-of") {
|
||||
log.Warnf("unknown relationship type: %s", typ)
|
||||
return nil
|
||||
}
|
||||
// lets try to stay as compatible as possible with similar relationship types without dropping the relationship
|
||||
log.Warnf("assuming %q for relationship type %q", artifact.DependencyOfRelationship, typ)
|
||||
typ = artifact.DependencyOfRelationship
|
||||
}
|
||||
return &artifact.Relationship{
|
||||
From: from,
|
||||
|
||||
Reference in New Issue
Block a user