update report size limit to 4mb

This commit is contained in:
David Wertenteil
2022-07-05 15:13:02 +03:00
parent fc78d9143b
commit 424f2cc403
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -1,7 +1,6 @@
package cautils
import (
"os"
"path/filepath"
"strings"
@@ -76,7 +75,8 @@ func (hc *HelmChart) GetWorkloads(values map[string]interface{}) (map[string][]w
if len(wls) == 0 {
continue
}
if firstPathSeparatorIndex := strings.Index(path, string(os.PathSeparator)); firstPathSeparatorIndex != -1 {
// separate base path and file name. We do not use the os.Separator because the paths returned from the helm engine are not OS specific (e.g. mychart/templates/myfile.yaml)
if firstPathSeparatorIndex := strings.Index(path, string("/")); firstPathSeparatorIndex != -1 {
absPath := filepath.Join(hc.path, path[firstPathSeparatorIndex:])
workloads[absPath] = []workloadinterface.IMetadata{}
@@ -18,7 +18,7 @@ import (
reporthandlingv2 "github.com/armosec/opa-utils/reporthandling/v2"
)
const MAX_REPORT_SIZE = 2097152 // 2 MB
const MAX_REPORT_SIZE = 4000000 // 4 MB
type ReportEventReceiver struct {
httpClient *http.Client
@@ -124,6 +124,7 @@ func (report *ReportEventReceiver) sendResources(host string, opaSessionObj *cau
if err := report.setResults(splittedPostureReport, opaSessionObj.ResourcesResult, &counter, &reportCounter, host); err != nil {
return err
}
return report.sendReport(host, splittedPostureReport, reportCounter, true)
}
func (report *ReportEventReceiver) setResults(reportObj *reporthandlingv2.PostureReport, results map[string]resourcesresults.Result, counter, reportCounter *int, host string) error {