Matthias Bertschy
68f5ae7ed2
Merge pull request #1516 from mohaidoss/tests/core-pkg-fixhandler
...
Bug Fix and Test Addition for sanitizeYaml and revertSanitizeYaml Functions
2023-11-25 22:31:39 +01:00
Mehdi Moussaif
803b8dc5a4
Adding tests core/pkg/fixhandler
...
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
Adding tests core/pkg/fixhandler
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
2023-11-25 22:21:45 +01:00
Matthias Bertschy
a3b4d60dfb
Merge pull request #1517 from VaibhavMalik4187/printer-tests
...
Enhancement of the printer package with additional tests and refactoring
2023-11-25 21:18:36 +01:00
VaibhavMalik4187
0af0f2a229
Added tests for the printer package
...
Wrote new tests for the printer package and refactored the CalculateMove
function to prevent potential out of bounds crash
Refactored the `addFix` function for better readability, understanding
and chaining method calls.
Used formatted string for logging.
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com >
2023-11-26 00:28:50 +05:30
VaibhavMalik4187
6f1919bbe2
Added Test Suite for several packages
...
This PR focuses on adding unit tests for multiple packages in the
project. The main changes include:
- Addition of new tests for the 'printer' package in the
'core/pkg/resultshandling/printer' directory.
- New tests for the 'results' package in the
'core/pkg/resultshandling' directory.
- Addition of tests for the 'config' package in the
'httphandler/config' directory.
- New tests for the 'testutils' package in the 'internal/testutils'
directory.
- Addition of tests for the 'imagescan' package in the
'pkg/imagescan' directory.
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com >
2023-11-25 22:34:48 +05:30
Mehdi Moussaif
11401c755a
Minor bug in sanitizeYaml and revertSanitizeYaml functions
...
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
2023-11-25 15:57:33 +01:00
Matthias Bertschy
029b4c2677
Merge pull request #1504 from cbrom/core_pkg_containerscan_tests
...
Enhancement of Test Coverage and Code Improvements in Container Scan Package
2023-11-24 21:28:32 +01:00
sulemaanhamza
660a9801a4
TimedCache - Potential bug fixes, removing possible memory leaks and test suite
...
1. Use time.Time for expiration to simplify expiration checks.
2. Added a stopChan and a Stop method to properly stop the invalidateTask goroutine instead of directly changing values
3. Used Ticker in invalidateTask for periodic expiration checks
4. Leak Prevention: The invalidateTask() loop checks the TTL value before continuing. If the TTL is zero, the goroutine exits gracefully, preventing a memory leak.
Signed-off-by: sulemaanhamza <sulemanhamza97@gmail.com >
2023-11-24 22:39:00 +05:00
cbrom
f3670ca629
coverage test for ScanResultReport AsFNVHash function
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
3ce838e344
added tests for ElasticContainerScanSummaryResult Validate function
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
e8228c149a
added ElasticContainerScanSummaryResult Validate function doc string
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
ef3bda9972
removed ToFlatVulnerabilities function as there is no reference anywhere
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
db1c4afcd6
assert instead of if else check on tests
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
5ea09516ef
tests added for ScanResultReport.Validate function
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
a0911d8752
added doc string for exported functions in datastructuresmethods.go
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
47d81ce721
added a basic test for GetPackagesNames
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
6fe6dbb333
added doc comment for exported function GetPackageNames
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
53f45e599a
GetFilesByPackage function removed along with tests as it is not used anywhere except in tests
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
cbrom
6b4ef219c9
added more testcases for CalculateFixed function
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-24 15:07:11 +03:00
Mehdi Moussaif
362375a733
Adding Test Suite for core/pkg/policyhandler
...
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
2023-11-24 00:35:23 +01:00
cbrom
92d39c5abc
added a generated docstring for CalculateFixed function
...
Signed-off-by: cbrom <kb.cbrom@gmail.com >
2023-11-23 22:33:10 +03:00
Matthias Bertschy
c4f0e6e46b
Merge pull request #1500 from sulemaanhamza/bugfix-core-pkg-fixhandler-yamlhelper-edgecases
...
Edge-case Handling and Test Enhancements in yamlhelper
2023-11-23 17:12:44 +01:00
sulemaanhamza
1f43de06f8
Implemented Ai suggested changes
...
Signed-off-by: sulemaanhamza <sulemanhamza97@gmail.com >
2023-11-23 18:40:42 +05:00
sulemaanhamza
04b06d875b
Added edge-case test cases for yamlhelper, fixed bugs cause test-cases to fail
...
Signed-off-by: sulemaanhamza <sulemanhamza97@gmail.com >
2023-11-23 17:21:09 +05:00
VaibhavMalik4187
55162829e7
Added Test Suite for core/pkg package
...
Added unit tests for the following files:
- containerscan/datastructures.go
- hostsensorutils/hostsensordeploy.go
- hostsensorutils/hostsensorworkerpool.go
- hostsensorutils/utils.go
- policyhandler/handlepullpolicies.go
- policyhandler/handlepullpoliciesutils.go
- resourcehandler/filesloader.go
- resourcehandler/remotegitutils.go
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com >
2023-11-23 14:19:13 +05:30
suleman
f814d1df19
Added Test Suite for core/pkg/fixhandler/yamlhelper
...
Signed-off-by: sulemaanhamza <sulemanhamza97@gmail.com >
2023-11-23 12:33:51 +05:00
Matthias Bertschy
1342a06f43
Merge pull request #1477 from mohaidoss/master
...
Adding Test Suite for core/pkg/score
2023-11-22 16:36:51 +01:00
Mehdi Moussaif
c7f9a6ebc4
Adding Test Suite for core/pkg/resultshandling/gotree
...
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
Additional tests for core/pkg/gotree
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
tests for printItem in core/pkg/gotree
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
Refactor printer initialization in gotree_test.go
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
2023-11-21 20:32:11 +01:00
Mehdi
a2f632beb4
Test suite for core/pkg/score
...
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
Use cautils for mock data
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
Removed test TestNewScoreWrapperWithNilOPASessionObj
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com >
2023-11-21 16:35:09 +01:00
David Wertenteil
450df679cd
bump logger version
...
Signed-off-by: David Wertenteil <dwertent@armosec.io >
2023-10-31 18:22:03 +02:00
Craig Box
c9ccef90f3
Pretty up the pretty-printer. ( #1451 )
...
* Pretty up the pretty-printer.
Signed-off-by: Craig Box <craigb@armosec.io >
* add some text fixes for the Operator also
Signed-off-by: Craig Box <craigb@armosec.io >
* fix another verb
Signed-off-by: Craig Box <craigb@armosec.io >
* fixed unit tests
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* fixed test
Signed-off-by: David Wertenteil <dwertent@armosec.io >
---------
Signed-off-by: Craig Box <craigb@armosec.io >
Signed-off-by: David Wertenteil <dwertent@armosec.io >
Co-authored-by: David Wertenteil <dwertent@armosec.io >
2023-10-31 18:07:43 +02:00
YiscahLevySilas1
1d25415c21
avoid adding duplicate related resource IDs
...
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
2023-10-26 12:52:05 +03:00
David Wertenteil
3e2314a269
Bump v3 ( #1449 )
...
* bump version
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* change default view
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* fixed tests
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* fixed go mod
Signed-off-by: David Wertenteil <dwertent@armosec.io >
---------
Signed-off-by: David Wertenteil <dwertent@armosec.io >
2023-10-22 17:43:51 +03:00
David Wertenteil
c143d10130
Cloud provider detection ( #1448 )
...
* set cloud provider using nodes
* use scan metadata for scanning scope
* code cleanup
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* handle error
Signed-off-by: David Wertenteil <dwertent@armosec.io >
---------
Signed-off-by: David Wertenteil <dwertent@armosec.io >
2023-10-22 15:47:57 +03:00
David Wertenteil
d5407466d5
Preparing Kubescape for v3 ( #1403 )
...
* wip: minor cli fixes
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* wip: change default view
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* wip: reduce default topWorkloadsNumber to 3
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* update gif
Signed-off-by: David Wertenteil <dwertent@armosec.io >
* default view for controls and frameworks
---------
Signed-off-by: David Wertenteil <dwertent@armosec.io >
2023-10-22 15:39:58 +03:00
rcohencyberarmor
052c042dac
Support backend access key ( #1404 )
...
Support backend access key
Signed-off-by: Amir Malka <amirm@armosec.io >
2023-10-22 15:10:08 +03:00
Daniel Grunberger
72b64127c7
Restructure img cmd ( #1398 )
...
* feat: add kubescape patch command
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com >
* update patch command output format
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com >
* fix patch command logic
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com >
* update docs & minor changes
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com >
* restructure cmd
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
* fix tests
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
* readme
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
* fix version code
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
* go mod
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
---------
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com >
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
Co-authored-by: Anubhav Gupta <mail.anubhav06@gmail.com >
Co-authored-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-10-22 14:51:39 +03:00
rcohencyberarmor
e2044338c8
print result to stdout when format argument specified ( #1438 )
...
* print result to stdout when format argument specified
Signed-off-by: rcohencyberarmor <rcohen@armosec.io >
* print pretty format to stdout if format is not specified
Signed-off-by: rcohencyberarmor <rcohen@armosec.io >
* remove not relevant log
Signed-off-by: rcohencyberarmor <rcohen@armosec.io >
---------
Signed-off-by: rcohencyberarmor <rcohen@armosec.io >
Co-authored-by: rcohencyberarmor <rcohen@armosec.io >
2023-10-19 13:07:58 +03:00
Daniel Grunberger
bc327a0d86
set log to error
...
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-10-18 12:23:46 +03:00
Daniel Grunberger
77888c12a0
rm if statement
...
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-10-18 12:22:59 +03:00
Daniel Grunberger
df56af843e
replace driver name
...
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-10-18 12:18:53 +03:00
Matthias Bertschy
3efa40e808
use go-gitlog as an alternative to git2go ( #1393 )
...
* use go-gitlog as an alternative to git2go
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com >
* set RELEASE to something to avoid failing binary-build step
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com >
---------
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com >
2023-10-15 15:16:05 +03:00
YiscahLevySilas1
31a0bd9266
use ControlConfigInputs, deprecate ConfigInputs ( #1419 )
...
* use ControlConfigInputs, deprecate ConfigInputs
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* update opa-utils version
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
---------
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
2023-10-15 11:58:10 +03:00
YiscahLevySilas1
269945c08c
split failedPath to deletePaths and reviewPaths ( #1402 )
...
* support delete paths and review paths
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* update armoapi + opa-utils
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* fix test
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* go mod tidy
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* support failedPaths until all controls replace with review/delete paths
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* fix test
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
* fix test
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
---------
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io >
2023-10-02 17:03:02 +03:00
Amir Malka
8257e31232
Save scan results in storage and support scanning a deleted resource ( #1376 )
...
* store scan results in storage
Signed-off-by: Amir Malka <amirm@armosec.io >
* store scan results in storage
Signed-off-by: Amir Malka <amirm@armosec.io >
* save resources in their namespaces, load namespace from env var, extend the config obj
Signed-off-by: Amir Malka <amirm@armosec.io >
* setting context name
Signed-off-by: Amir Malka <amirm@armosec.io >
* updated k8s-interface
Signed-off-by: Amir Malka <amirm@armosec.io >
* scanning a deleted resource
Signed-off-by: Amir Malka <amirm@armosec.io >
* cr changes
Signed-off-by: Amir Malka <amirm@armosec.io >
* cr changes
Signed-off-by: Amir Malka <amirm@armosec.io >
* fix
Signed-off-by: Amir Malka <amirm@armosec.io >
* remove unused constants
Signed-off-by: Amir Malka <amirm@armosec.io >
* use t.Setenv
Signed-off-by: Amir Malka <amirm@armosec.io >
* added tests for rbac triplet slugs
Signed-off-by: Amir Malka <amirm@armosec.io >
* updated namespace logic
Signed-off-by: Amir Malka <amirm@armosec.io >
* fix test
Signed-off-by: Amir Malka <amirm@armosec.io >
---------
Signed-off-by: Amir Malka <amirm@armosec.io >
2023-09-14 10:03:36 +03:00
Daniel Grunberger
96337edc67
add new line ( #1389 )
...
* add new line
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
* rename ks-cloud-operator
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
---------
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
Co-authored-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-09-13 14:26:11 +03:00
DRAGON2002
a3f80d91bf
fix: format headers ( #1383 )
...
Signed-off-by: DRAGON <anantvijay3@gmail.com >
2023-09-13 13:27:56 +03:00
DRAGON
c74c5f1970
feat: darken table borders
...
Signed-off-by: DRAGON <anantvijay3@gmail.com >
2023-09-10 21:48:15 +05:30
Daniel Grunberger
b39ce4caae
print up until 4 imgs
...
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-09-05 11:47:44 +03:00
Daniel Grunberger
58553688e9
validate sarif format
...
Signed-off-by: Daniel Grunberger <danielgrunberger@armosec.io >
2023-09-03 16:51:52 +03:00