Skip to content

Commit

Permalink
Map our custom RecommendationDetails fields to generated Recommendati…
Browse files Browse the repository at this point in the history
…onDetails (#4)

The generated fields handled nil values (e.g. "impact_score"), but we later
tried to dereference them in our code even though our fields weren't
pointers.
  • Loading branch information
tiegz authored Aug 8, 2024
1 parent 7ae4420 commit 24f9fbc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/tidelift-sbom-vulnerability-reporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
type RecommendationDetails struct {
RealIssue bool `json:"real_issue"`
FalsePositiveReason *string `json:"false_positive_reason"`
ImpactScore int `json:"impact_score"`
ImpactDescription string `json:"impact_description"`
WorkaroundAvailable bool `json:"workaround_available"`
ImpactScore *int `json:"impact_score"`
ImpactDescription *string `json:"impact_description"`
WorkaroundAvailable *bool `json:"workaround_available"`
WorkaroundDescription *string `json:"workaround_description"`
}

Expand Down Expand Up @@ -144,9 +144,9 @@ func writeVulnerabilitiesReport(outputFile string, purls []packageurl.PackageURL
r := RecommendationDetails{
RealIssue: a.RecommendationDetails.RealIssue,
FalsePositiveReason: a.RecommendationDetails.FalsePositiveReason,
ImpactScore: *a.RecommendationDetails.ImpactScore,
ImpactDescription: *a.RecommendationDetails.ImpactDescription,
WorkaroundAvailable: *a.RecommendationDetails.WorkaroundAvailable,
ImpactScore: a.RecommendationDetails.ImpactScore,
ImpactDescription: a.RecommendationDetails.ImpactDescription,
WorkaroundAvailable: a.RecommendationDetails.WorkaroundAvailable,
WorkaroundDescription: a.RecommendationDetails.WorkaroundDescription,
}
v.RecommendationDetails = &r
Expand Down

0 comments on commit 24f9fbc

Please sign in to comment.