From c8271a858c36aa583a3847aeaf3879a048e10de6 Mon Sep 17 00:00:00 2001 From: Adam Chalkley Date: Wed, 18 Dec 2024 05:54:37 -0600 Subject: [PATCH] Clarify CertChainValidationResults.IsSucceeded Using the `IsOKState` method unintentionally made the logic harder to follow. While it technically worked, this commit emphasizes the requirement that no errors were encountered. --- internal/certs/validation-expiration.go | 2 +- internal/certs/validation-hostname.go | 2 +- internal/certs/validation-sans.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/certs/validation-expiration.go b/internal/certs/validation-expiration.go index 56ef410..97fd0a6 100644 --- a/internal/certs/validation-expiration.go +++ b/internal/certs/validation-expiration.go @@ -638,7 +638,7 @@ func (evr ExpirationValidationResult) IsIgnored() bool { // IsSucceeded indicates whether this validation check result is not flagged // as ignored and no problems with the certificate chain were identified. func (evr ExpirationValidationResult) IsSucceeded() bool { - return evr.IsOKState() && !evr.IsIgnored() + return !evr.IsIgnored() && evr.Err() == nil } // IsFailed indicates whether this validation check result is not flagged as diff --git a/internal/certs/validation-hostname.go b/internal/certs/validation-hostname.go index 3ce03f6..34f83f6 100644 --- a/internal/certs/validation-hostname.go +++ b/internal/certs/validation-hostname.go @@ -293,7 +293,7 @@ func (hnvr HostnameValidationResult) IsIgnored() bool { // IsSucceeded indicates whether this validation check result is not flagged // as ignored and no problems with the certificate chain were identified. func (hnvr HostnameValidationResult) IsSucceeded() bool { - return hnvr.IsOKState() && !hnvr.IsIgnored() + return !hnvr.IsIgnored() && hnvr.Err() == nil } // IsFailed indicates whether this validation check result is not flagged as diff --git a/internal/certs/validation-sans.go b/internal/certs/validation-sans.go index eefac44..0bba610 100644 --- a/internal/certs/validation-sans.go +++ b/internal/certs/validation-sans.go @@ -258,7 +258,7 @@ func (slvr SANsListValidationResult) IsIgnored() bool { // IsSucceeded indicates whether this validation check result is not flagged // as ignored and no problems with the certificate chain were identified. func (slvr SANsListValidationResult) IsSucceeded() bool { - return slvr.IsOKState() && !slvr.IsIgnored() + return !slvr.IsIgnored() && slvr.Err() == nil } // IsFailed indicates whether this validation check result is not flagged as