Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Nov 24, 2024
1 parent 76b5f43 commit 575abd7
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 59 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ require (
)

// attiasas:xsc_to_xray
replace github.com/jfrog/jfrog-cli-security => github.com/attiasas/jfrog-cli-security v0.0.0-20241124080606-40f6d08e258b
replace github.com/jfrog/jfrog-cli-security => github.com/attiasas/jfrog-cli-security v0.0.0-20241124094455-a6122065912f

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 dev

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuW
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/attiasas/jfrog-cli-security v0.0.0-20241124080606-40f6d08e258b h1:sTHSQry6DTMI8p7XX+PrLs/oleOLbjdcsYHVn66sWd0=
github.com/attiasas/jfrog-cli-security v0.0.0-20241124080606-40f6d08e258b/go.mod h1:k4ks2Zq7aU+6Sz6MTTW6tQmMiX1QmQt8GWfzoz6EFBg=
github.com/attiasas/jfrog-cli-security v0.0.0-20241124094455-a6122065912f h1:oi8xWijdEPZXH5MWHeGWDEiexdsCz0qdSFPbYfdOo/s=
github.com/attiasas/jfrog-cli-security v0.0.0-20241124094455-a6122065912f/go.mod h1:k4ks2Zq7aU+6Sz6MTTW6tQmMiX1QmQt8GWfzoz6EFBg=
github.com/attiasas/jfrog-client-go v0.0.0-20241121140610-2b71c4552d15 h1:0NWisTlqXXw8SKvSHFAzkJOYked437OspjLzVWWoX8Q=
github.com/attiasas/jfrog-client-go v0.0.0-20241121140610-2b71c4552d15/go.mod h1:1a7bmQHkRmPEza9wva2+WVrYzrGbosrMymq57kyG5gU=
github.com/beevik/etree v1.4.0 h1:oz1UedHRepuY3p4N5OjE0nK1WLCqtzHf25bxplKOHLs=
Expand Down
14 changes: 0 additions & 14 deletions scanpullrequest/scanpullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,11 @@ func scanPullRequest(repo *utils.Repository, client vcsclient.VcsClient) (err er
pullRequestDetails.Target.Owner, pullRequestDetails.Target.Repository, pullRequestDetails.Target.Name))
log.Info("-----------------------------------------------------------")

// analyticsService := utils.AddAnalyticsGeneralEvent(nil, &repo.Server, analyticsScanPrScanType)
// defer func() {
// analyticsService.UpdateAndSendXscAnalyticsGeneralEventFinalize(err)
// }()

// Audit PR code
issues, err := auditPullRequest(repo, client)
if err != nil {
return
}
// if analyticsService.ShouldReportEvents() {
// analyticsService.AddScanFindingsToXscAnalyticsGeneralEventFinalize(issues.CountIssuesCollectionFindings())
// }

// Output results
shouldSendExposedSecretsEmail := issues.SecretsExists() && repo.SmtpServer != ""
Expand Down Expand Up @@ -162,12 +154,6 @@ func auditPullRequest(repoConfig *utils.Repository, client vcsclient.VcsClient)
}
}()

// If MSI exists we always need to report events
// if analyticsService.GetMsi() != "" {
// // MSI is passed to XrayGraphScanParams, so it can be later used by other analytics events in the scan phase
// scanDetails.XrayGraphScanParams.MultiScanId = analyticsService.GetMsi()
// }

issuesCollection = &utils.IssuesCollection{}
for i := range repoConfig.Projects {
scanDetails.SetProject(&repoConfig.Projects[i])
Expand Down
15 changes: 0 additions & 15 deletions scanrepository/scanrepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ func (cfp *ScanRepositoryCmd) scanAndFixRepository(repository *utils.Repository,
}

func (cfp *ScanRepositoryCmd) scanAndFixBranch(repository *utils.Repository) (err error) {
// cfp.analyticsService = utils.AddAnalyticsGeneralEvent(cfp.scanDetails.XscGitInfoContext, cfp.scanDetails.ServerDetails, analyticsScanRepositoryScanType)
// defer func() {
// cfp.analyticsService.UpdateAndSendXscAnalyticsGeneralEventFinalize(err)
// }()

repoDir, restoreBaseDir, err := cfp.cloneRepositoryOrUseLocalAndCheckoutToBranch()
if err != nil {
return
Expand All @@ -102,16 +97,6 @@ func (cfp *ScanRepositoryCmd) scanAndFixBranch(repository *utils.Repository) (er
err = errors.Join(err, restoreBaseDir(), fileutils.RemoveTempDir(repoDir))
}()

// If MSI exists we always need to report events
// if cfp.analyticsService.GetMsi() != "" {
// // MSI is passed to XrayGraphScanParams, so it can be later used by other analytics events in the scan phase
// cfp.scanDetails.XrayGraphScanParams.MultiScanId = cfp.analyticsService.GetMsi()
// cfp.scanDetails.XrayGraphScanParams.XscVersion, err = cfp.analyticsService.XscManager().GetVersion()
// if err != nil {
// return
// }
// }

cfp.scanDetails.MultiScanId, cfp.scanDetails.StartTime = xsc.SendNewScanEvent(
cfp.scanDetails.XrayVersion,
cfp.scanDetails.XscVersion,
Expand Down
27 changes: 0 additions & 27 deletions utils/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,6 @@ import (
xscservices "github.com/jfrog/jfrog-client-go/xsc/services"
)

// func AddAnalyticsGeneralEvent(gitInfoContext *services.XscGitInfoContext, serverDetails *config.ServerDetails, scanType string) *xsc.AnalyticsMetricsService {
// log.Debug("Initiating General Event report to Analytics service")
// analyticsService := xsc.NewAnalyticsMetricsService(serverDetails)
// if !analyticsService.ShouldReportEvents() {
// return analyticsService
// }
// analyticsService.AddGeneralEvent(createAnalyticsGeneralEvent(analyticsService, gitInfoContext, scanType))
// if analyticsService.GetMsi() != "" {
// analyticsService.SetFinalizeEvent(&xscservices.XscAnalyticsGeneralEventFinalize{MultiScanId: analyticsService.GetMsi()})
// } else {
// analyticsService.SetShouldReportEvents(false)
// }
// return analyticsService
// }

// func createAnalyticsGeneralEvent(analyticsService *xsc.AnalyticsMetricsService, gitInfo *services.XscGitInfoContext, scanType string) *xscservices.XscAnalyticsGeneralEvent {
// generalEvent := analyticsService.CreateGeneralEvent(xscservices.FrogbotProduct, xscservices.FrogbotType)
// generalEvent.ProductVersion = FrogbotVersion
// generalEvent.FrogbotScanType = scanType
// generalEvent.FrogbotCiProvider = resolveCi()
// if gitInfo != nil {
// generalEvent.GitInfo = gitInfo
// generalEvent.IsGitInfoFlow = true
// }
// return generalEvent
// }

func CreateScanEvent(serviceDetails *config.ServerDetails, gitInfo *services.XscGitInfoContext, scanType string) *xscservices.XscAnalyticsGeneralEvent {
event := xsc.CreateAnalyticsEvent(xscservices.FrogbotProduct, xscservices.FrogbotType, serviceDetails)
event.ProductVersion = FrogbotVersion
Expand Down

0 comments on commit 575abd7

Please sign in to comment.