Skip to content

feat: rust analysis support#252

Merged
soul2zimate merged 11 commits into
guacsec:mainfrom
soul2zimate:rust_main
Feb 3, 2026
Merged

feat: rust analysis support#252
soul2zimate merged 11 commits into
guacsec:mainfrom
soul2zimate:rust_main

Conversation

@soul2zimate

Copy link
Copy Markdown
Contributor

Description

feat: rust analysis support

Related issue (if any): https://issues.redhat.com/browse/TC-3459

Checklist

  • I have followed this repository's contributing guidelines.
  • I will adhere to the project's code of conduct.

Additional information

Assisted-by: Claude Code

@soul2zimate
soul2zimate requested a review from ruromero January 27, 2026 09:06
@soul2zimate

Copy link
Copy Markdown
Contributor Author

@ruromero please review when you have time.

@ruromero ruromero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @soul2zimate
I have added a first round of comments. After you refactor and answer some of my questions I'd like to review again.

Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/tools/Ecosystem.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/RustProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated

@ruromero ruromero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

I have added 2 small suggestions.

Overall Design

After looking deeper in to how you addressed the problem I think it provides a great opportunity to introduce a complex but powerful feature for monorepo projects that we could consider adding to all the other package managers.

If I understood correctly your approach you resolve all the tree from the root down to the members but the dependencies are added to the root, meaning that
root.deps = [member1.dep1, member1.dep2, member2.dep3, ...]
That creates an incorrect SBOM because we don't know which deps each member has and it can be that different members introduce the same dep with different version or that a member depends on another member.
But we can use that to our benefit and consider the possibility to create a complex SBOM where we will have something like:

root
 member1
   dep1, dep2
 member2
   dep1, dep3
...

The stack analysis and generated SBOMs will be much detailed. We can also use the component analysis to underline the members with vulnerabilities.

Regarding the root name/version in virtual workspaces, we can use the folder name and set a placeholder version or the workspace.version if defined.

What do you think?

Comment thread src/main/java/io/github/guacsec/trustifyda/providers/rust/model/CargoPackage.java Outdated

@ruromero ruromero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have reviewed the cargo metadata command execution because I think it doesn't need to use Threads.

Also I see that in general you're adding many unnecessary comments. This is not a good habit unless the code is simple but complex to understand. Try to avoid comments where the code is self-explanatory. I've commented some good / bad examples in your code.

Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/rust/model/ProjectInfo.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
@soul2zimate

Copy link
Copy Markdown
Contributor Author

Thank you. I have updated to address the review on cargo metadata command execution, I will review and keep/remove comments in next upcoming workspace members hierarchical dependency processing commit

@soul2zimate

Copy link
Copy Markdown
Contributor Author

I have fixed the workspace dependency processing, this now covers all three valid project structures as described below:

Crate Type Component Analysis Stack Analysis Implementation Method
SINGLE_CRATE Root crate's direct dependencies only Root crate + all transitive dependencies handleSingleCrate()
WORKSPACE_VIRTUAL Dependencies from [workspace.dependencies] in TOML All workspace members + their transitive dependencies handleVirtualWorkspace()
WORKSPACE_WITH_ROOT_CRATE Root crate's direct dependencies
(workspace members only if actual deps)
Root crate + transitive dependencies
(workspace members only if in root crate's dep graph)
handleSingleCrate()

@soul2zimate
soul2zimate requested a review from ruromero February 2, 2026 08:39

@ruromero ruromero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Only one concern about the error handling. The rest looks very nice and I think this will set some ground for more complex sbom generation.
Thanks

Comment thread src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java Outdated
@soul2zimate
soul2zimate marked this pull request as ready for review February 2, 2026 10:02

@ruromero ruromero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, thanks!

@soul2zimate
soul2zimate merged commit d343165 into guacsec:main Feb 3, 2026
24 of 39 checks passed
@soul2zimate

Copy link
Copy Markdown
Contributor Author

Merged. Thank you for the patient review

@soul2zimate
soul2zimate deleted the rust_main branch February 3, 2026 08:12
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.

2 participants