kubescape / kubevuln

Kubevuln is an in-cluster component of the Kubescape security platform. It scans container images for vulnerabilities, using Grype as its engine.
Apache License 2.0
19 stars 19 forks source link

Support backend access key #154

Closed rcohencyberarmor closed 1 year ago

rcohencyberarmor commented 1 year ago

PR Type:

Enhancement


PR Description:

This PR introduces the support for access tokens in the backend adapter. The access token is passed as a parameter to the NewBackendAdapter function and is used for authorization in HTTP requests. The token is also loaded from a secret file. The PR includes changes in the function signatures, tests, and the addition of a new function to set headers for post requests. It also includes updates to dependencies in the go.mod file.


PR Main Files Walkthrough:

files: `adapters/v1/backend.go`: The `NewBackendAdapter` function now accepts an additional parameter for the access token. The `getCVEExceptionsFunc` and `sendStatusFunc` functions have been updated to use the access token. The `accessToken` field has been added to the `BackendAdapter` struct. `adapters/v1/backend_test.go`: The tests have been updated to reflect the changes in function signatures in the backend.go file. `cmd/http/main.go`: The access token is now loaded from a secret file and passed to the `NewBackendAdapter` function. `adapters/v1/backend_utils.go`: A new function `setPostResultHeaders` has been added to set headers for post requests, including the Authorization header using the access token. `config/config.go`: Added functions to load and decode the access token from a secret file. `go.mod`: The versions of several dependencies have been updated.

User Description:

Overview

codiumai-pr-agent-free[bot] commented 1 year ago

PR Analysis

How to use

To invoke the PR-Agent, add a comment using one of the following commands: /review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option. /describe: Modify the PR title and description based on the contents of the PR. /improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback. /ask \<QUESTION>: Pose a question about the PR. /update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value For example: /review --pr_reviewer.extra_instructions="focus on the file: ..." To list the possible configuration parameters, use the /config command.

github-actions[bot] commented 1 year ago

Summary:

github-actions[bot] commented 1 year ago

Summary: