Skip to content

Conversation

zeb33n
Copy link
Contributor

@zeb33n zeb33n commented Jul 31, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds the todot sub command for bom document. This command dumps the contents of the provided spdx file as a string of dotlang to stdout. This output can then be piped into a file for visualization by graphvis or other related programs. This overcomes the visualization limitations of bom document outline detailed here #530.

todot comes with a few cli arguments to help filter large SBOMs into a more digestible graph.

  • --find finds the reverse dependencies of a given package
  • --subgraph promotes a node with the given SPDXID to root ignoring all nodes that aren't descendants of the given node.
  • --depth the recursive depth.

for example the sbom.

SPDXVersion: SPDX-2.2
SPDXID: Document
DocumentName: Document


##### Package: glib

PackageName: glib
SPDXID: package-glib


##### Package: gnome

PackageName: gnome
SPDXID: package-gnome

##### Package: python

PackageName: python
SPDXID: package-python

##### Package: sqlite

PackageName: sqlite
SPDXID: package-sqlite

Relationship: package-glib CONTAINS package-python
Relationship: package-gnome CONTAINS package-python
Relationship: package-python CONTAINS package-sqlite

Will produce the dot
bom document todot file.spdx > file.dot

digraph {
"Document";
"Document" -> "package-gnome";
"package-gnome" [label="gnome" tooltip="SPXID: package-gnome\nversion: \nlicense: \nSupplier-Org:\nSupplier-Person: \nOriginator-Org: \nOriginator-Person: \nURL: " fontname = "monospace"];
"package-gnome" -> "package-python";
"package-python" [label="python" tooltip="SPXID: package-python\nversion: \nlicense: \nSupplier-Org:\nSupplier-Person: \nOriginator-Org: \nOriginator-Person: \nURL: " fontname = "monospace"];
"package-python" -> "package-sqlite";
"package-sqlite" [label="sqlite" tooltip="SPXID: package-sqlite\nversion: \nlicense: \nSupplier-Org:\nSupplier-Person: \nOriginator-Org: \nOriginator-Person: \nURL: " fontname = "monospace"];
"Document" -> "package-glib";
"package-glib" [label="glib" tooltip="SPXID: package-glib\nversion: \nlicense: \nSupplier-Org:\nSupplier-Person: \nOriginator-Org: \nOriginator-Person: \nURL: " fontname = "monospace"];
"package-glib" -> "package-python";
}

which when rendered with graphviz produces the following .png
dot -Tpng file.dot > file.png

file

Which issue(s) this PR fixes:

Fixes #530

Special notes for your reviewer:

Does this PR introduce a user-facing change?

added the `todot` subcommand to `document`. This dumps a representation of the spdx graph to stdout as dotlang. 

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 31, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zeb33n
Once this PR has been reviewed and has the lgtm label, please assign cpanato for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 31, 2025
@k8s-ci-robot k8s-ci-robot requested a review from puerco July 31, 2025 13:08
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 31, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @zeb33n. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 31, 2025
@zeb33n zeb33n changed the title Full featured branch Add bom document todot Jul 31, 2025
@zeb33n
Copy link
Contributor Author

zeb33n commented Aug 13, 2025

Hi, Is there anything i can do to move this forwards? thanks.

@zeb33n zeb33n force-pushed the full-featured-branch branch from e5859cd to 67a79e2 Compare August 27, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visualisation Limitations
2 participants