jetstack / paranoia

Inspect certificate authorities in container images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐞 PANIC when specified image can't be found

AlexWootton opened this issue Β· comments

Observed behaviour

When the given container image can't be found the program panics. See the example output below when trying to scan quay.io/cert-manager-controller:v1.8.0:

$ paranoia inspect quay.io/cert-manager-controller:v1.8.0
panic: GET https://quay.io/v2/cert-manager-controller/manifests/v1.8.0: unexpected status code 404 Not Found: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>


goroutine 1 [running]:
github.com/jetstack/paranoia/cmd.glob..func2(0x1719840?, {0xc000119590, 0x1, 0x1?})
        /Users/alexwootton/repos/jetstack/paranoia/cmd/inspect.go:45 +0x611
github.com/spf13/cobra.(*Command).execute(0x1719840, {0xc000119550, 0x1, 0x1})
        /Users/alexwootton/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1719340)
        /Users/alexwootton/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/alexwootton/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
github.com/jetstack/paranoia/cmd.Execute()
        /Users/alexwootton/repos/jetstack/paranoia/cmd/root.go:22 +0x25
main.main()
        /Users/alexwootton/repos/jetstack/paranoia/main.go:8 +0x17
exit status 2

Or this example where the given tag didn't exist:

$ paranoia inspect rancher/jetstack-cert-manager-controller:latest
panic: GET https://index.docker.io/v2/rancher/jetstack-cert-manager-controller/manifests/latest: MANIFEST_UNKNOWN: manifest unknown; unknown tag=latest

goroutine 1 [running]:
github.com/jetstack/paranoia/cmd.glob..func2(0x1719840?, {0xc00006d5c0, 0x1, 0x1?})
        /Users/alexwootton/repos/jetstack/paranoia/cmd/inspect.go:45 +0x611
github.com/spf13/cobra.(*Command).execute(0x1719840, {0xc00006d580, 0x1, 0x1})
        /Users/alexwootton/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1719340)
        /Users/alexwootton/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/alexwootton/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
github.com/jetstack/paranoia/cmd.Execute()
        /Users/alexwootton/repos/jetstack/paranoia/cmd/root.go:22 +0x25
main.main()
        /Users/alexwootton/repos/jetstack/paranoia/main.go:8 +0x17
exit status 2

Expected Behaviour

Human readable error message printed to STDOUT containing relevant details about the error