|
1 | 1 | package packagehandlers
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "errors" |
5 | 4 | "fmt"
|
6 | 5 | "github.com/jfrog/frogbot/v2/utils"
|
7 | 6 | "github.com/jfrog/jfrog-client-go/utils/log"
|
@@ -47,23 +46,25 @@ func (conan *ConanPackageHandler) updateDirectDependency(vulnDetails *utils.Vuln
|
47 | 46 | }
|
48 | 47 | if !isAnyDescriptorFileChanged {
|
49 | 48 | err = fmt.Errorf("impacted package '%s' was not found or could not be fixed in all descriptor files", vulnDetails.ImpactedDependencyName)
|
| 49 | + } else { |
| 50 | + conan.logNoInstallationMessage() |
50 | 51 | }
|
51 |
| - conan.logNoInstallationMessage() |
52 | 52 | return
|
53 | 53 | }
|
54 | 54 |
|
55 | 55 | func (conan *ConanPackageHandler) updateConanFile(conanFile string, vulnDetails *utils.VulnerabilityDetails) (isFileChanged bool, err error) {
|
56 | 56 | data, err := os.ReadFile(conanFile)
|
57 | 57 | if err != nil {
|
58 |
| - return false, errors.New("an error occurred while attempting to read the requirements file:\n" + err.Error()) |
| 58 | + return false, fmt.Errorf("an error occurred while attempting to read the requirements file '%s': %s\n", conanFile, err.Error()) |
59 | 59 | }
|
60 | 60 | currentFile := string(data)
|
61 | 61 | fixedPackage := vulnDetails.ImpactedDependencyName + "/" + vulnDetails.SuggestedFixedVersion
|
62 | 62 | impactedDependency := vulnDetails.ImpactedDependencyName + "/" + vulnDetails.ImpactedDependencyVersion
|
63 | 63 | fixedFile := strings.Replace(currentFile, impactedDependency, strings.ToLower(fixedPackage), 1)
|
64 | 64 |
|
65 | 65 | if fixedFile == currentFile {
|
66 |
| - return false, fmt.Errorf("impacted dependency '%s' not found in descriptor '%s', fix failed vulnerability", impactedDependency, conanFile) |
| 66 | + log.Info(fmt.Sprintf("impacted dependency '%s' not found in descriptor '%s', moving to the next descriptor if exists...", impactedDependency, conanFile)) |
| 67 | + return false, nil |
67 | 68 | }
|
68 | 69 | if err = os.WriteFile(conanFile, []byte(fixedFile), 0600); err != nil {
|
69 | 70 | err = fmt.Errorf("an error occured while writing the fixed version of %s to the requirements file '%s': %s", conanFile, vulnDetails.ImpactedDependencyName, err.Error())
|
|
0 commit comments