Uh oh!
There was an error while loading. Please reload this page.
Use cargo SBOM precursor files, if available - #213
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.
Shnatsel
commented
Jun 19, 2025
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. |
Shnatsel
commented
Jun 19, 2025
Ah, you are probably right! I am a little rusty on the finer points of Cargo dependencies. |
Shnatsel
left a comment
There was a problem hiding this comment.
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!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Shnatsel
commented
Jun 19, 2025
Okay, I think I found an actual bug in Cargo: if I run |
tofay
commented
Jun 22, 2025
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. |
Uh oh!
There was an error while loading. Please reload this page.
Shnatsel
commented
Jun 24, 2025
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. |
Shnatsel
commented
Jun 25, 2025
I looked into the differences and they all appear to be fixes. First, when running Second, on cargo-auditable itself e.g. the crate |
Shnatsel
commented
Jun 25, 2025
Yeah, |
Shnatsel
commented
Jun 25, 2025
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 metadatacommand.Closes#192
Slightly interestingly, cargo didn't include build dependencies for the test fixtures unless I added a build.rs files.