Skip to content

Commit

Permalink
short circuit cert extensions check (hashicorp#3712)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishoffman authored Dec 18, 2017
1 parent 67d4d31 commit 563edbe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions builtin/credential/cert/path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ func (b *backend) matchesNames(clientCert *x509.Certificate, config *ParsedCert)
// matchesCertificateExtenions verifies that the certificate matches configured
// required extensions
func (b *backend) matchesCertificateExtenions(clientCert *x509.Certificate, config *ParsedCert) bool {
// If no required extensions, nothing to check here
if len(config.Entry.RequiredExtensions) == 0 {
return true
}
// Fail fast if we have required extensions but no extensions on the cert
if len(clientCert.Extensions) == 0 {
return false
}

// Build Client Extensions Map for Constraint Matching
// x509 Writes Extensions in ASN1 with a bitstring tag, which results in the field
// including its ASN.1 type tag bytes. For the sake of simplicity, assume string type
Expand Down

0 comments on commit 563edbe

Please sign in to comment.