Skip to content
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

add a cataloger for binaries built with rust-audit #1116

Merged
merged 2 commits into from Jul 28, 2022

Conversation

tofay
Copy link
Contributor

@tofay tofay commented Jul 23, 2022

Fixes #1108

https://github.com/Shnatsel/rust-audit is a tool for embedding Rust dependency information into binaries for subsequent scanning/detection.
This PR adds support for detecting dependencies in binaries created with rust-audit. Per #1108 it's not enabled by default. (A motivation for syft integration is to get greater experience with rust-audit with a view to adding it to Rust itself).

The new cataloger is similar to the golang binary one - I modularized some of the golang binary cataloger code. Detection/parsing of the dependency information is done via https://github.com/microsoft/go-rustaudit, a go library for extracting Rust audit dependency information.

Signed-off-by: Tom Fay <tomfay@microsoft.com>
@spiffcs
Copy link
Contributor

spiffcs commented Jul 25, 2022

Thank you so much for the PR @tofay! I'll take a look this morning and see if we can get this into the next syft release.

@spiffcs
Copy link
Contributor

spiffcs commented Jul 27, 2022

PR looks good from a functionality perspective -

I just had a question when running it against binaries in the wild.

Is this the constraint that this cataloger will only work for static assets built with https://github.com/Shnatsel/rust-audit and with auditable_build::collect_dependency_list(); in a build script?

The integration test you added passed, but when I rant his against other binaries I found no packages being detected.

If this is the case can we rename the file binary_cataloger ==> audit_binary_cataloger just for keep it clear.

Thanks for updating the docs as well that points to this condition so we're not just advertising we can do static analysis for any binary!

I also noticed Getting some real-world experience with this before committing to a stable data format as a part of their roadmap for moving this into cargo.

Are there any competing projects or other contenders that we might have to flip to in the future?

@spiffcs
Copy link
Contributor

spiffcs commented Jul 27, 2022

cc @wagoodman for a 2nd review here

@spiffcs spiffcs requested a review from a team July 27, 2022 20:51
Copy link
Contributor

@spiffcs spiffcs left a comment

Choose a reason for hiding this comment

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

See above comments - waiting for second review

@tofay
Copy link
Contributor Author

tofay commented Jul 28, 2022

Thanks for looking at this. I appreciate it's not as straightforward as "add support for widely used language ecosystem X" type PRs :)

Is this the constraint that this cataloger will only work for static assets built with https://github.com/Shnatsel/rust-audit and with auditable_build::collect_dependency_list(); in a build script?

Correct. Would it help set expectations for this cataloger if the cataloger name was prefixed with experimental-? I can change the file name as you suggest.

I also noticed Getting some real-world experience with this before committing to a stable data format as a part of their roadmap for moving this into cargo. Are there any competing projects or other contenders that we might have to flip to in the future?

There aren't other competing projects that I'm aware of. In terms of data formats - I'm looking into language-agnostic options to embed dependency information into binaries. e.g ossf/wg-vulnerability-disclosures#76 and spdx/spdx-spec#739

@spiffcs
Copy link
Contributor

spiffcs commented Jul 28, 2022

Cool! No need for the experimental name change unless @wagoodman has opinions there.

I'm happy with its current state since it's not in the default path and is something we can toggle/experiment with. Approved and thanks again so much for the contribution.

Signed-off-by: Tom Fay <tomfay@microsoft.com>
@spiffcs spiffcs enabled auto-merge (squash) July 28, 2022 18:17
@spiffcs spiffcs merged commit 9896ff1 into anchore:main Jul 28, 2022
aiwantaozi pushed a commit to aiwantaozi/syft that referenced this pull request Oct 20, 2022
* add a cataloger for binaries built with rust-audit

Signed-off-by: Tom Fay <tomfay@microsoft.com>
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
* add a cataloger for binaries built with rust-audit

Signed-off-by: Tom Fay <tomfay@microsoft.com>
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.

Add support for auditable Rust binaries
2 participants