-
Notifications
You must be signed in to change notification settings - Fork 73
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
Enable conan support #781
base: dev
Are you sure you want to change the base?
Enable conan support #781
Conversation
} | ||
|
||
func (conan *ConanPackageHandler) installConanDependencies(conanFile string) (err error) { | ||
commandArgs := []string{"install", conanFile, "--build=missing"} |
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.
Before installing Conan dependencies with a default command we must check if an Install command was provided by the user (it is found in auditParams if exist), and if so- we should run it instead of the default command (since it might not work)
if err = conan.updateConanFile(conanFileTxt, vulnDetails); err != nil { | ||
return | ||
} | ||
return conan.installConanDependencies(conanFileTxt) |
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.
Why do we have to install after fixing the descriptor? Installation always comes with a risk of failure. Can't we just update the descriptor?
if err = conan.updateConanFile(conanFilePy, vulnDetails); err != nil { | ||
return | ||
} | ||
return conan.installConanDependencies(conanFilePy) |
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.
Why do we have to install after fixing the descriptor? Installation always comes with a risk of failure. Can't we just update the descriptor?
return | ||
} | ||
|
||
func (conan *ConanPackageHandler) installConanDependencies(conanFile string) (err error) { |
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.
Before running an install command we must check if we should resolve dependencies from Artifactory. if a deps_repo was provided we must configure Artifactory along with this deps repo and the registry we resolve from
return fmt.Errorf("impacted package %s not found, fix failed", vulnDetails.ImpactedDependencyName) | ||
} | ||
if err = os.WriteFile(conanFileName, []byte(fixedFile), 0600); err != nil { | ||
err = fmt.Errorf("an error occured while writing the fixed version of %s to the requirements file:\n%s", vulnDetails.ImpactedDependencyName, err.Error()) |
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.
err = fmt.Errorf("an error occured while writing the fixed version of %s to the requirements file:\n%s", vulnDetails.ImpactedDependencyName, err.Error()) | |
err = fmt.Errorf("an error occured while writing the fixed version of %s to the requirements file '%s': %s", conanFileName, vulnDetails.ImpactedDependencyName, err.Error()) |
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.
Overall looks good! Most of the comments are "cosmetics" and things we talked about that we can further discuss
📦 Vulnerable Dependencies✍️ Summary
🔬 Research DetailsDescription: |
This PR includes support of conan requirements file update. It does not support installation of the suggested fixes. In order to update the dependencies, the user should run a 'conan install' command with the suggested conan file..