certigo
certigo copied to clipboard
Attempting to verify a CSR causes panic: runtime error: index out of range
% certigo verify --name=REDACTED -f pem server2019.csr
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/square/certigo/lib.VerifyChain(0xc62e38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7ffc75d487a2, 0x18, 0x0, 0x0, ...)
/home/meta/go/src/github.com/square/certigo/lib/verify.go:129 +0x8e3
main.main()
/home/meta/go/src/github.com/square/certigo/main.go:183 +0x1033
We don't support verify
on cert requests (CSRs) at the moment, only on (issued) certificates. We should probably fix the output/error handling though. Out of curiosity, what kind of verification did you want to do on a CSR?
I just wanted to double check it was the right one, as I'm juggling TLS updates for a couple of machines right now. I understand it's not supported functionality, just thought you'd want to issue an error rather than crashing :-)
I'm seeing the same panic with the connect command:
Command: certigo connect google.com
Result
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
github.com/square/certigo/lib.explainCipher(0xc0000cf750, 0xc, 0xc0000cf750, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/certigo-20200106-66700-nqvrn2/certigo-1.11.0/lib/tls.go:182 +0x1e3
github.com/square/certigo/lib.EncodeTLSInfoToText(0xc0001e4000, 0x0, 0x2, 0x0)
/private/tmp/certigo-20200106-66700-nqvrn2/certigo-1.11.0/lib/tls.go:62 +0x148
main.main()
/private/tmp/certigo-20200106-66700-nqvrn2/certigo-1.11.0/main.go:162 +0x667
Is issue #213 related? @siebenmann mentions commit f81df5c as a possible culprit.
As suggested by @siebenmann, commenting out line 166 resolves the error for me.
cli/cli.go:166 fmt.Fprintf(stdout, "Input Format: %s\n", result.Formats[i])
@egrieco yes, the issue is related and we will track it in #213. Thanks!