File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -275,12 +275,11 @@ func (c *clientConfig) fillTLSConfig(hyConfig *client.Config) error {
275275 if c .TLS .PinSHA256 != "" {
276276 nHash := normalizeCertHash (c .TLS .PinSHA256 )
277277 hyConfig .TLSConfig .VerifyPeerCertificate = func (rawCerts [][]byte , _ [][]* x509.Certificate ) error {
278- for _ , cert := range rawCerts {
279- hash := sha256 .Sum256 (cert )
280- hashHex := hex .EncodeToString (hash [:])
281- if hashHex == nHash {
282- return nil
283- }
278+ cert := rawCerts [0 ] // only check the end-entity cert hash in the chain of trust
279+ hash := sha256 .Sum256 (cert )
280+ hashHex := hex .EncodeToString (hash [:])
281+ if hashHex == nHash {
282+ return nil
284283 }
285284 // No match
286285 return errors .New ("no certificate matches the pinned hash" )
You can’t perform that action at this time.
0 commit comments