Skip to content

Commit 47190f3

Browse files
committed
Require ClientAuth when verifying an X5cInsecure certificate
The X5cInsecure certificate is used by step-ca to renew certificates without using mTLS, usually expired certificates. Certificate.Verify defaults to require ServerAuth if no KeyUsages is set as an option. But due to how these tokens are used, it makes more sense to require only ClientAuth. Related to smallstep/certificates#1843
1 parent d694da8 commit 47190f3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jose/parse.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ func ParseX5cInsecure(tok string, roots []*x509.Certificate) (*JSONWebToken, [][
267267
Intermediates: interPool,
268268
// A hack so we skip validity period validation.
269269
CurrentTime: leaf.NotAfter.Add(-1 * time.Minute),
270+
KeyUsages: []x509.ExtKeyUsage{
271+
x509.ExtKeyUsageClientAuth,
272+
},
270273
})
271274
if err != nil {
272275
return nil, nil, errors.Wrap(err, "error verifying x5cInsecure certificate chain")

0 commit comments

Comments
 (0)