Skip to content

Commit

Permalink
Merge pull request #1172 from atc0005/early-exit-sans-list-eval-logic
Browse files Browse the repository at this point in the history
SANs List validation early exit when list is empty
  • Loading branch information
atc0005 authored Dec 16, 2024
2 parents ea15e68 + fe3061c commit d04d779
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/certs/validation-sans.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func ValidateSANsList(
//
// NOTE: While configuration validation is expected to prevent this
// scenario we explicitly guard against it.
case len(requiredEntries) == 0:
case len(requiredEntries) == 0 && !validationOptions.IgnoreValidationResultSANs:
return SANsListValidationResult{
certChain: certChain,
leafCert: leafCert,
Expand All @@ -119,6 +119,17 @@ func ValidateSANsList(
priorityModifier: priorityModifierMaximum,
}

// If we're not given a list to process AND we are asked to ignore this,
// abort early.
case len(requiredEntries) == 0 && validationOptions.IgnoreValidationResultSANs:
return SANsListValidationResult{
certChain: certChain,
leafCert: leafCert,
validationOptions: validationOptions,
err: nil,
ignored: validationOptions.IgnoreValidationResultSANs,
priorityModifier: priorityModifierBaseline,
}
}

// Assuming that the DNSNames slice is NOT already lowercase, so forcing
Expand Down

0 comments on commit d04d779

Please sign in to comment.