feat: report unknowns in sbom (#2998)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Keith Zantow
2024-10-07 16:11:37 -04:00
committed by GitHub
co-authored by Alex Goodman
parent 4d7ed9f749
commit ccbee94b87
145 changed files with 4420 additions and 233 deletions
@@ -9,6 +9,7 @@ import (
"gopkg.in/yaml.v3"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/unknown"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/pkg"
@@ -85,7 +86,7 @@ func parsePubspecLock(_ context.Context, _ file.Resolver, _ *generic.Environment
)
}
return pkgs, nil, nil
return pkgs, nil, unknown.IfEmptyf(pkgs, "unable to determine packages")
}
func (p *pubspecLockPackage) getVcsURL() string {
@@ -106,3 +106,10 @@ func TestParsePubspecLock(t *testing.T) {
pkgtest.TestFileParser(t, fixture, parsePubspecLock, expected, expectedRelationships)
}
func Test_corruptPubspecLock(t *testing.T) {
pkgtest.NewCatalogTester().
FromFile(t, "test-fixtures/corrupt/pubspec.lock").
WithError().
TestParser(t, parsePubspecLock)
}
@@ -0,0 +1,7 @@
pa
kages:
ale:
dependency: transitive
descr
s ps:
dart: ">=2.12.0 <3.0.0"