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

Fix scanning unsupported clouds #1688

Merged
merged 1 commit into from
May 26, 2024
Merged

Fix scanning unsupported clouds #1688

merged 1 commit into from
May 26, 2024

Conversation

dwertent
Copy link
Contributor

Overview

This PR fixes the panic we get when scanning unsupported clouds.

I scanned a cluster running on DigitalOcean and I got the following panic:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1d6a7c2]

goroutine 10 [running]:
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End.func1()
	/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/span.go:405 +0x25
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End(0xc000ff8300, {0x0, 0x0, 0xbad95c8cf62385b4?})
	/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/span.go:443 +0xa3b
panic({0x3c48160?, 0x75a9ca0?})
	/usr/local/go/src/runtime/panic.go:914 +0x21f
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End.func1()
	/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/span.go:405 +0x25
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End(0xc001a6e300, {0x0, 0x0, 0x47d0ea?})
	/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.24.0/trace/span.go:443 +0xa3b
panic({0x3c48160?, 0x75a9ca0?})
	/usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/kubescape/k8s-interface/cloudsupport/v1.(*CloudProviderDescribe).GetApiVersion(...)
	/go/pkg/mod/github.com/kubescape/k8s-interface@v0.0.166/cloudsupport/v1/methods.go:84
github.com/kubescape/k8s-interface/cloudsupport/v1.(*CloudProviderDescribe).GetID(0x0)
	/go/pkg/mod/github.com/kubescape/k8s-interface@v0.0.166/cloudsupport/v1/methods.go:127 +0x22
github.com/kubescape/kubescape/v3/core/pkg/resourcehandler.(*K8sResourceHandler).collectCloudResources(0xc001b36fc0, {0x5059de0, 0xc0010109f0}, 0xc000f6d600, 0x7?, 0xc000f75600?, {0xc00262d980, 0x3, 0x3bc1740?}, {0x5050b70, ...})
	/work/core/pkg/resourcehandler/k8sresources.go:243 +0x822
github.com/kubescape/kubescape/v3/core/pkg/resourcehandler.(*K8sResourceHandler).GetResources(0xc001b36fc0, {0x5059de0, 0xc0010109f0}, 0xc000f6d600, {0x5050b70, 0xc0014e9650}, 0xc000ffad80)
	/work/core/pkg/resourcehandler/k8sresources.go:148 +0xbd5
github.com/kubescape/kubescape/v3/core/pkg/resourcehandler.CollectResources({0x5059de0, 0xc0010109c0}, {0x5050ae0, 0xc001b36fc0}, {0x0?, 0xc00158cd01?, 0xc001020438?}, 0xc000f6d600, {0x5050b70, 0xc0014e9650}, ...)
	/work/core/pkg/resourcehandler/handlerpullresources.go:29 +0x1b5
github.com/kubescape/kubescape/v3/core/core.(*Kubescape).Scan(0xc000f80840?, {0x5059de0?, 0xc000fad110}, 0xc000ffad80)
	/work/core/core/scan.go:172 +0x865
github.com/kubescape/kubescape/v3/httphandler/handlerequests/v1.scan({0x5059de0, 0xc000face70}, 0xc000ffad80, {0xc000198a20, 0x24})
	/work/httphandler/handlerequests/v1/requestshandlerutils.go:77 +0xf85
github.com/kubescape/kubescape/v3/httphandler/handlerequests/v1.(*HTTPHandler).executeScan(0xc0001acb88, 0xc000fac5d0)
	/work/httphandler/handlerequests/v1/requestshandlerutils.go:32 +0x16a
github.com/kubescape/kubescape/v3/httphandler/handlerequests/v1.(*HTTPHandler).watchForScan(0xc0001acb88)
	/work/httphandler/handlerequests/v1/requestshandlerutils.go:57 +0x53
created by github.com/kubescape/kubescape/v3/httphandler/handlerequests/v1.NewHTTPHandler in goroutine 1
	/work/httphandler/handlerequests/v1/requestshandler.go:44 +0x12f

Signed-off-by: David Wertenteil <dwertent@armosec.io>
@dwertent dwertent merged commit 15e55e0 into master May 26, 2024
10 checks passed
@dwertent dwertent deleted the fix-panic branch May 26, 2024 13:28
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

Successfully merging this pull request may close these issues.

None yet

2 participants