Skip to content

Commit a013ac3

Browse files
committed
chore: give better error messages for some stupid config files
1 parent ee5d77c commit a013ac3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

component/ca/fingerprint.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ import (
1111

1212
// NewFingerprintVerifier returns a function that verifies whether a certificate's SHA-256 fingerprint matches the given one.
1313
func NewFingerprintVerifier(fingerprint string) (func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error, error) {
14+
switch fingerprint {
15+
case "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized": // WTF???
16+
return nil, fmt.Errorf("`fingerprint` is used for TLS certificate pinning. If you need to specify the browser fingerprint, use `client-fingerprint`")
17+
}
1418
fingerprint = strings.TrimSpace(strings.Replace(fingerprint, ":", "", -1))
1519
fpByte, err := hex.DecodeString(fingerprint)
1620
if err != nil {
17-
return nil, err
21+
return nil, fmt.Errorf("fingerprint string decode error: %w", err)
1822
}
1923

2024
if len(fpByte) != 32 {

0 commit comments

Comments
 (0)