@@ -134,6 +134,8 @@ func findVexRuleFromPath(vexRulePath string, vexRules []VexRule) (VexRule, bool)
134134// Some more requirements to consider:
135135// Application / Creation of vex rules counts as a vote
136136
137+ var NoRecommendationErr = fmt .Errorf ("no recommendation" )
138+
137139func CrowdsourcedVexing (dependencyPath []string , cve CVE , vexRules []VexRule , organizations []Organization , projects []Project , assets []Asset ) (VexRule , error ) {
138140 var adjustedDiminishmentFactor = baseDiminishmentFactor
139141 // If there is only one organization, we don't need a diminishmentfactor and therefore it should be set to 1 (no diminishment, value is worth fully)
@@ -267,7 +269,7 @@ func CrowdsourcedVexing(dependencyPath []string, cve CVE, vexRules []VexRule, or
267269 // [Mitigation 15] Require a minimum number of voters for a decision; disabling the recommendation when too few voters remain
268270 if validVotesCount < minVoterThreshold {
269271 slog .Info ("not enough valid votes to create a crowdsourced VEX rule" , "validVotesCount" , validVotesCount )
270- return VexRule {}, nil
272+ return VexRule {}, NoRecommendationErr
271273 }
272274
273275 var crowdsourcedVexRule VexRule
@@ -283,14 +285,14 @@ func CrowdsourcedVexing(dependencyPath []string, cve CVE, vexRules []VexRule, or
283285 // [Mitigation 31] Use standardized cutoff; test with extreme values; define deterministictie-breaking rules
284286 // After the sorting, the VexRule with the highest confidence will be at the end of the sortableVotes slice, so we can compare it with the second to last to check for a tie
285287 if len (sortableVotes ) == 0 {
286- return VexRule {}, nil
288+ return VexRule {}, NoRecommendationErr
287289 }
288290 if len (sortableVotes ) > 1 {
289291 if votes [sortableVotes [len (sortableVotes )- 1 ]].Value == votes [sortableVotes [len (sortableVotes )- 2 ]].Value {
290292 // Inconclusive result, no clear winner
291293 // In this case we don't recommend any VexRule to the user, to encourage manual assessment by the user
292294 // to generate more data for a better recommendation in the future
293- return VexRule {}, nil
295+ return VexRule {}, NoRecommendationErr
294296 } else {
295297 // At this point we have a recommendation for a VexRule and want to return the datastructure of the VexRule to the user
296298 // For that take any fitting VexRule from the database, since they should all be the same
0 commit comments