cert-manager / webhook-example

A cert-manager sample repository for creating an ACME DNS01 solver webhook
Apache License 2.0
103 stars 407 forks source link

Panic: slice bounds out of range under arm64 because of old dependency pkg #18

Closed 4nx closed 3 years ago

4nx commented 3 years ago

Describe the bug: I started to create a new webhook for another DNS provider. You can find it here: github.com/4nx/cert-manager-webook-joker. While building and testing the package under arm64 I found a bug within an old dependency package which is used.

TEST_ZONE_NAME=xxx go test .
panic: runtime error: slice bounds out of range [:9] with length 8

goroutine 1 [running]:
github.com/miekg/dns.ClientConfigFromFile(0x1346942, 0x10, 0x0, 0x0, 0x0)
    /home/ubuntu/go/pkg/mod/github.com/miekg/dns@v0.0.0-20170721150254-0f3adef2e220/clientconfig.go:86 +0x8b4
github.com/jetstack/cert-manager/pkg/issuer/acme/dns/util.getNameservers(0x1346942, 0x10, 0x229a540, 0x2, 0x2, 0x0, 0x25, 0x21ba808)
    /home/ubuntu/go/pkg/mod/github.com/jetstack/cert-manager@v0.13.1/pkg/issuer/acme/dns/util/wait.go:51 +0x30
github.com/jetstack/cert-manager/pkg/issuer/acme/dns/util.init()
    /home/ubuntu/go/pkg/mod/github.com/jetstack/cert-manager@v0.13.1/pkg/issuer/acme/dns/util/wait.go:44 +0x88
FAIL    github.com/4nx/cert-manager-webhook-joker   0.122s
FAIL

The problem is that a very old version of github.com/miekg/dns package is still used:

https://github.com/jetstack/cert-manager-webhook-example/blob/7a722fd8517afee606f0c13673880f6eedee5d87/go.sum#L294

The project had a bug until version 1.0.4:

https://github.com/miekg/dns/blob/5364553f1ee9cddc7ac8b62dce148309c386695b/clientconfig.go#L94

which had been fixed in version 1.0.5 after this pull request https://github.com/miekg/dns/pull/642 through:

https://github.com/miekg/dns/pull/642/commits/0079071c4dab2f6e2e8f22e58c0790276bfbe6e2

The most recent version of the project is 1.1.35.

Expected behaviour: A working webhook under ARM64.

Steps to reproduce the bug: Simply following: https://github.com/4nx/cert-manager-webhook-joker#development under ARM64

Anything else we need to know?: The webhook is working under amd64.

Environment details::

/kind bug

4nx commented 3 years ago

I added a pull request to fix the bug only by updating the miekg/dns packages just a bit.

4nx commented 3 years ago

https://github.com/jetstack/cert-manager-webhook-example/pull/19