-
Notifications
You must be signed in to change notification settings - Fork 35
Use cargo SBOM precursor files, if available #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If cargo sbom function is enabled, cargo-auditable will read the SBOM precursor file and use it to generate dependency information rather than trying to use the `cargo metadata` command.
Thanks a lot! I'll take a closer look in the next few days.
Looks like a bug in Cargo's SBOM support. I don't think we can actually ship with a bug like that. @arlosi are you aware of this issue? Should we file a bug upstream against Cargo? |
Isn't that a case of cargo being more accurate than cargo metadata? Without a build.rs, a crate can have no build dependencies, regardless of what is declared in Cargo.toml. |
Ah, you are probably right! I am a little rusty on the finer points of Cargo dependencies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only done a cursory look so far - it's a really hot day, sorry 😅
By and large this looks great! I've noted some nits, and I'll take a closer look at the format transformation algorithm in the next few days.
Thanks again!
Okay, I think I found an actual bug in Cargo: if I run |
Raised at rust-lang/cargo#15695 |
UPDATE: I messed up and tested the cargo-tree version instead of this one I've tried it on these 26 binary crates that produce 35 binaries: cavif gitoxide cargo-auditable cargo-audit cargo-show-asm cargo-cyclonedx ripgrep fd-find duct cargo-sort cargo-hack cargo-deny lsd procs httm t-rec tealdeer feluda lychee petname sarif-fmt rona zizmor aipack oxker cargo-outdated 20 of them have a different output between the current stable release and either of the precise dependency list branches, so it's great to see them making a difference. |
I've realized that I've messed up the real-world testing earlier and accidentally compared the I see surface-level divergences in all produced SBOMs when actually compare against this branch. It'll take me a bit to write a proper structural comparator and check for any divergences in actual content. I'd like to do that before I merge this. |
I looked into the differences and they all appear to be fixes. First, when running Second, on cargo-auditable itself e.g. the crate |
Yeah, |
Merged. Thank you! We still need to get rust-lang/cargo#15695 fixed before this becomes actually usable. And ideally also get rust-lang/cargo@bde57ce merged so that we could be confident it doesn't break in the future. In the meantime I'll try to complete #210 and add a |
If cargo sbom function is enabled, cargo-auditable will read the SBOM precursor file and use it to generate dependency information rather than trying to use the
cargo metadata
command.Closes #192
Slightly interestingly, cargo didn't include build dependencies for the test fixtures unless I added a build.rs files.