Skip to content

Commit

Permalink
feat: elf_binary_package_cataloger
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Ebarb <[email protected]>
  • Loading branch information
Brian Ebarb committed Mar 13, 2024
1 parent 4ca79c7 commit c5b69f8
Show file tree
Hide file tree
Showing 65 changed files with 3,705 additions and 60 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: "Static analysis"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap
Expand All @@ -31,16 +31,22 @@ jobs:
name: "Unit tests"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap

- name: Restore file executable test-fixture cache
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1
with:
path: syft/file/cataloger/executable/test-fixtures/bin
key: ${{ runner.os }}-unit-file-executable-cache-${{ hashFiles( 'syft/file/cataloger/executable/test-fixtures/cache.fingerprint' ) }}
path: syft/file/cataloger/executable/test-fixtures/elf/bin
key: ${{ runner.os }}-unit-file-executable-elf-cache-${{ hashFiles( 'syft/file/cataloger/executable/test-fixtures/elf/cache.fingerprint' ) }}

- name: Restore file executable shared-info test-fixture cache
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1
with:
path: syft/file/cataloger/executable/test-fixtures/shared-info/bin
key: ${{ runner.os }}-unit-file-executable-shared-info-cache-${{ hashFiles( 'syft/file/cataloger/executable/test-fixtures/shared-info/cache.fingerprint' ) }}

- name: Restore Java test-fixture cache
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1
Expand Down Expand Up @@ -81,7 +87,7 @@ jobs:
name: "Integration tests"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap
Expand All @@ -103,7 +109,7 @@ jobs:
name: "Build snapshot artifacts"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap
Expand Down Expand Up @@ -133,7 +139,7 @@ jobs:
needs: [Build-Snapshot-Artifacts]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap
Expand Down Expand Up @@ -181,7 +187,7 @@ jobs:
needs: [Build-Snapshot-Artifacts]
runs-on: macos-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap
Expand Down Expand Up @@ -226,7 +232,7 @@ jobs:
needs: [Build-Snapshot-Artifacts]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2

- name: Bootstrap environment
uses: ./.github/actions/bootstrap
Expand Down
9 changes: 6 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ tasks:
desc: Generate test fixture fingerprints
generates:
- cmd/syft/internal/test/integration/test-fixtures/cache.fingerprint
- syft/file/cataloger/executable/test-fixtures/cache.fingerprint
- syft/file/cataloger/executable/test-fixtures/elf/cache.fingerprint
- syft/file/cataloger/executable/test-fixtures/shared-info/cache.fingerprint
- syft/pkg/cataloger/binary/test-fixtures/cache.fingerprint
- syft/pkg/cataloger/java/test-fixtures/java-builds/cache.fingerprint
- syft/pkg/cataloger/golang/test-fixtures/archs/binaries.fingerprint
Expand All @@ -276,7 +277,8 @@ tasks:
- test/cli/test-fixtures/cache.fingerprint
cmds:
# for EXECUTABLE unit test fixtures
- "cd syft/file/cataloger/executable/test-fixtures && make cache.fingerprint"
- "cd syft/file/cataloger/executable/test-fixtures/elf && make cache.fingerprint"
- "cd syft/file/cataloger/executable/test-fixtures/shared-info && make cache.fingerprint"
# for IMAGE integration test fixtures
- "cd cmd/syft/internal/test/integration/test-fixtures && make cache.fingerprint"
# for BINARY unit test fixtures
Expand All @@ -297,7 +299,8 @@ tasks:
fixtures:
desc: Generate test fixtures
cmds:
- "cd syft/file/cataloger/executable/test-fixtures && make"
- "cd syft/file/cataloger/executable/test-fixtures/elf && make"
- "cd syft/file/cataloger/executable/test-fixtures/shared-info && make"
- "cd syft/pkg/cataloger/java/test-fixtures/java-builds && make"
- "cd syft/pkg/cataloger/redhat/test-fixtures && make"
- "cd syft/pkg/cataloger/binary/test-fixtures && make"
Expand Down
2 changes: 1 addition & 1 deletion internal/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package internal
const (
// JSONSchemaVersion is the current schema version output by the JSON encoder
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
JSONSchemaVersion = "16.0.4"
JSONSchemaVersion = "16.0.5"
)
1 change: 1 addition & 0 deletions internal/task/package_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func DefaultPackageTaskFactories() PackageTaskFactories {
},
pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.InstalledTag, pkgcataloging.ImageTag, "binary",
),
newSimplePackageTaskFactory(binary.NewELFPackageCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.InstalledTag, pkgcataloging.ImageTag, "binary", "elf-package"),
newSimplePackageTaskFactory(githubactions.NewActionUsageCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, "github", "github-actions"),
newSimplePackageTaskFactory(githubactions.NewWorkflowUsageCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, "github", "github-actions"),
newPackageTaskFactory(
Expand Down
30 changes: 30 additions & 0 deletions schema/json/schema-16.0.4.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,33 @@
"dso"
]
},
"ElfBinaryPackageNotes": {
"properties": {
"type": {
"type": "string"
},
"vendor": {
"type": "string"
},
"system": {
"type": "string"
},
"sourceRepo": {
"type": "string"
},
"commit": {
"type": "string"
}
},
"type": "object",
"required": [
"type",
"vendor",
"system",
"sourceRepo",
"commit"
]
},
"ElixirMixLockEntry": {
"properties": {
"name": {
Expand Down Expand Up @@ -1410,6 +1437,9 @@
{
"$ref": "#/$defs/DpkgDbEntry"
},
{
"$ref": "#/$defs/ElfBinaryPackageNotes"
},
{
"$ref": "#/$defs/ElixirMixLockEntry"
},
Expand Down
Loading

0 comments on commit c5b69f8

Please sign in to comment.