wolfictl advisory update with type `fixed` fails with `index out of range` error
bugneeds-triage
If either using wizard or command line arguments when updating an advisory with type `fixed` there is an `index out of range` error (see below). I am using wolfictl from `main` @ commit `c68eee6edd24aa4b8e12ecb5f32bd54f2f8486c1`.
The issue is resolved by passing `--fixed-version` but when using the wizard especially - this shouldn't be required.
```
✗ wolfictl advisory update --package "kubernetes-1.31" --vuln "GHSA-v778-237x-gjrc" --type fixed
Auto-detected distro: Wolfi
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/wolfi-dev/wolfictl/pkg/cli.cmdAdvisoryUpdate.func1.3.newAllowedFixedVersionsFunc.1(...)
/home/philroche/Working/wolfictl/pkg/cli/advisory.go:160
github.com/wolfi-dev/wolfictl/pkg/cli.cmdAdvisoryUpdate.func1.3({0xc0008c6f60, 0xf})
/home/philroche/Working/wolfictl/pkg/cli/advisory_update.go:173 +0x867
github.com/wolfi-dev/wolfictl/pkg/cli/components/advisory/prompt.Model.newFixedVersionFieldConfig({0x0, {0x0, 0x0, 0x0}, 0xc01ba95f20, 0xc01ba95f40, 0xc01bc937a0, {{0xc000be03c0, 0x1, 0x1}, ...}, ...}, ...)
/home/philroche/Working/wolfictl/pkg/cli/components/advisory/prompt/model.go:204 +0x62
github.com/wolfi-dev/wolfictl/pkg/cli/components/advisory/prompt.Model.addMissingFields({0x0, {0x0, 0x0, 0x0}, 0xc01ba95f20, 0xc01ba95f40, 0xc01bc937a0, {{0xc000be03c0, 0x1, 0x1}, ...}, ...})
/home/philroche/Working/wolfictl/pkg/cli/components/advisory/prompt/model.go:304 +0x178
github.com/wolfi-dev/wolfictl/pkg/cli/components/advisory/prompt.New({{{0xc000be03c0, 0x1, 0x1}, {0xc000be03d0, 0x1, 0x1}, {0x471376a, 0x3}, {0x7ffd418a48a2, 0x5}, ...}, ...})
/home/philroche/Working/wolfictl/pkg/cli/components/advisory/prompt/model.go:253 +0xf8
github.com/wolfi-dev/wolfictl/pkg/cli.cmdAdvisoryUpdate.func1(0xc000bce008, {0xc000b7a4e0?, 0x4?, 0x4714edf?})
/home/philroche/Working/wolfictl/pkg/cli/advisory_update.go:176 +0x1138
github.com/spf13/cobra.(*Command).execute(0xc000bce008, {0xc000b7a480, 0x6, 0x6})
/home/philroche/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0xa94
github.com/spf13/cobra.(*Command).ExecuteC(0xc000b40608)
/home/philroche/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(...)
/home/philroche/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(0x50ee660?, {0x50ee820?, 0xc000bba400?})
/home/philroche/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1064 +0x47
main.mainE({0x50ee660, 0x7143d80})
/home/philroche/Working/wolfictl/main.go:24 +0xb8
main.main()
/home/philroche/Working/wolfictl/main.go:15 +0x25
```
1 条评论