Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d734f3f

Browse files
authored
chore: reduce azure CA cert validity check period to 2 months (#12788)
Signed-off-by: Danny Kopping <[email protected]>
1 parent 0288e73 commit d734f3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

coderd/azureidentity/azureidentity_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,17 @@ func TestValidate(t *testing.T) {
5353

5454
func TestExpiresSoon(t *testing.T) {
5555
t.Parallel()
56+
const threshold = 2
57+
5658
for _, c := range azureidentity.Certificates {
5759
block, rest := pem.Decode([]byte(c))
5860
require.Zero(t, len(rest))
5961
cert, err := x509.ParseCertificate(block.Bytes)
6062
require.NoError(t, err)
6163

62-
expiresSoon := cert.NotAfter.Before(time.Now().AddDate(0, 3, 0))
64+
expiresSoon := cert.NotAfter.Before(time.Now().AddDate(0, threshold, 0))
6365
if expiresSoon {
64-
t.Errorf("certificate expires within 6 months %s: %s", cert.NotAfter, cert.Subject.CommonName)
66+
t.Errorf("certificate expires within %d months %s: %s", threshold, cert.NotAfter, cert.Subject.CommonName)
6567
} else {
6668
url := "no issuing url"
6769
if len(cert.IssuingCertificateURL) > 0 {

0 commit comments

Comments
 (0)