Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karmor recommend fails with a panic error on MacOS M1 #459

Open
nycnewman opened this issue Sep 9, 2024 · 3 comments
Open

karmor recommend fails with a panic error on MacOS M1 #459

nycnewman opened this issue Sep 9, 2024 · 3 comments

Comments

@nycnewman
Copy link

karmor recommend
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/kubearmor/kubearmor-client/recommend/registry.(*Scanner).loadDockerAuthConfigs(0x140000d6ec0)
/home/runner/work/kubearmor-client/kubearmor-client/recommend/registry/registry.go:83 +0x35c
github.com/kubearmor/kubearmor-client/recommend/registry.New({0x140002d3440, 0x27})
/home/runner/work/kubearmor-client/kubearmor-client/recommend/registry/registry.go:106 +0x178
github.com/kubearmor/kubearmor-client/recommend.Recommend(0x140005e0b40, {{0x10910fa60, 0x0, 0x0}, {0x10910fa60, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...)
/home/runner/work/kubearmor-client/kubearmor-client/recommend/recommend.go:186 +0x238
github.com/kubearmor/kubearmor-client/cmd.glob..func9(0x140003ecb00?, {0x106921140?, 0x4?, 0x106921144?})
/home/runner/work/kubearmor-client/kubearmor-client/cmd/recommend.go:22 +0x70
github.com/spf13/cobra.(*Command).execute(0x10909e4e0, {0x10910fa60, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x10909e7c0)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/kubearmor/kubearmor-client/cmd.Execute()
/home/runner/work/kubearmor-client/kubearmor-client/cmd/root.go:49 +0x24
main.main()
/home/runner/work/kubearmor-client/kubearmor-client/main.go:10 +0x1c

OS: MacOS on M1
Version: 1.2.3

@nycnewman
Copy link
Author

Looks like the issue is the way the client parses the Docker auth file on MacOS. It expects real values in config.json whereas on MacOS the actual passwords are stored in the KeyChain and not in the file. Since it doesn;t check for an empty response, the code fails when it tries to extract username and password.

@nycnewman nycnewman changed the title karmor recommend fails with a panic error on MacoS M1 karmor recommend fails with a panic error on MacOS M1 Sep 9, 2024
@anurag-rajawat
Copy link
Contributor

Hey, @daemon1024 assign this to me. I have a mac machine with an M1 chip.

@nycnewman
Copy link
Author

@anurag-rajawat I tactically solved this in a local built copy by adding a check for Auth being an empty string. I started to look at how credentialHelpers work and it should be possible to extend logic to correctly pull credentials from the helpers for each configured source. I am not a GoLang programmer otherwise would put in a PR.

@anurag-rajawat anurag-rajawat removed their assignment Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants