mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 00:22:08 -06:00
Merge pull request #182 from safedep/fix/auth-reporting-experience
fix: Auth and Reporting Experience (#180)
This commit is contained in:
commit
f6e055d5c5
@ -329,12 +329,10 @@ func (r *summaryReporter) renderRemediationAdvice() {
|
||||
break
|
||||
}
|
||||
|
||||
insight := utils.SafelyGetValue(sp.pkg.Insights)
|
||||
|
||||
tbl.AppendRow(table.Row{
|
||||
string(sp.pkg.Ecosystem),
|
||||
r.packageNameForRemediationAdvice(sp.pkg),
|
||||
utils.SafelyGetValue(insight.PackageCurrentVersion),
|
||||
r.packageUpdateVersionForRemediationAdvice(sp.pkg),
|
||||
sp.score,
|
||||
})
|
||||
|
||||
@ -368,6 +366,22 @@ func (r *summaryReporter) packageNameForRemediationAdvice(pkg *models.Package) s
|
||||
pkg.PackageDetails.Version)
|
||||
}
|
||||
|
||||
func (r *summaryReporter) packageUpdateVersionForRemediationAdvice(pkg *models.Package) string {
|
||||
insight := utils.SafelyGetValue(pkg.Insights)
|
||||
insightsCurrentVersion := utils.SafelyGetValue(insight.PackageCurrentVersion)
|
||||
|
||||
if insightsCurrentVersion == "" {
|
||||
return "Not Available"
|
||||
}
|
||||
|
||||
sver, _ := semver.Diff(pkg.PackageDetails.Version, insightsCurrentVersion)
|
||||
if sver.IsNone() {
|
||||
return "-"
|
||||
}
|
||||
|
||||
return insightsCurrentVersion
|
||||
}
|
||||
|
||||
func (r *summaryReporter) vulnSummaryStatement() string {
|
||||
return fmt.Sprintf("%d critical, %d high and %d other vulnerabilities were identified",
|
||||
r.summary.vulns.critical, r.summary.vulns.high,
|
||||
|
||||
9
scan.go
9
scan.go
@ -154,9 +154,14 @@ func listParsersCommand() *cobra.Command {
|
||||
|
||||
func startScan() {
|
||||
if !disableAuthVerifyBeforeScan {
|
||||
failOnError("auth/verify", auth.Verify(&auth.VerifyConfig{
|
||||
err := auth.Verify(&auth.VerifyConfig{
|
||||
ControlPlaneApiUrl: auth.DefaultControlPlaneApiUrl(),
|
||||
}))
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
failOnError("auth/verify", fmt.Errorf("failed to verify auth token: %v. "+
|
||||
"You may want to setup community mode using: vet auth configure --community", err))
|
||||
}
|
||||
}
|
||||
|
||||
if auth.CommunityMode() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user