panic: runtime error when running `docker scout cves fs://.` with gitlab output format
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 454
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
This may be similar to issue #113.
I have Docker Scout v1.18.1 installed on Windows and I'm trying to run docker scout cves against a local directory and generate gitlab-formatted output. All other output formats (sarif, spdx, sbom, packages, and markdown) work; only gitlab causes a panic.
This is the output I get when running the command:
docker scout cves fs://. --format gitlab
v File system read
v Indexed 201 packages
x Detected 14 vulnerable packages with a total of 31 vulnerabilities
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x40f2ec1]
goroutine 1 [running]:
github.com/docker/scout-cli-plugin/internal/format/sbom/gitlab.(*GitLab).toGitLab(0xc00190ace8, {0xc00086f508, 0x20, 0x45c9b40?}, 0xc002e0c700)
/Users/cdupuis/Development/docker/scout-cli-plugin/internal/format/sbom/gitlab/gitlab.go:207 +0x841
github.com/docker/scout-cli-plugin/internal/format/sbom/gitlab.(*GitLab).Print(0xc00190ace8, {0x6?, 0xc0034febd0?}, {0x5e4ef80, 0xc00010c078}, 0x0?, 0xc002e0c700)
/Users/cdupuis/Development/docker/scout-cli-plugin/internal/format/sbom/gitlab/gitlab.go:120 +0x45
github.com/docker/scout-cli-plugin/internal/commands/cves.NewCmd.func2(0x0?, {0x0?, 0x0?, 0x9cc97c9123667e10?})
/Users/cdupuis/Development/docker/scout-cli-plugin/internal/commands/cves/cves.go:303 +0xf79
github.com/docker/cli/cli-plugins/plugin.RunPlugin.func1.1.2(0xc0004aaf08, {0xc000e20f30, 0x1, 0x3})
/Users/cdupuis/Development/go/pkg/mod/github.com/docker/cli@v27.5.0+incompatible/cli-plugins/plugin/plugin.go:64 +0x64
github.com/spf13/cobra.(*Command).execute(0xc0004aaf08, {0xc000dee840, 0x3, 0x3})
/Users/cdupuis/Development/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000e33508)
/Users/cdupuis/Development/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x46f
github.com/spf13/cobra.(*Command).Execute(...)
/Users/cdupuis/Development/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/docker/cli/cli-plugins/plugin.RunPlugin(0xc00079a640, 0xc0004aa308, {{0x4ee8d9c, 0x5}, {0x4f17dde, 0xb}, {0xc000688eb0, 0x7}, {0x4f2652b, 0xc}, ...})
/Users/cdupuis/Development/go/pkg/mod/github.com/docker/cli@v27.5.0+incompatible/cli-plugins/plugin/plugin.go:79 +0x145
main.runPlugin(0xc00079a640)
/Users/cdupuis/Development/docker/scout-cli-plugin/cmd/docker-scout/main.go:30 +0x148
main.main()
/Users/cdupuis/Development/docker/scout-cli-plugin/cmd/docker-scout/main.go:57 +0x176
Let me know if there's anything I can do to help figure this issue out.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with internal/format/sbom/gitlab/gitlab.go at line 207, where the stack trace shows the nil pointer dereference, and follow the call from GitLab.Print at line 120. Reproduce with docker scout cves fs://. --format gitlab using the described vulnerable directory and compare with the working output formats. Done means the GitLab format completes without a panic and produces its output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100