praetorian-inc / gokart

A static analysis tool for securing Go code
Apache License 2.0
2.18k stars 110 forks source link

gokart fails after update to Go 1.20 #88

Open aka-mj opened 1 year ago

aka-mj commented 1 year ago

After updating to Go 1.20 I get the following error: running gokart version 0.5.1.

Using config found at /home/john/.gokart/analyzers.yml

Revving engines VRMMM VRMMM
3...2...1...Go!
panic: no concrete method: func (*regexp/syntax.Inst).MatchEmptyWidth(before rune, after rune) bool

goroutine 1 [running]:
golang.org/x/tools/go/ssa.(*Program).declaredFunc(0xc0013546c0, 0xc001190420)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:149 +0xf9
golang.org/x/tools/go/ssa.(*Program).originFunc(0xc0002e5e50?, 0x40d907?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/source.go:193 +0x32
golang.org/x/tools/go/ssa.(*Program).addMethod(0xc0013546c0, 0xc001333100, 0xc0002e5e50, 0xa77ac0?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:109 +0x169
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001324550?}, 0x0, 0x1046368?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:200 +0x87f
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b010?, 0xc0004e1c80?}, 0x1, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:255 +0x6b6
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af70?, 0xc001611490?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:248 +0x589
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001324570?}, 0x0, 0x1046368?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:220 +0x5d1
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b010?, 0xc0004e1ce0?}, 0x1, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:255 +0x6b6
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af70?, 0xc001611420?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:248 +0x589
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7afe8?, 0xc001324580?}, 0x0, 0x1046368?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:223 +0x37b
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b010?, 0xc0004e1d40?}, 0x1, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:255 +0x6b6
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af70?, 0xc0016113b0?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:248 +0x589
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001324690?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:220 +0x5d1
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b038?, 0xc00141c4f8?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:260 +0x7f5
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc0013246e0?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:208 +0x1d0
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b038?, 0xc00141c528?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:260 +0x7f5
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001324ea0?}, 0x0, 0x1046368?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:209 +0x1f7
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b010?, 0xc0004e1ef0?}, 0x1, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:255 +0x6b6
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af70?, 0xc001610c40?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:248 +0x589
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001325510?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:220 +0x5d1
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b038?, 0xc00141d758?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:260 +0x7f5
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001332630?}, 0x0, 0x1046368?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:209 +0x1f7
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b010?, 0xc0013c84e0?}, 0x1, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:255 +0x6b6
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af70?, 0xc0013d6000?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:248 +0x589
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7af98?, 0xc001332c60?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:220 +0x5d1
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7b038?, 0xc00143c600?}, 0x0, 0x1046360?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:260 +0x7f5
golang.org/x/tools/go/ssa.(*Program).needMethods(0xc0013546c0, {0xc7afc0?, 0xc001496b00?}, 0x0, 0x90349e?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:237 +0x33e
golang.org/x/tools/go/ssa.(*Program).needMethodsOf(0xc0013546c0, {0xc7afc0?, 0xc001496b00?}, 0x9ba9af?)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/methods.go:172 +0x7f
golang.org/x/tools/go/ssa.(*Package).build(0xc001313880)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/builder.go:2427 +0x133
sync.(*Once).doSlow(0xc0013546c0?, 0xc0008d1b80?)
        /opt/hostedtoolcache/go/1.19.1/x64/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        /opt/hostedtoolcache/go/1.19.1/x64/src/sync/once.go:65
golang.org/x/tools/go/ssa.(*Package).Build(...)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/ssa/builder.go:2413
golang.org/x/tools/go/analysis/passes/buildssa.run(0xc00156cf70)
        /home/runner/go/pkg/mod/golang.org/x/tools@v0.1.12/go/analysis/passes/buildssa/buildssa.go:73 +0x1a8
github.com/praetorian-inc/gokart/run.RunAnalyzers({0x1075c00, 0x5, 0x0?}, 0xc0005bbc80)
        /home/runner/work/gokart/gokart/run/run.go:133 +0x1cf
github.com/praetorian-inc/gokart/run.Run({0x1075c00, 0x5, 0x5}, {0xc000189120?, 0x0?, 0x0?})
        /home/runner/work/gokart/gokart/run/run.go:42 +0x11e
github.com/praetorian-inc/gokart/analyzers.Scan({0xc000189120?, 0x1, 0x1})
        /home/runner/work/gokart/gokart/analyzers/scan.go:163 +0x5d8
github.com/praetorian-inc/gokart/cmd.glob..func1(0x107d200?, {0xc000189120, 0x1, 0x1})
        /home/runner/work/gokart/gokart/cmd/scan.go:91 +0x42d
github.com/spf13/cobra.(*Command).execute(0x107d200, {0xc0001890f0, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x107cf80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
github.com/praetorian-inc/gokart/cmd.Execute(...)
        /home/runner/work/gokart/gokart/cmd/root.go:61
main.main()
        /home/runner/work/gokart/gokart/main.go:38 +0x25
yozamacs commented 1 year ago

I had a similar issue, but with a slightly different error message panic: no concrete method: func (encoding/asn1.ObjectIdentifier).Equal(other encoding/asn1.ObjectIdentifier) bool also running gokark v0.5.1 with go 1.20

jspc commented 1 year ago

For me it was:

panic: no concrete method: func (*crypto/x509.Certificate).CheckCRLSignature(crl *crypto/x509/pkix.CertificateList) error

On versions:

$ gokart version
v0.5.1
$ go version
go version go1.20 linux/amd64

(pasting here for SEO)

spolab commented 1 year ago

panic: no concrete method: func (net/http/httptrace.ClientTrace).compose(old net/http/httptrace.ClientTrace)