Skip to content

Commit

Permalink
deps: update module github.com/anchore/syft to v1.4.1 (#636)
Browse files Browse the repository at this point in the history
* deps: update module github.com/anchore/syft to v1.4.1

* test: update fixtures and enhance test debugging

Signed-off-by: Christian Kotzbauer <[email protected]>

---------

Signed-off-by: Christian Kotzbauer <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christian Kotzbauer <[email protected]>
  • Loading branch information
renovate[bot] and ckotzbauer authored May 11, 2024
1 parent 99f67bc commit 8673076
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 25 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.2
require (
github.com/DependencyTrack/client-go v0.13.0
github.com/anchore/stereoscope v0.0.3-0.20240501181043-2e9894674185
github.com/anchore/syft v1.3.0
github.com/anchore/syft v1.4.1
github.com/ckotzbauer/libk8soci v0.0.0-20240504122132-f3ca271bd874
github.com/ckotzbauer/libstandard v0.0.0-20240501040150-01588ea4e1cc
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -50,7 +50,7 @@ require (
github.com/becheran/wildmatch-go v1.0.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
github.com/charmbracelet/lipgloss v0.10.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cloudflare/circl v1.3.8 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/containerd v1.7.13 // indirect
github.com/containerd/continuity v0.4.2 // indirect
Expand All @@ -64,7 +64,7 @@ require (
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v26.1.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v26.1.0+incompatible // indirect
github.com/docker/docker v26.1.2+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
Expand Down Expand Up @@ -105,7 +105,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/kastenhq/goversion v0.0.0-20230811215019-93b2f8823953 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/knqyf263/go-rpmdb v0.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
Expand Down Expand Up @@ -150,7 +150,7 @@ require (
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
github.com/sassoftware/go-rpmutils v0.3.0 // indirect
github.com/sassoftware/go-rpmutils v0.4.0 // indirect
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
Expand All @@ -164,7 +164,7 @@ require (
github.com/sylabs/sif/v2 v2.11.5 // indirect
github.com/sylabs/squashfs v0.6.1 // indirect
github.com/therootcompany/xz v1.0.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/vbatts/go-mtree v0.5.3 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/vifraa/gopom v1.0.0 // indirect
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ github.com/anchore/syft v1.2.0 h1:e6cJVzHErrZuYTWlSjxI/JbXS5ipaN8cdjXwGpd34MQ=
github.com/anchore/syft v1.2.0/go.mod h1:0oY5LHY9MC/Mui6ZTjd0jcJRU6U6HNxaoQPWbZ4RhhY=
github.com/anchore/syft v1.3.0 h1:UxwhJoU2diapaY+x8omyE4D17nMprStt6kxaG5dL3XI=
github.com/anchore/syft v1.3.0/go.mod h1:eYoL6572mvgoKOJAqNJmW4/GxfqzdqF77Dar3PsZnMw=
github.com/anchore/syft v1.4.1 h1:4ofNePf3vuEyNZZW7SDmTX9uR/vHYXtHkcLbo27Mtjs=
github.com/anchore/syft v1.4.1/go.mod h1:2N75VGorI/18u2xSRAP/DEaZjjjVHtIXM+hFqSkfOTM=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
Expand Down Expand Up @@ -184,6 +186,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI=
github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -242,6 +246,8 @@ github.com/docker/docker v26.0.2+incompatible h1:yGVmKUFGgcxA6PXWAokO0sQL22BrQ67
github.com/docker/docker v26.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v26.1.0+incompatible h1:W1G9MPNbskA6VZWL7b3ZljTh0pXI68FpINx0GKaOdaM=
github.com/docker/docker v26.1.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v26.1.2+incompatible h1:UVX5ZOrrfTGZZYEP+ZDq3Xn9PdHNXaSYMFPDumMqG2k=
github.com/docker/docker v26.1.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A=
github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
Expand Down Expand Up @@ -522,6 +528,8 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0
github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
Expand Down Expand Up @@ -725,6 +733,8 @@ github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQ
github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
github.com/sassoftware/go-rpmutils v0.3.0 h1:tE4TZ8KcOXay5iIP64P291s6Qxd9MQCYhI7DU+f3gFA=
github.com/sassoftware/go-rpmutils v0.3.0/go.mod h1:hM9wdxFsjUFR/tJ6SMsLrJuChcucCa0DsCzE9RMfwMo=
github.com/sassoftware/go-rpmutils v0.4.0 h1:ojND82NYBxgwrV+mX1CWsd5QJvvEZTKddtCdFLPWhpg=
github.com/sassoftware/go-rpmutils v0.4.0/go.mod h1:3goNWi7PGAT3/dlql2lv3+MSN5jNYPjT5mVcQcIsYzI=
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e h1:7q6NSFZDeGfvvtIRwBrU/aegEYJYmvev0cHAwo17zZQ=
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
Expand Down Expand Up @@ -805,6 +815,8 @@ github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oW
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/vbatts/go-mtree v0.5.3 h1:S/jYlfG8rZ+a0bhZd+RANXejy7M4Js8fq9U+XoWTd5w=
Expand Down
2 changes: 1 addition & 1 deletion internal/syft/fixtures/alpine.cyclonedx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/alpine.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/alpine.spdxjson

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/node.cyclonedx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/node.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/node.spdxjson

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/redis.cyclonedx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/redis.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/syft/fixtures/redis.spdxjson

Large diffs are not rendered by default.

37 changes: 27 additions & 10 deletions internal/syft/syft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ func marshalCyclonedx(t *testing.T, x interface{}) string {
return string(s)
}

func writeErroredSbom(t *testing.T, assertResult bool, data, name, format string) {
if !assertResult {
err := os.WriteFile("./fixtures/"+name+"_generated."+format, []byte(data), 0644)
assert.NoError(t, err)
}
}

func testJsonSbom(t *testing.T, name, imageID string) {
format := "json"
s := syft.New(format, map[string]string{}, "0.0.0").WithSyftVersion("v9.9.9")
Expand All @@ -75,10 +82,14 @@ func testJsonSbom(t *testing.T, name, imageID string) {
err = json.Unmarshal(data, &fixture)
assert.NoError(t, err)

assert.JSONEq(t, marshalJson(t, output.Artifacts), marshalJson(t, fixture.Artifacts))
assert.JSONEq(t, marshalJson(t, output.ArtifactRelationships), marshalJson(t, fixture.ArtifactRelationships))
assert.JSONEq(t, marshalJson(t, output.Files), marshalJson(t, fixture.Files))
assert.JSONEq(t, marshalJson(t, output.Distro), marshalJson(t, fixture.Distro))
assertResult := assert.JSONEq(t, marshalJson(t, output.Artifacts), marshalJson(t, fixture.Artifacts))
writeErroredSbom(t, assertResult, sbom, name, format)
assertResult = assert.JSONEq(t, marshalJson(t, output.ArtifactRelationships), marshalJson(t, fixture.ArtifactRelationships))
writeErroredSbom(t, assertResult, sbom, name, format)
assertResult = assert.JSONEq(t, marshalJson(t, output.Files), marshalJson(t, fixture.Files))
writeErroredSbom(t, assertResult, sbom, name, format)
assertResult = assert.JSONEq(t, marshalJson(t, output.Distro), marshalJson(t, fixture.Distro))
writeErroredSbom(t, assertResult, sbom, name, format)
}

func testCyclonedxSbom(t *testing.T, name, imageID string) {
Expand All @@ -98,7 +109,8 @@ func testCyclonedxSbom(t *testing.T, name, imageID string) {
err = xml.Unmarshal(data, &fixture)
assert.NoError(t, err)

assert.Equal(t, marshalCyclonedx(t, output.Components), marshalCyclonedx(t, fixture.Components))
assertResult := assert.Equal(t, marshalCyclonedx(t, output.Components), marshalCyclonedx(t, fixture.Components))
writeErroredSbom(t, assertResult, sbom, name, format)
}

func testSpdxSbom(t *testing.T, name, imageID string) {
Expand All @@ -118,10 +130,14 @@ func testSpdxSbom(t *testing.T, name, imageID string) {
err = json.Unmarshal(data, &fixture)
assert.NoError(t, err)

assert.JSONEq(t, marshalJson(t, output.Packages), marshalJson(t, fixture.Packages))
assert.JSONEq(t, marshalJson(t, output.Relationships), marshalJson(t, fixture.Relationships))
assert.JSONEq(t, marshalJson(t, output.Files), marshalJson(t, fixture.Files))
assert.Equal(t, output.SpdxVersion, fixture.SpdxVersion)
assertResult := assert.JSONEq(t, marshalJson(t, output.Packages), marshalJson(t, fixture.Packages))
writeErroredSbom(t, assertResult, sbom, name, format)
assertResult = assert.JSONEq(t, marshalJson(t, output.Relationships), marshalJson(t, fixture.Relationships))
writeErroredSbom(t, assertResult, sbom, name, format)
assertResult = assert.JSONEq(t, marshalJson(t, output.Files), marshalJson(t, fixture.Files))
writeErroredSbom(t, assertResult, sbom, name, format)
assertResult = assert.Equal(t, output.SpdxVersion, fixture.SpdxVersion)
writeErroredSbom(t, assertResult, sbom, name, format)
}

// test for analysing an image completely without pullSecret
Expand All @@ -142,7 +158,8 @@ func testCyclonedxSbomWithoutPullSecrets(t *testing.T, name, imageID string) {
err = xml.Unmarshal(data, &fixture)
assert.NoError(t, err)

assert.Equal(t, marshalCyclonedx(t, output.Components), marshalCyclonedx(t, fixture.Components))
assertResult := assert.Equal(t, marshalCyclonedx(t, output.Components), marshalCyclonedx(t, fixture.Components))
writeErroredSbom(t, assertResult, sbom, name, format)
}

func TestSyft(t *testing.T) {
Expand Down

0 comments on commit 8673076

Please sign in to comment.