Skip to content

Commit

Permalink
update core
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed May 9, 2024
1 parent e40b98b commit c05d9d6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion commands/scan/buildscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (bsc *BuildScanCommand) runBuildScanAndPrintResults(xrayManager *xray.XrayS
}
}

if err = utils.RecordSecurityCommandOutput(utils.SecurityCommandsGitHubSummary(), utils.ScanCommandSummaryResult{Results: scanResults.GetSummary(), Section: utils.Build}); err != nil {
if err = utils.RecordSecurityCommandOutput(utils.SecurityCommandsJobSummary(), utils.ScanCommandSummaryResult{Results: scanResults.GetSummary(), Section: utils.Build}); err != nil {
return false, err
}
return
Expand Down
2 changes: 1 addition & 1 deletion commands/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (scanCmd *ScanCommand) Run() (err error) {
return err
}

if err = utils.RecordSecurityCommandOutput(utils.SecurityCommandsGitHubSummary(), utils.ScanCommandSummaryResult{Results: scanResults.GetSummary(), Section: utils.Binary}); err != nil {
if err = utils.RecordSecurityCommandOutput(utils.SecurityCommandsJobSummary(), utils.ScanCommandSummaryResult{Results: scanResults.GetSummary(), Section: utils.Binary}); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion formats/summary_test.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Builds
#### Builds
```
✅ build-name (build-number)
✅ build-name (build-number)
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/jfrog/gofrog v1.7.1
github.com/jfrog/jfrog-apps-config v1.0.1
github.com/jfrog/jfrog-cli-core/v2 v2.51.0
github.com/jfrog/jfrog-client-go v1.40.1
github.com/jfrog/jfrog-client-go v1.40.2
github.com/magiconair/properties v1.8.7
github.com/owenrumney/go-sarif/v2 v2.3.0
github.com/stretchr/testify v1.9.0
Expand Down Expand Up @@ -48,7 +48,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jedib0t/go-pretty/v6 v6.5.8 // indirect
github.com/jedib0t/go-pretty/v6 v6.5.9 // indirect
github.com/jfrog/archiver/v3 v3.6.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
Expand Down Expand Up @@ -98,8 +98,8 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)

replace github.com/jfrog/jfrog-cli-core/v2 => github.com/EyalDelarea/jfrog-cli-core/v2 v2.0.0-20240509123010-5c7fb163e2d6
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/EyalDelarea/jfrog-cli-core/v2 v2.0.0-20240509144530-33e920097c4d

replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240509093347-62649bc00e43
// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go dev

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go dev
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/CycloneDX/cyclonedx-go v0.8.0 h1:FyWVj6x6hoJrui5uRQdYZcSievw3Z32Z88uYzG/0D6M=
github.com/CycloneDX/cyclonedx-go v0.8.0/go.mod h1:K2bA+324+Og0X84fA8HhN2X066K7Bxz4rpMQ4ZhjtSk=
github.com/EyalDelarea/jfrog-cli-core/v2 v2.0.0-20240509123010-5c7fb163e2d6 h1:IUci/6ByHf0sPs6vZJZYAXtHmFsSa779cdErjiGu9rM=
github.com/EyalDelarea/jfrog-cli-core/v2 v2.0.0-20240509123010-5c7fb163e2d6/go.mod h1:2tdqY2OG3Cv5xQX4LhKM6VsJLp+TLK3Dq7DXHcqFVkg=
github.com/EyalDelarea/jfrog-cli-core/v2 v2.0.0-20240509144530-33e920097c4d h1:/+e6Mx5xS8YEiGR57rYyukAQYzS79yGhgYx1K8z2guo=
github.com/EyalDelarea/jfrog-cli-core/v2 v2.0.0-20240509144530-33e920097c4d/go.mod h1:hB5R+BgmCbOoz5HZyyqEdv408rL26ej7ZSHfXGpLqmw=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
Expand Down Expand Up @@ -94,8 +94,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jedib0t/go-pretty/v6 v6.5.8 h1:8BCzJdSvUbaDuRba4YVh+SKMGcAAKdkcF3SVFbrHAtQ=
github.com/jedib0t/go-pretty/v6 v6.5.8/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU=
github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jfrog/archiver/v3 v3.6.0 h1:OVZ50vudkIQmKMgA8mmFF9S0gA47lcag22N13iV3F1w=
github.com/jfrog/archiver/v3 v3.6.0/go.mod h1:fCAof46C3rAXgZurS8kNRNdSVMKBbZs+bNNhPYxLldI=
github.com/jfrog/build-info-go v1.9.26 h1:1Ddc6+Ecvhc+UMnKhRVG1jGM6fYNwA49207azTBGBc8=
Expand All @@ -104,8 +104,8 @@ github.com/jfrog/gofrog v1.7.1 h1:ME1Meg4hukAT/7X6HUQCVSe4DNjMZACCP8aCY37EW/w=
github.com/jfrog/gofrog v1.7.1/go.mod h1:X7bjfWoQDN0Z4FQGbE91j3gbPP7Urwzm4Z8tkvrlbRI=
github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY=
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-client-go v1.28.1-0.20240509093347-62649bc00e43 h1:3kmtQcvoMvKgDY/aBC4lNHTkY6hxH/1e/np+TnGb+3U=
github.com/jfrog/jfrog-client-go v1.28.1-0.20240509093347-62649bc00e43/go.mod h1:m3hIn12eFWk5nJH1swPRtFrjXbiiCscOpX+v/vCdmNI=
github.com/jfrog/jfrog-client-go v1.40.2 h1:zdCWPPT11r0bMGnAXGhZPb3RrIINhiTFCceQABhguZ4=
github.com/jfrog/jfrog-client-go v1.40.2/go.mod h1:m3hIn12eFWk5nJH1swPRtFrjXbiiCscOpX+v/vCdmNI=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
Expand Down
15 changes: 8 additions & 7 deletions utils/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func ConvertSummarySectionToString(results ...formats.SummaryResults) string {

func GetSummaryString(summaries ...formats.SummaryResults) (str string) {
parsed := 0
singleScan := isSingleScan(summaries...)
singleScan := isSingleCommandAndScan(summaries...)
for _, summary := range summaries {
for _, scan := range summary.Scans {
if parsed > 0 {
Expand All @@ -203,26 +203,27 @@ func GetSummaryString(summaries ...formats.SummaryResults) (str string) {
return
}

func isSingleScan(summaries ...formats.SummaryResults) bool {
if len(summaries) > 0 {
func isSingleCommandAndScan(summaries ...formats.SummaryResults) bool {
if len(summaries) != 1 {
return false
}
if len(summaries[0].Scans) > 1 {
if len(summaries[0].Scans) != 1 {
return false
}
// One command and one scan
return true
}

func GetScanSummaryString(scan formats.ScanSummaryResult, singleScan bool) (content string) {
func GetScanSummaryString(scan formats.ScanSummaryResult, singleData bool) (content string) {
if !scan.HasIssues() {
if singleScan {
if singleData {
return "✅ No vulnerabilities were found"
}
return fmt.Sprintf("✅ %s", scan.Name)
}
// Has issues
content = "❌"
if !singleScan {
if !singleData {
content += fmt.Sprintf(" %s:", scan.Name)
}
content += " Found "
Expand Down
10 changes: 5 additions & 5 deletions utils/securityCommandSummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/jfrog/jfrog-cli-core/v2/githubsummaries"
"github.com/jfrog/jfrog-cli-core/v2/jobsummaries"
"github.com/jfrog/jfrog-cli-security/formats"
"github.com/jfrog/jfrog-client-go/utils/log"
)
Expand All @@ -30,16 +30,16 @@ type SecurityCommandsSummary struct {

type B []ScanCommandSummaryResult

func SecurityCommandsGitHubSummary() *githubsummaries.GitHubActionSummaryImpl {
return githubsummaries.NewGitHubActionSummaryImpl(&SecurityCommandsSummary{
func SecurityCommandsJobSummary() *jobsummaries.JobSummary {
return jobsummaries.NewJobSummaryImpl(&SecurityCommandsSummary{
BuildScanCommands: []formats.SummaryResults{},
ScanCommands: []formats.SummaryResults{},
AuditCommands: []formats.SummaryResults{},
})
}

func RecordSecurityCommandOutput(manager *githubsummaries.GitHubActionSummaryImpl, content ScanCommandSummaryResult) error {
return manager.RecordResult(content, githubsummaries.SecuritySection)
func RecordSecurityCommandOutput(manager *jobsummaries.JobSummary, content ScanCommandSummaryResult) error {
return manager.RecordResult(content, jobsummaries.SecuritySection)
}

func (scs *SecurityCommandsSummary) GetSectionTitle() string {
Expand Down

0 comments on commit c05d9d6

Please sign in to comment.