-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
Area: AuthIncludes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc.Includes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc.P2Type: Bug
Description
I noticed that the authority override call option is validated by the Tls client creds in an unexpected way.
Lines 57 to 67 in 50c6321
| func (t TLSInfo) ValidateAuthority(authority string) error { | |
| var errs []error | |
| for _, cert := range t.State.PeerCertificates { | |
| var err error | |
| if err = cert.VerifyHostname(authority); err == nil { | |
| return nil | |
| } | |
| errs = append(errs, err) | |
| } | |
| return fmt.Errorf("credentials: invalid authority %q: %v", authority, errors.Join(errs...)) | |
| } |
The code is iterating over the whole chain here. My understanding is that PeerCertificates[0] is the leaf, and that is the only certificate we should be checking the hostname against.
Validating against the rest of the chain seems to imply we accept a situation where the Authority header matches the name of an Intermediate CA, which doesn't seem right.
gRPC Java and C++ don't seem to validate the hostname from the HTTP2 authority header override against the TLS cert SANs at all.
Metadata
Metadata
Assignees
Labels
Area: AuthIncludes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc.Includes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc.P2Type: Bug