The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* add linter supports
* add only minor version
* use latest version
* Fix println with format issue
* Fix test
* Fix tests
* For slice with unknown length, preallocating the array
* fix code-coverage
* Removed linter rules
* Reverting linter fixes, adding TODO for later
* Ignore linter error for import
* Remove another err var.
* Ignore shadow error
* Fixes
* Fix issue
* Add back goimports local-prefixes
* Update local prefixes
* Removed extra spaces and merge the imports
* more refactoring
* Update photon.go
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
* refactor(docker_conf): rename and remove unnecessary options
* feat(rpc): define new API
* fix(cli): change default timeout
* fix(import): fix package names
* refactor(vulnerability): remove old mock
* refactor(utils): remove un-needed functions
* feat(cache): implement cache communicating with a server
* refactor(scan): separate scan function as local scanner
* test(scanner): add tests for ScanImage
* refactor(scan): remove unused options
* test(vulnerability): generate mock
* refactor(server): split a file
* feat(server): implement new RPC server
* feat(client): implement new RPC client
* fix(cache): use new cache interface
* fix(standalone): use new scanner
* fix(client): use new scanner
* fix(server): pass cache
* test(integration): make sure an error is not nil before calling the method
* fix(mod): update dependencies
* test(integration): ensure the image load finishes
* feat(docker): support DOCKER_HOST and DOCKER_CERT_PATH
* chore(mod): update dependencies
* refactor(rpc): remove old client
* feat(server): support old API for backward compatibility
* fix(server): check a schema version of JSON cache
* fix(rpc): add a version to packages
* feat(rpc): add PutImage
* test: rename expectations
* refactor(cache): rename LayerCache to ImageCache
* refactor: rename ImageInfo to ImageReference
* fix(applier): pass image_id to ApplyLayer
* feat(cache): handle image cache
* chore(mod): update dependencies
* refactor(server): pass only config
* feat(cli): add -removed-pkgs option
* refactor(err): wrap errors
* fix(github): return db size
* fix(github_mock): add size
* feat(indicator): add progress bar
* refactor(config): remove global Quiet
* fix(db): take progress bar as an argument
* fix(progress): inject progress bar
* Support Amazon Linux
* amazon: Add tests for Scanner Detect functionality
* amazon: Add more test cases for unhappy paths.
This commit also asserts the logged output via observer.
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Add a test case for invalid fixed pkg version
Signed-off-by: Simarpreet Singh <simar@linux.com>
* mod: go mod tidy
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Inject dependency seams for exposed db interface and logger.
This commit also exposes an interface for doing db operations.
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Use injected logger for scanner.
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon_test: Add a sample testdata dir
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Add tests for for Get() for amazon vulns.
Signed-off-by: Simarpreet Singh <simar@linux.com>
* vulnsrc_test: Fix invocation call to SetVersion()
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon_test: Add a test for severirtyFromPriority
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon_test: Add tests for constructVersion()
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Refactor walkFunc outside for testability purposes
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Refactor walkFn and add tests for it.
Signed-off-by: Simarpreet Singh <simar@linux.com>
* amazon: Refactor commitFunc closure and add tests
This commit also introduces an interface for the
vulnerability package to be used as a seam.
Signed-off-by: Simarpreet Singh <simar@linux.com>
* Revert "amazon: Use injected logger for scanner."
This reverts commit 5a81e4d824a95f4de4aae2e2b903eedd0f7e241f.
* test(amazon): fix failed tests
* fix(vulnerability): trim references
* test(amazon): add integration test
In several files, the error passed from filepath.Walk to WalkFunc is
not checked. As the info argument to WalkFn is nil in case of an error,
accessing info can cause a runtime panic.
This commit adds checks for errors passed through to WalkFunc.
* Added cache-dir flag
The flag cache-dir allows users to specify the cache directory the
database is stored in.
Signed-off-by: Ken Herner <kherner@navistone.com>
* Moved dbDir definition into functions
Need to move dbDir definition into the calling functions as the cache
directory may have been specified. With dbDir defined at package level,
it would always be instantiated to the default value and would never be
updated to the user specifyed value.
Signed-off-by: Ken Herner <kherner@navistone.com>