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: allow resource scope to be optional #807

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Jun 6, 2022

Summary

The Lacework API indicates that the resource scope is optional but the code in the api go package
doesn't seem to support it.

This change will allow the api go package and the Lacework CLI to create Vulnerability Exceptions
with and without a Resource Scope.

How did you test this change?

Added tests and created two vulnerability exceptions, with and without Resource Scope.

Screen Shot 2022-06-06 at 11 06 33 PM

Screen Shot 2022-06-06 at 11 06 20 PM

Issue

https://lacework.atlassian.net/browse/ALLY-1017

@afiune
Copy link
Contributor Author

afiune commented Jun 6, 2022

The result of not having the resource scope is:

=== FAIL: api TestNewVulnerabilityExceptionNoResourceScope (0.00s)
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=0x20 pc=0x133776b]

goroutine 2545 [running]:
testing.tRunner.func1.2({0x1461a80, 0x18381a0})
	/usr/local/Cellar/go/1.18/libexec/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
	/usr/local/Cellar/go/1.18/libexec/src/testing/testing.go:1392 +0x39f
panic({0x1461a80, 0x18381a0})
	/usr/local/Cellar/go/1.18/libexec/src/runtime/panic.go:838 +0x207
github.com/lacework/go-sdk/api.(*VulnerabilityException).setResourceScope(0xc0002ab6c0, {0x0, 0x0})
	/Users/afiune/github/go-sdk/api/vulnerability_exceptions.go:237 +0x4b
github.com/lacework/go-sdk/api.NewVulnerabilityException({_, _}, {{0x14e1628, 0x18}, 0x0, 0x2, {0xc00028cb50, 0x1, 0x1}, {0x0, ...}, ...})
	/Users/afiune/github/go-sdk/api/vulnerability_exceptions.go:215 +0x3b3
github.com/lacework/go-sdk/api_test.TestNewVulnerabilityExceptionNoResourceScope(0xc00021b860?)
	/Users/afiune/github/go-sdk/api/vulnerability_exceptions_test.go:80 +0x1c5
testing.tRunner(0xc00021b860, 0x1532d00)
	/usr/local/Cellar/go/1.18/libexec/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
	/usr/local/Cellar/go/1.18/libexec/src/testing/testing.go:1486 +0x35f

DONE 995 tests, 1 skipped, 1 failure in 6.219s
make: *** [test] Error 1

@afiune afiune changed the title test(api): verify vuln exception accepts no resource scope fix: allow resource scope to be optional Jun 6, 2022
@dmurray-lacework dmurray-lacework merged commit 6e8e55c into main Jun 7, 2022
@dmurray-lacework dmurray-lacework deleted the afiune/ALLY-1017/host-exception branch June 7, 2022 09:07
@lacework-releng lacework-releng mentioned this pull request Jun 7, 2022
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.

2 participants