Skip to content

Filter SBOM by sources or binaries#184

Open
ssnaaz wants to merge 3 commits intosiemens:mainfrom
ssnaaz:filter_SBOM
Open

Filter SBOM by sources or binaries#184
ssnaaz wants to merge 3 commits intosiemens:mainfrom
ssnaaz:filter_SBOM

Conversation

@ssnaaz
Copy link

@ssnaaz ssnaaz commented Mar 3, 2026

No description provided.

@ssnaaz
Copy link
Author

ssnaaz commented Mar 3, 2026

debsbom filter command:

debsbom filter -h
usage: debsbom filter [-h] [-t {cdx,spdx}] [--sources] [--binaries] BOMIN bomout

positional arguments:
  BOMIN                 sbom file(s) to process for 'bomin'. Use '-' to read from stdin
  bomout                sbom output file. Use '-' to write to stdout

options:
  -h, --help            show this help message and exit
  -t, --sbom-type {cdx,spdx}
                        SBOM type to process (default: auto-detect), required when reading from stdin
  --sources             operate only on source packages (skip binaries)
  --binaries            operate only on binary packages (skip sources)

from ..util.sbom_processor import SbomProcessor
from ..resolver.resolver import PackageResolver, PackageStreamResolver
from ..sbom import SBOMType
from ..sbom import SBOMType, SPDX_REF_DOCUMENT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we import SPDX_REF_DOCUMENT here? This code location should be sbom type agnostic.

repack repack sources and sbom
export export SBOM as graph
delta list components added in target SBOM
filter filter SBOM by sources or binaries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commands are getting more and more. How about sorting them by alphabet?

@fmoessbauer
Copy link
Member

Hi @ssnaaz , thanks for implementing this. The implementation already looks pretty clean. Just some minor remarks that need to be fixed before merging.

... and please add a test (both a smoke test in the GH actions as well as a unit test).

Signed-off-by: Syeda Shagufta Naaz <syedashagufta.naaz@siemens.com>
@ssnaaz ssnaaz force-pushed the filter_SBOM branch 2 times, most recently from 131e731 to 4e1e574 Compare March 5, 2026 09:45
- filter the SBOM input by sources or binaries
- preserve the dependency tree
- sort commands alphabetically

Signed-off-by: Syeda Shagufta Naaz <syedashagufta.naaz@siemens.com>
Signed-off-by: Syeda Shagufta Naaz <syedashagufta.naaz@siemens.com>
@ssnaaz
Copy link
Author

ssnaaz commented Mar 5, 2026

@fmoessbauer Thank you for the feedback, I have updated the MR, please have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants