snyk / parlay

Enrich SBOMs with data from third party services
Apache License 2.0
121 stars 19 forks source link

No error message for invalid token for snyk enrich and package #51

Closed rubo-liu-cleio closed 9 months ago

rubo-liu-cleio commented 1 year ago

In Windows and WSL, if you set an invalid token or no token, parlay snyk enrich command will just output the content of the input SBOM file without any error message so you have no idea what is going on. The command 'parlay snyk package' will result in the following error without a valid token in Windows but it will produce an error message "Must provide a SNYK_TOKEN environment variable" in WSL.

panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x121ebaa]

goroutine 1 [running]: github.com/snyk/parlay/lib/snyk.GetPackageVulnerabilities({{0xc00002013c, 0x3}, {0x0, 0x0}, {0xc000020140, 0x7}, {0xc000020148, 0x5}, {0x17085c0, 0x0, ...}, ...}) /home/runner/work/parlay/parlay/lib/snyk/package.go:56 +0x1ca github.com/snyk/parlay/internal/commands/snyk.NewPackageCommand.func1(0xc000005500?, {0xc00017a4f0, 0x1?, 0x1?}) /home/runner/work/parlay/parlay/internal/commands/snyk/packages.go:24 +0x1b8 github.com/spf13/cobra.(Command).execute(0xc000005500, {0xc00017a4b0, 0x1, 0x1}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x847 github.com/spf13/cobra.(Command).ExecuteC(0xc000004300) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd github.com/spf13/cobra.(*Command).Execute(0xc000050000?) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x19 main.main() /home/runner/work/parlay/parlay/main.go:26 +0x1e

mcombuechen commented 9 months ago

Hello @rubo-liu thanks for reporting this. I know it's been a while but if you can confirm, can you still reproduce this when using the latest release? Thank you.

mcombuechen commented 9 months ago

Closing this due to inactivity. If the issue should still persist, please let us know.