Skip to content

Panics with Go 1.24 #1751

@corani

Description

@corani

Describe the bug
When compiled with Go 1.24.0, gitleaks panics with error:

$ go version
go version go1.24.0 linux/amd64

$ make build

$ ./gitleaks  version
v8.23.3

$ ./gitleaks git -v


    │╲
    │ ○
    ○ ░
    ░    gitleaks

panic: wasm error: invalid table access
        wasm stack trace:
                .$27(i32,i32,i32,i32)
                .$398(i32)
                .$430(i32,i32)
                .$428(i32,i32,i32)
                .$474(i32)
                .$652(i32,i32,i32)
                .$666(i32,i32,i32) i32

goroutine 1 [running]:
github.com/wasilibs/go-re2/internal.newRE(0xc0013df680, {0x5885e0?, 0xc001b164f8?}, {0x39?, 0x3c?, 0x47?, 0x0?})
        /go/pkg/mod/github.com/wasilibs/go-re2@v1.8.0/internal/re2_wazero.go:289 +0x269
github.com/wasilibs/go-re2/internal.Compile({0xc0005885e0, 0x20}, {0xd5?, 0xa3?, 0x6a?, 0x76?})
        /go/pkg/mod/github.com/wasilibs/go-re2@v1.8.0/internal/re2.go:67 +0x165
github.com/wasilibs/go-re2.Compile(...)
        /go/pkg/mod/github.com/wasilibs/go-re2@v1.8.0/re2.go:46
github.com/wasilibs/go-re2.MustCompile({0xc0005885e0, 0x20})
        /go/pkg/mod/github.com/wasilibs/go-re2@v1.8.0/re2.go:76 +0x2e
github.com/zricethezav/gitleaks/v8/regexp.MustCompile(...)
        /pwd/gitleaks/regexp/wasilibs_regex.go:14
github.com/zricethezav/gitleaks/v8/config.(*ViperConfig).Translate(_)
        /pwd/gitleaks/config/config.go:112 +0x1da
github.com/zricethezav/gitleaks/v8/config.(*Config).extendDefault(0xc001b17238)
        /pwd/gitleaks/config/config.go:252 +0x287
github.com/zricethezav/gitleaks/v8/config.(*ViperConfig).Translate(_)
        /pwd/gitleaks/config/config.go:212 +0xa59
github.com/zricethezav/gitleaks/v8/cmd.Config(_)
        /pwd/gitleaks/cmd/root.go:178 +0x105
github.com/zricethezav/gitleaks/v8/cmd.runGit(0x12dade0, {0xc00003a960, 0x0, 0xa87db6?})
        /pwd/gitleaks/cmd/git.go:45 +0xc5
github.com/spf13/cobra.(*Command).execute(0x12dade0, {0xc00003a950, 0x1, 0x1})
        /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x671
github.com/spf13/cobra.(*Command).ExecuteC(0x12da660)
        /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
github.com/zricethezav/gitleaks/v8/cmd.Execute()
        /pwd/gitleaks/cmd/root.go:164 +0x1e
main.main()
        /pwd/gitleaks/main.go:18 +0x9d

With Go 1.23.6 it works fine.

To Reproduce
Steps to reproduce the behavior:

Compile with Go 1.24.0 and run.

Expected behavior
A clear and concise description of what you expected to happen.

No panic

Screenshots
If applicable, add screenshots to help explain your problem.

Basic Info (please complete the following information):

  • OS:
  • Gitleaks Version: 8.23.3

Additional context
Add any other context about the problem here.

cc @zricethezav

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions