Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
talarian1 committed May 24, 2023
2 parents c07d9fb + 3633ef1 commit 7040b6a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
1 change: 1 addition & 0 deletions artifactory/utils/dependenciesutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ func createHttpClient(artDetails *config.ServerDetails) (rtHttpClient *jfroghttp
return
}

httpClientDetails = auth.CreateHttpClientDetails()
rtHttpClient, err = jfroghttpclient.JfrogClientBuilder().
SetCertificatesPath(certsPath).
SetInsecureTls(artDetails.InsecureTls).
Expand Down
16 changes: 16 additions & 0 deletions artifactory/utils/dependenciesutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package utils
import (
"testing"

"github.com/jfrog/jfrog-cli-core/v2/utils/config"
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -35,3 +36,18 @@ func TestGetFullRemoteRepoPath(t *testing.T) {
assert.Equal(t, test.expectedPath, actualPath)
}
}

func TestCreateHttpClient(t *testing.T) {
serverDetails := &config.ServerDetails{
Url: "https://acme.jfrog.io",
User: "elmar",
Password: "Egghead",
}
httpClient, httpClientDetails, err := createHttpClient(serverDetails)
assert.NoError(t, err)
assert.NotNil(t, httpClient)
assert.NotNil(t, httpClientDetails)

assert.Equal(t, "elmar", httpClientDetails.User)
assert.Equal(t, "Egghead", httpClientDetails.Password)
}
20 changes: 10 additions & 10 deletions xray/commands/audit/generic/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,29 +122,29 @@ func (auditCmd *GenericAuditCommand) Run() (err error) {
if entitled {
// Download (if needed) the analyzer manager in a background routine.
errGroup.Go(utils.DownloadAnalyzerManagerIfNeeded)
} else {
log.Info(`The ‘jf audit’ command also supports the ‘Contextual Analysis’ feature,
which is included as part of the ‘Advanced Security’ package.
This package isn't enabled on your system.
Read more - https://jfrog.com/security-and-compliance/`)
}
results, isMultipleRootProject, auditErr := GenericAudit(auditParams)

// Wait for the Download of the AnalyzerManager to complete.
if err = errGroup.Wait(); err != nil {
return err
}

extendedScanResults, err := audit.GetExtendedScanResults(results, auditParams.FullDependenciesTree(), serverDetails)
if err != nil {
return err
extendedScanResults := &xrutils.ExtendedScanResults{XrayResults: results, ApplicabilityScannerResults: nil, EntitledForJas: false}
// Try to run contextual analysis only if the user is entitled for advance security
if entitled {
extendedScanResults, err = audit.GetExtendedScanResults(results, auditParams.FullDependenciesTree(), serverDetails)
if err != nil {
return err
}
}

if auditCmd.Progress() != nil {
if err = auditCmd.Progress().Quit(); err != nil {
return
}
}
if !entitled {
log.Output("* The ‘jf audit’ command also supports the ‘Contextual Analysis’ feature, which is included as part of the ‘Advanced Security’ package.\n This package isn't enabled on your system. Read more - https://jfrog.com/security-and-compliance/")
}
// Print Scan results on all cases except if errors accrued on Generic Audit command and no security/license issues found.
printScanResults := !(auditErr != nil && xrutils.IsEmptyScanResponse(results))
if printScanResults {
Expand Down
7 changes: 4 additions & 3 deletions xray/utils/resultwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"bytes"
"encoding/json"
"fmt"
"strconv"
"strings"

"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/jfrog/jfrog-cli-core/v2/xray/formats"
clientUtils "github.com/jfrog/jfrog-client-go/utils"
Expand All @@ -12,8 +15,6 @@ import (
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray/services"
"github.com/owenrumney/go-sarif/v2/sarif"
"strconv"
"strings"
)

type OutputFormat string
Expand Down Expand Up @@ -54,7 +55,7 @@ func PrintScanResults(results *ExtendedScanResults, errors []formats.SimpleJsonE
if err != nil {
return err
}
log.Output("The full scan results are available here: " + resultsPath)
log.Output("* The full scan results are available here: " + resultsPath)
}
if includeVulnerabilities {
err = PrintVulnerabilitiesTable(vulnerabilities, results, isMultipleRoots, printExtended, scan)
Expand Down

0 comments on commit 7040b6a

Please sign in to comment.