Skip to content

tls: Authority validation doesn't strip ports before validation #8719

@arjan-bal

Description

@arjan-bal

The HTTP2 :authority header frequently contains the port along with the hostname. The ValidateAuthority method should strip the port, if it exists, before calling VerifyHostname.

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...))
}

We should also add a test to verify the correct behaviour.

Metadata

Metadata

Assignees

Labels

Area: AuthIncludes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc.Type: Bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions