Skip to content

RFC: build-style/cargo: produce auditable binaries#40272

Merged
classabbyamp merged 3 commits intovoid-linux:masterfrom
jcgruenhage:auditable-rust-binaries
Nov 3, 2022
Merged

RFC: build-style/cargo: produce auditable binaries#40272
classabbyamp merged 3 commits intovoid-linux:masterfrom
jcgruenhage:auditable-rust-binaries

Conversation

@jcgruenhage
Copy link
Copy Markdown
Contributor

Testing the changes

  • I tested the changes in this PR: YES

In contrast to other distros like f.ex. Fedora, we don't ship each crate in the
dependency tree of a rust project as its own (source) package, which means that
xbps isn't aware of those dependencies. Recovering what versions of specific
libraries are used on a system is made very hard by this, which leaves people
clueless what to do in a situation when a library has a CVE for example.

This change embeds a table of dependencies that went into this binary into the
binary itself, which means recovering what binaries contain which libraries
becomes fairly trivial. Go does this by default, and the long-term goal is to
do the same with Rust, but we aren't there yet.

An example for how usage could look like:

❯ syft packages --catalogers all --output syft-json /usr/bin | jq '.artifacts[] | select(.metadata.name=="tokio") | .locations[].path'
 ✔ Indexed /usr/bin        
 ✔ Cataloged packages      [1905 packages]

"sq"

This shows me that the only auditable rust binary depending on tokio on my
system right now is sq, and with different jq filters I can get out any info
I might need.

@classabbyamp
Copy link
Copy Markdown
Member

I like this, once the bootstrapping issue is solved and a cargo-world rebuild is tried (I can do this), I'd be happy to merge

@jcgruenhage jcgruenhage force-pushed the auditable-rust-binaries branch from ef7c450 to 7ae095e Compare November 1, 2022 19:37
@jcgruenhage
Copy link
Copy Markdown
Contributor Author

After some discussion on IRC, I've decided on a second bootstrap package. I've built a few things locally and it does work as expected for me, but I don't have the resources to do a world rebuild right now

Copy link
Copy Markdown
Member

@classabbyamp classabbyamp left a comment

Choose a reason for hiding this comment

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

i think the cargo-auditable{,-bootstrap} changes should be their own commits

@jcgruenhage jcgruenhage force-pushed the auditable-rust-binaries branch 2 times, most recently from cb47dfc to f4ae30d Compare November 1, 2022 21:55
@jcgruenhage
Copy link
Copy Markdown
Contributor Author

To make sure this isn't lost to the IRC backlock: I've rebuilt all 173 packages that use the cargo build style, and except for racer and signal-backup-decode, for which compilation failed, and eva which has a checksum issue (see #40280), they were all built successfully.

@jcgruenhage jcgruenhage force-pushed the auditable-rust-binaries branch from f4ae30d to f51f89d Compare November 1, 2022 22:39
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.

3 participants