Documentation ¶
Index ¶
- Variables
- func MapKeysToString(m map[string]interface{}, sep string) string
- func RenderFullReportToHTML(reportData *HtmlReport) (*bytes.Buffer, error)
- func ValidateReportData(reportData *HtmlReport) error
- type ComparisonTableRow
- type Grade
- type HtmlReport
- type TestDetails
- type TestSetSummary
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
View Source
var HtmlTemplate string
Functions ¶
func MapKeysToString ¶
MapKeysToString concatenates all keys of a map with a separator and returns a string.
func RenderFullReportToHTML ¶
func RenderFullReportToHTML(reportData *HtmlReport) (*bytes.Buffer, error)
RenderFullReportToHTML substitutes report data into HTML template.
func ValidateReportData ¶
func ValidateReportData(reportData *HtmlReport) error
ValidateReportData validates report data
Types ¶
type ComparisonTableRow ¶
type HtmlReport ¶
type HtmlReport struct { IgnoreUnresolved bool `json:"ignore_unresolved" validate:"boolean"` IncludePayloads bool `json:"include_payloads" validate:"boolean"` WafName string `json:"waf_name" validate:"required,printascii,max=256"` Url string `json:"url" validate:"required,url,max=256"` WafTestingDate string `json:"waf_testing_date" validate:"required,datetime=02 January 2006"` GtwVersion string `json:"gtw_version" validate:"required,gtw_version"` TestCasesFP string `json:"test_cases_fp" validate:"required,fp"` OpenApiFile string `json:"open_api_file" validate:"omitempty,printascii,max=512"` Args []string `json:"args" validate:"omitempty,max=50,dive,args,max=200"` ApiSecChartData struct { Indicators []string `json:"indicators" validate:"omitempty,max=100,dive,indicator"` Items []float64 `json:"items" validate:"omitempty,max=100,dive,min=0,max=100"` Chart *template.HTML `json:"-" validate:"-"` } `json:"api_sec_chart_data"` AppSecChartData struct { Indicators []string `json:"indicators" validate:"omitempty,max=100,dive,indicator"` Items []float64 `json:"items" validate:"omitempty,max=100,dive,min=0,max=100"` Chart *template.HTML `json:"-" validate:"-"` } `json:"app_sec_chart_data"` Overall *Grade `json:"overall" validate:"required"` ApiSec struct { TruePositiveTestsGrade *Grade `json:"true_positive_grade" validate:"required"` TrueNegativeTestsGrade *Grade `json:"true_negative_grade" validate:"required"` Grade *Grade `json:"grade" validate:"required"` } `json:"api_sec"` AppSec struct { TruePositiveTestsGrade *Grade `json:"true_positive_grade" validate:"required"` TrueNegativeTestsGrade *Grade `json:"true_negative_grade" validate:"required"` Grade *Grade `json:"grade" validate:"required"` } `json:"app_sec"` ComparisonTable []*ComparisonTableRow `json:"comparison_table" validate:"required,dive,required"` WallarmResult *ComparisonTableRow `json:"wallarm_result" validate:"required,dive,required"` TotalSent int `json:"total_sent" validate:"min=0"` BlockedRequestsNumber int `json:"blocked_requests_number" validate:"min=0"` BypassedRequestsNumber int `json:"bypassed_requests_number" validate:"min=0"` UnresolvedRequestsNumber int `json:"unresolved_requests_number" validate:"min=0"` FailedRequestsNumber int `json:"failed_requests_number" validate:"min=0"` ScannedPaths db.ScannedPaths `json:"scanned_paths" validate:"omitempty,max=2048,dive,required"` TruePositiveTests struct { SummaryTable map[string]*TestSetSummary `json:"summary_table" validate:"omitempty,dive,keys,required,max=256,endkeys,required"` // map[paths]map[payload]map[statusCode]*testDetails Bypassed map[string]map[string]map[int]*TestDetails `` /* 153-byte string literal not displayed */ // map[payload]map[statusCode]*testDetails Unresolved map[string]map[int]*TestDetails `json:"unresolved" validate:"omitempty,dive,keys,required,max=256000,endkeys,required,dive,keys,min=0,endkeys,required"` Failed []*db.FailedDetails `json:"failed" validate:"omitempty,dive,required"` Percentage float64 `json:"percentage" validate:"min=0,max=100"` TotalSent int `json:"total_sent" validate:"min=0"` BlockedRequestsNumber int `json:"blocked_requests_number" validate:"min=0"` BypassedRequestsNumber int `json:"bypassed_requests_number" validate:"min=0"` UnresolvedRequestsNumber int `json:"unresolved_requests_number" validate:"min=0"` FailedRequestsNumber int `json:"failed_requests_number" validate:"min=0"` } `json:"true_positive_tests"` TrueNegativeTests struct { SummaryTable map[string]*TestSetSummary `json:"summary_table" validate:"omitempty,dive,keys,required,endkeys,required"` // map[payload]map[statusCode]*testDetails Blocked map[string]map[int]*TestDetails `json:"blocked" validate:"omitempty,dive,keys,required,max=256000,endkeys,required,dive,keys,min=0,endkeys,required"` // map[payload]map[statusCode]*testDetails Bypassed map[string]map[int]*TestDetails `json:"bypassed" validate:"omitempty,dive,keys,required,max=256000,endkeys,required,dive,keys,min=0,endkeys,required"` // map[payload]map[statusCode]*testDetails Unresolved map[string]map[int]*TestDetails `json:"unresolved" validate:"omitempty,dive,keys,required,max=256000,endkeys,required,dive,keys,min=0,endkeys,required"` Failed []*db.FailedDetails `json:"failed" validate:"omitempty,dive,required"` Percentage float64 `json:"percentage" validate:"min=0,max=100"` TotalSent int `json:"total_sent" validate:"min=0"` BlockedRequestsNumber int `json:"blocked_requests_number" validate:"min=0"` BypassedRequestsNumber int `json:"bypassed_requests_number" validate:"min=0"` UnresolvedRequestsNumber int `json:"unresolved_requests_number" validate:"min=0"` FailedRequestsNumber int `json:"failed_requests_number" validate:"min=0"` } `json:"true_negative_tests"` }
HtmlReport represents a data required to render a full report in HTML/PDF format.
type TestDetails ¶
type TestSetSummary ¶
type TestSetSummary struct { TestCases []*db.SummaryTableRow `json:"test_cases" validate:"required,max=1024,dive,required"` Percentage float64 `json:"percentage" validate:"min=0,max=100"` Sent int `json:"sent" validate:"min=0"` Blocked int `json:"blocked" validate:"min=0"` Bypassed int `json:"bypassed" validate:"min=0"` Unresolved int `json:"unresolved" validate:"min=0"` Failed int `json:"failed" validate:"min=0"` ResolvedTestCasesNumber int `json:"resolved_test_cases_number" validate:"min=0"` }
type ValidationError ¶ added in v0.4.4
type ValidationError struct {
// contains filtered or unexported fields
}
func (*ValidationError) Error ¶ added in v0.4.4
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.