From 0baec3014c910078830036827c5a8eaed42056cf Mon Sep 17 00:00:00 2001 From: Sarthak Ahuja <39986642+SarthakAhuja@users.noreply.github.com> Date: Wed, 11 Nov 2026 13:47:59 +0530 Subject: [PATCH 1/3] doc: document invalid X509Certificate validity times When a certificate's notBefore or notAfter time cannot be parsed, validFrom and validTo return the string 'Bad time value', and validFromDate and validToDate return an invalid Date. Relational comparisons with an invalid Date are always false, so a naive expiry check can treat such a certificate as valid. Document the current behavior and tell callers to reject invalid dates first. Signed-off-by: Sarthak Ahuja <39986642+SarthakAhuja@users.noreply.github.com> --- doc/api/crypto.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index b14c4876884f..8fa48a382bbf 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -3517,6 +3517,9 @@ added: v15.6.0 The date/time from which this certificate is valid. +If the certificate's `notBefore` time cannot be parsed, this is the string +`'Bad time value'`. + ### `x509.validFromDate`