Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cyclone-dx presenter drops files, includes only packages #3435

Open
Pierre-Gronau-ndaal opened this issue Nov 11, 2024 · 1 comment · May be fixed by #3539
Open

cyclone-dx presenter drops files, includes only packages #3435

Pierre-Gronau-ndaal opened this issue Nov 11, 2024 · 1 comment · May be fixed by #3539
Assignees
Labels
bug Something isn't working good-first-issue Good for newcomers

Comments

@Pierre-Gronau-ndaal
Copy link

What happened:
export SYFT_FILE_METADATA_SELECTION="all"

syft scan "${REPO_PATH}" -o cyclonedx-json > sbom.json
syft scan "${REPO_PATH}" -o spdx-json > sbom.json

What you expected to happen:

for -o cyclonedx-json I expect that all files of the directory are in the sbom

Steps to reproduce the issue:

syft scan "${REPO_PATH}" -o cyclonedx-json > sbom.json
syft scan "${REPO_PATH}" -o spdx-json > sbom.json

with -o spdx-json the sbom filled up

Anything else we need to know?:

cat sbom.json
{"$schema":"http://cyclonedx.org/schema/bom-1.6.schema.json","bomFormat":"CycloneDX","specVersion":"1.6","serialNumber":"urn:uuid:d9f32702-f7d9-44a4-bd21-7b02f4c2ff67","version":1,"metadata":{"timestamp":"2024-11-11T19:10:42+01:00","tools":{"components":[{"type":"application","author":"anchore","name":"syft","version":"1.16.0"}]},"component":{"bom-ref":"c89118b3fe999aab","type":"file","name":"/***********************************"}}}

Environment:

  • Output of syft version: 1.16.0
  • OS (e.g: cat /etc/os-release or similar): Linux and macos
@Pierre-Gronau-ndaal Pierre-Gronau-ndaal added the bug Something isn't working label Nov 11, 2024
@willmurphyscode willmurphyscode moved this to Ready in OSS Nov 25, 2024
@willmurphyscode willmurphyscode added the good-first-issue Good for newcomers label Nov 25, 2024
@willmurphyscode
Copy link
Contributor

It looks like the cyclonedx presenter is outputting packages but not files. In cyclonedx, files are a type of component, and should be included here: https://github.com/anchore/syft/blob/main/syft/format/common/cyclonedxhelpers/to_format_model.go#L32-L37

@willmurphyscode willmurphyscode changed the title empty sbom if -o cyclonedx-json cyclone-dx presenter drops files, includes only packages Nov 25, 2024
@spiffcs spiffcs self-assigned this Nov 25, 2024
@spiffcs spiffcs moved this from Ready to In Progress in OSS Nov 26, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working good-first-issue Good for newcomers
Projects
Status: In Progress
3 participants