diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f9602b81..c39f20ef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -45,7 +45,7 @@ jobs: ArmoERServer: report.armo.cloud ArmoWebsite: portal.armo.cloud CGO_ENABLED: 0 - run: python build.py + run: python3 --version && python3 build.py - name: Upload Release binaries id: upload-release-asset diff --git a/.github/workflows/build_dev.yaml b/.github/workflows/build_dev.yaml index bc5f11ff..5ae89641 100644 --- a/.github/workflows/build_dev.yaml +++ b/.github/workflows/build_dev.yaml @@ -31,7 +31,7 @@ jobs: ArmoERServer: report.euprod1.cyberarmorsoft.com ArmoWebsite: portal.armo.cloud CGO_ENABLED: 0 - run: mkdir -p build/${{ matrix.os }} && go mod tidy && go build -ldflags "-w -s -X github.com/armosec/kubescape/cmd.BuildNumber=$RELEASE -X github.com/armosec/kubescape/cautils/getter.ArmoBEURL=$ArmoBEServer -X github.com/armosec/kubescape/cautils/getter.ArmoERURL=$ArmoERServer -X github.com/armosec/kubescape/cautils/getter.ArmoFEURL=$ArmoWebsite" -o build/${{ matrix.os }}/kubescape # && md5sum build/${{ matrix.os }}/kubescape > build/${{ matrix.os }}/kubescape.md5 + run: python3 --version && python3 build.py - name: Upload build artifacts uses: actions/upload-artifact@v2 diff --git a/.github/workflows/master_pr_checks.yaml b/.github/workflows/master_pr_checks.yaml index ff96fd7a..53fca59f 100644 --- a/.github/workflows/master_pr_checks.yaml +++ b/.github/workflows/master_pr_checks.yaml @@ -29,7 +29,7 @@ jobs: ArmoERServer: report.armo.cloud ArmoWebsite: portal.armo.cloud CGO_ENABLED: 0 - run: python build.py + run: python3 --version && python3 build.py - name: Upload build artifacts uses: actions/upload-artifact@v2 diff --git a/README.md b/README.md index ba65ee9c..2b82689a 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Kubescape is an open source project, we welcome your feedback and ideas for impr # How to build -## Build using python script +## Build using python (3.7^) script Kubescpae can be built using: diff --git a/build.py b/build.py index 2687e0ef..546b0084 100644 --- a/build.py +++ b/build.py @@ -59,6 +59,8 @@ def main(): ER_SERVER_CONST, ArmoERServer, WEBSITE_CONST, ArmoWebsite) status = subprocess.call(["go", "build", "-o", "%s/%s" % (buildDir, packageName), "-ldflags" ,ldflags]) checkStatus(status, "Failed to build kubescape") + + test_cli_prints(buildDir,packageName) sha1 = hashlib.sha1() @@ -69,5 +71,12 @@ def main(): print("Build Done") +def test_cli_prints(buildDir,packageName): + bin_cli = os.path.abspath(os.path.join(buildDir,packageName)) + + print(f"testing CLI prints on {bin_cli}") + status = str(subprocess.check_output([bin_cli, "-h"])) + assert "download" in status, "download is missing: " + status + if __name__ == "__main__": main() diff --git a/build/Dockerfile b/build/Dockerfile index 4cf8dcb3..6385051f 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,13 +1,25 @@ FROM golang:1.17-alpine as builder -ENV GOPROXY=https://goproxy.io,direct -ENV GO111MODULE=on +#ENV GOPROXY=https://goproxy.io,direct +ENV GO111MODULE= + +ENV CGO_ENABLED=0 + +# Install required python/pip +ENV PYTHONUNBUFFERED=1 +RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python +RUN python3 -m ensurepip +RUN pip3 install --no-cache --upgrade pip setuptools WORKDIR /work ADD . . -RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w " -installsuffix cgo -o kubescape . + +RUN python build.py + +RUN ls -ltr build/ubuntu-latest +RUN cat /work/build/ubuntu-latest/kubescape.sha1 FROM alpine -COPY --from=builder /work/kubescape /usr/bin/kubescape +COPY --from=builder /work/build/ubuntu-latest/kubescape /usr/bin/kubescape # # Download the frameworks. Use the "--use-default" flag when running kubescape # RUN kubescape download framework nsa && kubescape download framework mitre diff --git a/cautils/customerloader.go b/cautils/customerloader.go index a7a336d0..c97acdb1 100644 --- a/cautils/customerloader.go +++ b/cautils/customerloader.go @@ -111,7 +111,7 @@ func (c *EmptyConfig) GetK8sAPI() *k8sinterface.KubernetesApi { return nil } func (c *EmptyConfig) GetDefaultNS() string { return k8sinterface.GetDefaultNamespace() } func (c *EmptyConfig) GetBackendAPI() getter.IBackend { return nil } // TODO: return mock obj func (c *EmptyConfig) GenerateURL() { - message := fmt.Sprintf("You can see the results in a user-friendly UI, choose your preferred compliance framework, check risk results history and trends, manage exceptions, get remediation recommendations and much more by registering here: https://%s", getter.ArmoFEURL) + message := fmt.Sprintf("You can see the results in a user-friendly UI, choose your preferred compliance framework, check risk results history and trends, manage exceptions, get remediation recommendations and much more by registering here: https://%s", getter.GetArmoAPIConnector().GetFrontendURL()) InfoTextDisplay(os.Stdout, message+"\n") } @@ -143,7 +143,7 @@ func (c *ClusterConfig) GenerateURL() { u := url.URL{} u.Scheme = "https" - u.Host = getter.ArmoFEURL + u.Host = getter.GetArmoAPIConnector().GetFrontendURL() if c.configObj == nil { return } diff --git a/cautils/getter/armoapi.go b/cautils/getter/armoapi.go index d9f8b528..5c4d299d 100644 --- a/cautils/getter/armoapi.go +++ b/cautils/getter/armoapi.go @@ -3,9 +3,11 @@ package getter import ( "fmt" "net/http" + "time" "github.com/armosec/armoapi-go/armotypes" "github.com/armosec/opa-utils/reporthandling" + "github.com/golang/glog" ) // ======================================================================================================================= @@ -15,22 +17,80 @@ import ( var ( // ATTENTION!!! // Changes in this URLs variable names, or in the usage is affecting the build process! BE CAREFULL - ArmoBEURL = "eggdashbe.eudev3.cyberarmorsoft.com" - ArmoERURL = "report.eudev3.cyberarmorsoft.com" - ArmoFEURL = "armoui.eudev3.cyberarmorsoft.com" - // ArmoURL = "https://dashbe.euprod1.cyberarmorsoft.com" + armoERURL = "report.armo.cloud" + armoBEURL = "api.armo.cloud" + armoFEURL = "portal.armo.cloud" + + armoDevERURL = "report.eudev3.cyberarmorsoft.com" + armoDevBEURL = "eggdashbe.eudev3.cyberarmorsoft.com" + armoDevFEURL = "armoui.eudev3.cyberarmorsoft.com" ) // Armo API for downloading policies type ArmoAPI struct { httpClient *http.Client + apiURL string + erURL string + feURL string } -func NewArmoAPI() *ArmoAPI { +var globalArmoAPIConnecctor *ArmoAPI + +func SetARMOAPIConnector(armoAPI *ArmoAPI) { + globalArmoAPIConnecctor = armoAPI +} + +func GetArmoAPIConnector() *ArmoAPI { + if globalArmoAPIConnecctor == nil { + glog.Error("returning nil API connector") + } + return globalArmoAPIConnecctor +} + +func NewARMOAPIDev() *ArmoAPI { + apiObj := newArmoAPI() + + apiObj.apiURL = armoDevBEURL + apiObj.erURL = armoDevERURL + apiObj.feURL = armoDevFEURL + + return apiObj +} + +func NewARMOAPIProd() *ArmoAPI { + apiObj := newArmoAPI() + + apiObj.apiURL = armoBEURL + apiObj.erURL = armoERURL + apiObj.feURL = armoFEURL + + return apiObj +} + +func NewARMOAPICustomized(armoERURL, armoBEURL, armoFEURL string) *ArmoAPI { + apiObj := newArmoAPI() + + apiObj.erURL = armoERURL + apiObj.apiURL = armoBEURL + apiObj.feURL = armoFEURL + + return apiObj +} + +func newArmoAPI() *ArmoAPI { return &ArmoAPI{ - httpClient: &http.Client{}, + httpClient: &http.Client{Timeout: time.Duration(61) * time.Second}, } } + +func (armoAPI *ArmoAPI) GetFrontendURL() string { + return armoAPI.feURL +} + +func (armoAPI *ArmoAPI) GetReportReceiverURL() string { + return armoAPI.erURL +} + func (armoAPI *ArmoAPI) GetFramework(name string) (*reporthandling.Framework, error) { respStr, err := HttpGetter(armoAPI.httpClient, armoAPI.getFrameworkURL(name)) if err != nil { diff --git a/cautils/getter/armoapiutils.go b/cautils/getter/armoapiutils.go index d54264fd..001a6540 100644 --- a/cautils/getter/armoapiutils.go +++ b/cautils/getter/armoapiutils.go @@ -8,7 +8,7 @@ import ( func (armoAPI *ArmoAPI) getFrameworkURL(frameworkName string) string { u := url.URL{} u.Scheme = "https" - u.Host = ArmoBEURL + u.Host = armoAPI.apiURL u.Path = "v1/armoFrameworks" q := u.Query() q.Add("customerGUID", "11111111-1111-1111-1111-111111111111") @@ -22,7 +22,7 @@ func (armoAPI *ArmoAPI) getFrameworkURL(frameworkName string) string { func (armoAPI *ArmoAPI) getExceptionsURL(customerGUID, clusterName string) string { u := url.URL{} u.Scheme = "https" - u.Host = ArmoBEURL + u.Host = armoAPI.apiURL u.Path = "api/v1/armoPostureExceptions" q := u.Query() @@ -38,7 +38,7 @@ func (armoAPI *ArmoAPI) getExceptionsURL(customerGUID, clusterName string) strin func (armoAPI *ArmoAPI) getCustomerURL() string { u := url.URL{} u.Scheme = "https" - u.Host = ArmoBEURL + u.Host = armoAPI.apiURL u.Path = "api/v1/createTenant" return u.String() } diff --git a/cautils/getter/downloadreleasedpolicy.go b/cautils/getter/downloadreleasedpolicy.go index 1fe6ca99..713704e7 100644 --- a/cautils/getter/downloadreleasedpolicy.go +++ b/cautils/getter/downloadreleasedpolicy.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http" + "time" "github.com/armosec/opa-utils/reporthandling" ) @@ -22,7 +23,7 @@ type DownloadReleasedPolicy struct { func NewDownloadReleasedPolicy() *DownloadReleasedPolicy { return &DownloadReleasedPolicy{ hostURL: "", - httpClient: &http.Client{}, + httpClient: &http.Client{Timeout: 61 * time.Second}, } } diff --git a/cautils/getter/getpoliciesutils.go b/cautils/getter/getpoliciesutils.go index 86f2d69e..af367a3d 100644 --- a/cautils/getter/getpoliciesutils.go +++ b/cautils/getter/getpoliciesutils.go @@ -5,8 +5,8 @@ import ( "fmt" "io" "net/http" - "net/url" "os" + "path" "path/filepath" "strings" @@ -21,14 +21,26 @@ func GetDefaultPath(name string) string { return defaultfilePath } -func SaveFrameworkInFile(framework *reporthandling.Framework, path string) error { +func SaveFrameworkInFile(framework *reporthandling.Framework, pathStr string) error { encodedData, err := json.Marshal(framework) if err != nil { return err } - err = os.WriteFile(path, []byte(fmt.Sprintf("%v", string(encodedData))), 0644) + err = os.WriteFile(pathStr, []byte(fmt.Sprintf("%v", string(encodedData))), 0644) if err != nil { - return err + if os.IsNotExist(err) { + pathDir := path.Dir(pathStr) + if err := os.Mkdir(pathDir, 0744); err != nil { + return err + } + } else { + return err + + } + err = os.WriteFile(pathStr, []byte(fmt.Sprintf("%v", string(encodedData))), 0644) + if err != nil { + return err + } } return nil } @@ -86,29 +98,3 @@ func httpRespToString(resp *http.Response) (string, error) { return respStr, err } - -// URLEncoder encode url -func urlEncoder(oldURL string) string { - fullURL := strings.Split(oldURL, "?") - baseURL, err := url.Parse(fullURL[0]) - if err != nil { - return "" - } - - // Prepare Query Parameters - if len(fullURL) > 1 { - params := url.Values{} - queryParams := strings.Split(fullURL[1], "&") - for _, i := range queryParams { - queryParam := strings.Split(i, "=") - val := "" - if len(queryParam) > 1 { - val = queryParam[1] - } - params.Add(queryParam[0], val) - } - baseURL.RawQuery = params.Encode() - } - - return baseURL.String() -} diff --git a/cautils/scaninfo.go b/cautils/scaninfo.go index 2f1d8f47..f1838bff 100644 --- a/cautils/scaninfo.go +++ b/cautils/scaninfo.go @@ -19,7 +19,6 @@ type ScanInfo struct { InputPatterns []string // Yaml files input patterns Silent bool // Silent mode - Do not print progress logs FailThreshold uint16 // Failure score threshold - DoNotSendResults bool // DEPRECATED Submit bool // Submit results to Armo BE Local bool // Do not submit results Account string // account ID @@ -43,7 +42,7 @@ func (scanInfo *ScanInfo) setUseExceptions() { // load exceptions from file scanInfo.ExceptionsGetter = getter.NewLoadPolicy(scanInfo.UseExceptions) } else { - scanInfo.ExceptionsGetter = getter.NewArmoAPI() + scanInfo.ExceptionsGetter = getter.GetArmoAPIConnector() } } diff --git a/cmd/cluster_get.go b/cmd/cluster_get.go index 74816369..6203473e 100644 --- a/cmd/cluster_get.go +++ b/cmd/cluster_get.go @@ -31,7 +31,7 @@ var getCmd = &cobra.Command{ key := keyValue[0] k8s := k8sinterface.NewKubernetesApi() - clusterConfig := cautils.NewClusterConfig(k8s, getter.NewArmoAPI()) + clusterConfig := cautils.NewClusterConfig(k8s, getter.GetArmoAPIConnector()) val, err := clusterConfig.GetValueByKeyFromConfigMap(key) if err != nil { if err.Error() == "value does not exist." { diff --git a/cmd/cluster_set.go b/cmd/cluster_set.go index f7c6edae..4a48f285 100644 --- a/cmd/cluster_set.go +++ b/cmd/cluster_set.go @@ -30,7 +30,7 @@ var setCmd = &cobra.Command{ data := keyValue[1] k8s := k8sinterface.NewKubernetesApi() - clusterConfig := cautils.NewClusterConfig(k8s, getter.NewArmoAPI()) + clusterConfig := cautils.NewClusterConfig(k8s, getter.GetArmoAPIConnector()) if err := clusterConfig.SetKeyValueInConfigmap(key, data); err != nil { return err } diff --git a/cmd/download.go b/cmd/download.go index a27123ac..550c42f8 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -11,7 +11,7 @@ import ( var downloadInfo cautils.DownloadInfo var downloadCmd = &cobra.Command{ - Use: fmt.Sprintf("Download framework [flags]\nSupported frameworks: %s", validFrameworks), + Use: fmt.Sprintf("download framework [flags]\nSupported frameworks: %s", validFrameworks), Short: "Download framework controls", Long: ``, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/framework.go b/cmd/framework.go index 311c1ca3..c24a4fdf 100644 --- a/cmd/framework.go +++ b/cmd/framework.go @@ -1,7 +1,6 @@ package cmd import ( - "flag" "fmt" "io" "os" @@ -32,7 +31,7 @@ type CLIHandler struct { var frameworkCmd = &cobra.Command{ - Use: fmt.Sprintf("framework [``/`-`] [flags]\nSupported frameworks: %s", validFrameworks), + Use: fmt.Sprintf("framework [``/`-`] [flags]\nSupported frameworks: %s", validFrameworks), Short: fmt.Sprintf("The framework you wish to use. Supported frameworks: %s", strings.Join(supportedFrameworks, ", ")), Long: "Execute a scan on a running Kubernetes cluster or `yaml`/`json` files (use glob) or `-` for stdin", ValidArgs: supportedFrameworks, @@ -95,15 +94,13 @@ func init() { frameworkCmd.Flags().StringVarP(&scanInfo.Output, "output", "o", "", "Output file. Print output to file and not stdout") frameworkCmd.Flags().BoolVarP(&scanInfo.Silent, "silent", "s", false, "Silent progress messages") frameworkCmd.Flags().Uint16VarP(&scanInfo.FailThreshold, "fail-threshold", "t", 0, "Failure threshold is the percent bellow which the command fails and returns exit code 1") - frameworkCmd.Flags().BoolVarP(&scanInfo.DoNotSendResults, "results-locally", "", false, "Deprecated. Please use `--keep-local` instead") frameworkCmd.Flags().BoolVarP(&scanInfo.Submit, "submit", "", false, "Send the scan results to Armo management portal where you can see the results in a user-friendly UI, choose your preferred compliance framework, check risk results history and trends, manage exceptions, get remediation recommendations and much more. By default the results are not submitted") - frameworkCmd.Flags().BoolVarP(&scanInfo.Local, "keep-local", "", false, "If you do not want your Kubescape results reported to Armo backend. Use this flag if you ran with the `--submit` flag in the past and you do not want to submit your current scan results") + frameworkCmd.Flags().BoolVarP(&scanInfo.Local, "keep-local", "", false, "If you do not want your Kubescape results reported to Armo backend. Use this flag if you ran with the '--submit' flag in the past and you do not want to submit your current scan results") frameworkCmd.Flags().StringVarP(&scanInfo.Account, "account", "", "", "Armo portal account ID. Default will load account ID from configMap or config file") } func CliSetup() error { - flag.Parse() flagValidation() var k8s *k8sinterface.KubernetesApi @@ -114,7 +111,7 @@ func CliSetup() error { } else { k8s = k8sinterface.NewKubernetesApi() // setup cluster config - clusterConfig = cautils.ClusterConfigSetup(&scanInfo, k8s, getter.NewArmoAPI()) + clusterConfig = cautils.ClusterConfigSetup(&scanInfo, k8s, getter.GetArmoAPIConnector()) } processNotification := make(chan *cautils.OPASessionObj) @@ -188,9 +185,6 @@ func (clihandler *CLIHandler) Scan() error { } func flagValidation() { - if scanInfo.DoNotSendResults { - fmt.Println("Deprecated. Please use `--keep-local` instead") - } if scanInfo.Submit && scanInfo.Local { fmt.Println("You can use `keep-local` or `submit`, but not both") diff --git a/cmd/root.go b/cmd/root.go index 88b9db54..7f51c38a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,15 +1,29 @@ package cmd import ( + "flag" + "os" + "strings" + + "github.com/armosec/kubescape/cautils/getter" + "github.com/golang/glog" "github.com/spf13/cobra" ) var cfgFile string +var armoBEURLs = "" + +const envFlagUsage = "Send report results to specific URL. Format:,,.\n\t\tExample:report.armo.cloud,api.armo.cloud,portal.armo.cloud" var rootCmd = &cobra.Command{ Use: "kubescape", Short: "Kubescape is a tool for testing Kubernetes security posture", - Long: `Kubescape is a tool for testing Kubernetes security posture based on NSA specifications.`, + Long: `Kubescape is a tool for testing Kubernetes security posture based on NSA \ MITRE ATT&CKĀ® specifications.`, + PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + flag.Parse() + InitArmoBEConnector() + return nil + }, } func Execute() { @@ -17,9 +31,38 @@ func Execute() { } func init() { + flag.CommandLine.StringVar(&armoBEURLs, "environment", "", envFlagUsage) + rootCmd.PersistentFlags().StringVar(&armoBEURLs, "environment", "", envFlagUsage) + rootCmd.PersistentFlags().MarkHidden("environment") cobra.OnInitialize(initConfig) + } // initConfig reads in config file and ENV variables if set. func initConfig() { } + +func InitArmoBEConnector() { + urlSlices := strings.Split(armoBEURLs, ",") + if len(urlSlices) > 3 { + glog.Errorf("Too many URLs") + os.Exit(1) + } + switch len(urlSlices) { + case 1: + switch urlSlices[0] { + case "dev": + getter.SetARMOAPIConnector(getter.NewARMOAPIDev()) + case "": + getter.SetARMOAPIConnector(getter.NewARMOAPIProd()) + default: + glog.Errorf("--environment flag usage: %s", envFlagUsage) + os.Exit(1) + } + case 2: + glog.Errorf("--environment flag usage: %s", envFlagUsage) + os.Exit(1) + case 3: + getter.SetARMOAPIConnector(getter.NewARMOAPICustomized(urlSlices[0], urlSlices[1], urlSlices[2])) + } +} diff --git a/opaprocessor/processorhandlerutils.go b/opaprocessor/processorhandlerutils.go index 4dd1f508..859a6ac5 100644 --- a/opaprocessor/processorhandlerutils.go +++ b/opaprocessor/processorhandlerutils.go @@ -82,13 +82,3 @@ func ruleWithArmoOpaDependency(annotations map[string]interface{}) bool { } return false } - -func percentage(big, small int) int { - if big == 0 { - if small == 0 { - return 100 - } - return 0 - } - return int(float64(float64(big-small)/float64(big)) * 100) -} diff --git a/policyhandler/filesloader_test.go b/policyhandler/filesloader_test.go index c317fcc3..f2bea56b 100644 --- a/policyhandler/filesloader_test.go +++ b/policyhandler/filesloader_test.go @@ -6,53 +6,44 @@ import ( "path/filepath" "strings" "testing" - - "github.com/armosec/kubescape/cautils" ) -func combineYamlFile(base, rel string) string { - finalPath := []string{} - sBase := strings.Split(base, "/") - sRel := strings.Split(rel, "/") - for i := range sBase { - if cautils.StringInSlice(sRel, sBase[i]) != cautils.ValueNotFound { - finalPath = append(finalPath, sRel...) - break - } - finalPath = append(finalPath, sBase[i]) - } - return fmt.Sprintf("/%s", filepath.Join(finalPath...)) -} func onlineBoutiquePath() string { o, _ := os.Getwd() - return combineYamlFile(o, "kubescape/examples/online-boutique/*") + return filepath.Join(filepath.Dir(o), "examples/online-boutique/*") } + func TestListFiles(t *testing.T) { - // files, errs := listFiles([]string{onlineBoutiquePath()}) - // if len(errs) > 0 { - // t.Error(errs) - // } - // expected := 12 - // if len(files) != expected { - // t.Errorf("wrong number of files, expected: %d, found: %d", expected, len(files)) - // } + workDir, err := os.Getwd() + fmt.Printf("\n------------------\n%s,%v\n--------------\n", workDir, err) + filesPath := onlineBoutiquePath() + fmt.Printf("\n------------------\n%s\n--------------\n", filesPath) + + files, errs := listFiles([]string{filesPath}) + if len(errs) > 0 { + t.Error(errs) + } + expected := 12 + if len(files) != expected { + t.Errorf("wrong number of files, expected: %d, found: %d", expected, len(files)) + } } func TestLoadFiles(t *testing.T) { - // files, _ := listFiles([]string{onlineBoutiquePath()}) - // loadFiles(files) + files, _ := listFiles([]string{onlineBoutiquePath()}) + loadFiles(files) } func TestLoadFile(t *testing.T) { - // files, _ := listFiles([]string{strings.Replace(onlineBoutiquePath(), "*", "adservice.yaml", 1)}) - // _, err := loadFile(files[0]) - // if err != nil { - // t.Errorf("%v", err) - // } + files, _ := listFiles([]string{strings.Replace(onlineBoutiquePath(), "*", "adservice.yaml", 1)}) + _, err := loadFile(files[0]) + if err != nil { + t.Errorf("%v", err) + } } func TestLoadResources(t *testing.T) { - - // k8sResources, err = policyHandler.loadResources(opaSessionObj.Frameworks, scanInfo) + // policyHandler := &PolicyHandler{} + // k8sResources, err := policyHandler.loadResources(opaSessionObj.Frameworks, scanInfo) // files, _ := listFiles([]string{onlineBoutiquePath()}) // bb, err := loadFile(files[0]) // if len(err) > 0 { diff --git a/resultshandling/printer/printresults.go b/resultshandling/printer/printresults.go index 63833bb1..8d8fc080 100644 --- a/resultshandling/printer/printresults.go +++ b/resultshandling/printer/printresults.go @@ -228,9 +228,6 @@ func (printer *Printer) PrintSummaryTable() { for i := 0; i < len(printer.sortedControlNames); i++ { controlSummary := printer.summary[printer.sortedControlNames[i]] summaryTable.Append(generateRow(printer.sortedControlNames[i], controlSummary)) - // sumFailed += controlSummary.TotalFailed - // sumWarning += controlSummary.TotalWarnign - // sumTotal += controlSummary.TotalResources } summaryTable.SetFooter(generateFooter(len(printer.summary), printer.frameworkSummary.TotalFailed, printer.frameworkSummary.TotalWarnign, printer.frameworkSummary.TotalResources)) summaryTable.Render() diff --git a/resultshandling/reporter/reporteventreceiverutils.go b/resultshandling/reporter/reporteventreceiverutils.go index ee26e203..96fa75be 100644 --- a/resultshandling/reporter/reporteventreceiverutils.go +++ b/resultshandling/reporter/reporteventreceiverutils.go @@ -37,7 +37,7 @@ func initEventReceiverURL() *url.URL { urlObj := url.URL{} urlObj.Scheme = "https" - urlObj.Host = getter.ArmoERURL + urlObj.Host = getter.GetArmoAPIConnector().GetReportReceiverURL() urlObj.Path = "/k8s/postureReport" q := urlObj.Query() q.Add("customerGUID", uuid.FromStringOrNil(cautils.CustomerGUID).String())