tailwarden / komiser

Open-source cloud-environment inspector. Supporting AWS, GCP, Azure, and more! Your cloud resources will have nowhere to hide!
https://komiser.io
Other
3.89k stars 426 forks source link

Panic when viewing web UI in 3.1.16 #1417

Open deaddotcodes opened 1 month ago

deaddotcodes commented 1 month ago

When viewing any page in the komiser web UI I receive a panic. This happens when using SQLite or Postgres, and with any cloud provider.

Errors:

2024/05/09 11:45:58 [Recovery] 2024/05/09 - 11:45:58 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/panic.go:261 (0xe6a79f7)
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/signal_unix.go:881 (0xe6a79c5)
/home/runner/work/komiser/komiser/handlers/accounts_handler.go:66 (0x112ac805)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0xfbe3599)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0xfbe3587)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0xfbe23ad)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0xfbe203c)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0xfbe1b71)
/opt/hostedtoolcache/go/1.22.2/x64/src/net/http/server.go:3137 (0xe9f9e6d)
/opt/hostedtoolcache/go/1.22.2/x64/src/net/http/server.go:2039 (0xe9f5147)
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/asm_amd64.s:1695 (0xe6c5c00)

2024/05/09 11:45:58 [Recovery] 2024/05/09 - 11:45:58 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/panic.go:261 (0xe6a79f7)
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/signal_unix.go:881 (0xe6a79c5)
/home/runner/work/komiser/komiser/handlers/accounts_handler.go:42 (0x112ac507)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0xfbe3599)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0xfbe3587)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0xfbe23ad)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0xfbe203c)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0xfbe1b71)
/opt/hostedtoolcache/go/1.22.2/x64/src/net/http/server.go:3137 (0xe9f9e6d)
/opt/hostedtoolcache/go/1.22.2/x64/src/net/http/server.go:2039 (0xe9f5147)
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/asm_amd64.s:1695 (0xe6c5c00)

2024/05/09 11:45:58 [Recovery] 2024/05/09 - 11:45:58 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/panic.go:261 (0xe6a79f7)
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/signal_unix.go:881 (0xe6a79c5)
/home/runner/work/komiser/komiser/handlers/dashboard_handler.go:36 (0x112b53dd)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0xfbe3599)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0xfbe3587)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0xfbe23ad)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0xfbe203c)
/home/runner/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0xfbe1b71)
/opt/hostedtoolcache/go/1.22.2/x64/src/net/http/server.go:3137 (0xe9f9e6d)
/opt/hostedtoolcache/go/1.22.2/x64/src/net/http/server.go:2039 (0xe9f5147)
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/asm_amd64.s:1695 (0xe6c5c00)

Following the trace I found this commit which changes how queries are performed across the board:

https://github.com/tailwarden/komiser/blame/6732ea4912c9be443ae65a56826db1ea2429a7b3/handlers/accounts_handler.go#L66

It seems the consolidation of query logic has gone awry.

Downgrading to 3.1.15 fixes this issue.

github-actions[bot] commented 1 month ago

Hey, thank you for opening your first Issue! 🙂 While a Tailwarden team member takes a look at your issue we would like to invite you to join our official Discord server, where you can interact directly with other contributors and Tailwarden team members. Link here: https://discord.tailwarden.com

AvineshTripathi commented 1 month ago

hey @deaddotcodes thanks for reporting the bug, this issue should be resolved in latest releases.