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 panic when error is returned from SubmitReport #1640

Merged
merged 1 commit into from
Mar 17, 2024
Merged

Conversation

amirmalka
Copy link
Contributor

Overview

When an error is returned from SubmitReport, Kubescape calls getReportUrl() (for logging purposes) which causes a panic since it is empty.

{"level":"debug","ts":"2024-03-17T04:35:44Z","msg":"sending report","url":"https://report.armo.cloud/k8s/v2/postureReport?clusterName=kind-systets-1f6ac241-7723-4fff-8b5d-2dacdca93e26&contextName=kind-systets-1f6ac241-7723-4fff-8b5d-2dacdca93e26&customerGUID=69bcb204-5b2d-446a-896f-ff68a2312be9&reportGUID=8a8323e8-18aa-416a-bfd3-3a0fa96506b4","account":"69bcb204-5b2d-446a-896f-ff68a2312be9","accessKey length":0,"reportNumber":0}
{"level":"debug","ts":"2024-03-17T04:36:45Z","msg":"updating cached config","configObj":{"clusterName":"kind-systets-1f6ac241-7723-4fff-8b5d-2dacdca93e26","cloudReportURL":"https://report.armo.cloud/","cloudAPIURL":"https://api.armosec.io/"}}
panic: uuid: Parse(): invalid UUID length: 0

goroutine 1 [running]:
github.com/google/uuid.MustParse({0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/google/uuid@v1.6.0/uuid.go:169 +0x99
github.com/kubescape/backend/pkg/client/v1.GetPostureReportUrl({0xc001a23080?, 0x42824d1?}, {0x0, 0x0}, {0xc001a8c700, 0x31}, {0xc00189e150, 0x24})
	/home/runner/go/pkg/mod/github.com/kubescape/backend@v0.0.19/pkg/client/v1/reporter.go:69 +0x175
github.com/kubescape/kubescape/v3/core/pkg/resultshandling/reporter/v2.(*ReportEventReceiver).getReportUrl(0xc000e22540)
	/home/runner/work/kubescape/kubescape/core/pkg/resultshandling/reporter/v2/reporteventreceiver.go:[121](https://github.com/armosec/sanity-tests/actions/runs/8312978807/job/22748455180#step:7:122) +0xb1
github.com/kubescape/kubescape/v3/core/pkg/resultshandling/reporter/v2.(*ReportEventReceiver).sendReport(0xc000e22540, 0xc001eb5200, 0x0, 0x1)
	/home/runner/work/kubescape/kubescape/core/pkg/resultshandling/reporter/v2/reporteventreceiver.go:252 +0x336
github.com/kubescape/kubescape/v3/core/pkg/resultshandling/reporter/v2.(*ReportEventReceiver).sendResources(0xc002e8d870?, 0xc000e49300)

Signed-off-by: Amir Malka <amirm@armosec.io>
@amirmalka amirmalka merged commit 56a9d9a into master Mar 17, 2024
8 of 10 checks passed
@matthyx matthyx deleted the fix-panic branch May 23, 2024 08:19
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

3 participants