PDF Generator Structure in Golang
This structure use for generate html template files.
Overview
This content describes the structure used in the PDF generator in Golang. The generator creates HTML template files, and the content explains the different structures used in the process. The 'Config' structure contains information about the application, such as risk level, compliance, and target environment. The 'CorrelatedResource structure' is used in related infra relation resources, and 'Result' contains information about the PDF generation result. The 'AlertList' structure contains information about the alerts generated during the PDF generation, while 'AlertStatistics' provides an overview of the alerts' severity. Finally, 'InfraOutput' describes the output of infrastructure testing. The structure and data types provided allow developers to create customizable and dynamic PDF generation processes.
The template generator file guild is right here.
Paconfig Config
CorrelatedResource CorrelatedResource
Result Result
AlertStatistics AlertStatistics
AlertList AlertList
InfraOutputs InfraOutput
SpiderUrls []string
Config Structure that using for Paconfig
type Config struct {
ID primitive.ObjectID
Collection string
ApplicationName string
RiskLevel string
Compliance []string
Environment string
Target string
ResourceID string
Tags map[string]string
Targets []Targets
ResourceType string
ApplicationType string
APIScan APIScan
WebScan WebScan
Paths Paths
ConnectionName string
CloudType string
Scanner Scanner
ContextId string
Authentication Authentication
AuthenticationMethod string
Scheduler string
LastAction string
Validated bool
RemoteFile string
RemoteConnector string
AddOns []string
CVE []CVE
}
type Targets struct {
Type string
TargetUrl string
ResourceID string
Tags map[string]string
}
type APIScan struct {
Type string
DirectionProvider string
Direction string
PostmanRemoteFile string
PostmanEnvRemoteFile string
Connector string
}
type WebScan struct {
Mode string
AjaxSpider bool
}
type Paths struct {
Exclude []string
Include []string
}
type Scanner struct {
CustomInstance string
Ip string
Cloud Cloud
}
type Cloud struct {
Platform Platform
}
type Platform struct {
Azure Azure
AWS AWS
GCP GCP
}
type Azure struct {
ContainerInstance ContainerInstance
}
type AWS struct {
AfterRun string
Connector string
TemplateFile string
ParameterFile string
StackName string
EcsExecRoleArn string
TokenSecretsManagerArn string
ExistingFargate ExistingFargate
NewFargate NewFargate
}
type GCP struct {
ExistingClusterInstance ExistingClusterInstance
AfterRun string
NewClusterInstance NewClusterInstance
}
type ExistingClusterInstance struct {
ProjectId string
ClusterName string
Location string
}
type NewClusterInstance struct {
EnternalClusterInstance EnternalClusterInstance
InternalClusterInstance InternalClusterInstance
}
type EnternalClusterInstance struct {
ProjectId string
ClusterName string
Location string
}
type InternalClusterInstance struct {
ProjectId string
ClusterName string
Location string
}
type ExistingFargate struct {
AccountId string
TaskDefinition string
ClusterName string
Region string
SecurityGroup string
ContainerName string
SubnetId string
}
type NewFargate struct {
External AWSExternal
ForgateDetailsInternal AWSInternal
}
type AWSExternal struct {
AccountId string
Region string
TaskDefinition string
ClusterName string
SecurityGroup string
ContainerName string
SubnetId string
VpcCidr string
SubnetCidr string
IGCidr string
}
type AWSInternal struct {
AccountId string
Region string
TaskDefinition string
ClusterName string
SecurityGroup string
ContainerName string
VpcCidr string
VpcId string
PublicSubnetCidr string
PrivateSubnetCidr string
IGCidr string
SubnetId string
}
type ContainerInstance struct {
ExistingContainerInstance ExistingContainerInstance
AfterRun string
NewContainerInstance NewContainerInstance
}
type ExistingContainerInstance struct {
SubscriptionId string
ResourceGp string
ResourceId string
Region string
}
type NewContainerInstance struct {
External External
Internal Internal
}
type External struct {
SubscriptionId string
ResourceGp string
Region string
ContainerGroupName string
ContainerName string
ResourceName string
}
type Internal struct {
SubscriptionId string
ResourceGp string
Region string
ContainerGroupName string
ContainerName string
ResourceName string
Subnet string
SubnetID string
SubCidr string
Vnet string
VnetCidr string
}
type Authentication struct {
Vault Vault
FormBaseAuth FormBaseAuth
JsonBaseAuth JsonBaseAuth
JWTAuth JWTAuth
CookieAuth CookieAuth
OAuth OAuth
CustomAuth CustomAuth
}
type FormBaseAuth struct {
UsernameSecretKey string
PasswordSecretKey string
LoginUrl string
LogoutUrl string
LoginRequestPostData string
LoginIndicator string
}
type JsonBaseAuth struct {
UsernameSecretKey string
PasswordSecretKey string
LoginUrl string
LogoutUrl string
LoginRequestPostData string
LoginIndicator string
}
type JWTAuth struct {
UsernameSecretKey string
PasswordSecretKey string
LoginUrl string
LogoutUrl string
LoginBodyTemplate string // the request body of login page exp : {"email":"%username%","password":"%password%"}
LoginIndicator string // the regex to identify the request is success or not exp : *authenticated* of *200*
AuthorizationType string // the key of header for authorization sample: header
AuthorizationKey string // the key of header for authorization sample: authorization
AuthorizationTokenType string // the type of jwt for example Bearer
}
type CookieAuth struct {
UsernameSecretKey string
PasswordSecretKey string
LoginUrl string
LogoutUrl string
LoginBodyTemplate string // the request body of login page exp : {"email":"%username%","password":"%password%"}
LoginIndicator string // the regex to identify the request is success or not exp : *authenticated* of *200*
CookieHeaderName string // the key for cookie which should setup in header
CookieSessionName string // the key for set as session variable
ExtraFields string // extra fields which should put in header
}
type OAuth struct {
LoginBodyTemplate string // the request body of login page exp : {"email":"%username%","password":"%password%"}
LoginIndicator string // the regex to identify the request is success or not exp : *authenticated* of *200*
ClientId string
ClientSecret string
TenantId string
LoginUrl string
LogoutUrl string
}
type CustomAuth struct {
AuthorizationType string
AuthorizationKey string
AuthorizationTokenType string
AuthorizationTokenValue string
}
type Vault struct {
Azure AzureVault
Aws AwsVault
GCP GCPVault
}
type AzureVault struct {
KeyVaultName string
SubscriptionID string
Region string
ResourceGroup string
}
type AwsVault struct {
SecretManager string
Region string
Account string
}
type GCPVault struct {
ProjectId string
}
CorrelatedResource that using in related infra relation resources
type CorrelatedResource struct {
RelatedResources []ResourcesData
Edges []EdgeData
}
type ResourcesData struct {
Id string
Name string
Parent string
Collection string
ResourceId string
ResourceType string
CloudResourceType string
ResourceNodeId string
DriftOutputId string
DriftResultId string
TargetResource bool
}
type EdgeData struct {
Source string
Target string
}
Result Structure
type Result struct {
ID primitive.ObjectID
CompletedON int64
CompletedOn string
ConfigId interface{}
Duration int
Status string
AIMessages AIMessages
}
type AIMessages struct {
ExecutiveSummary string
DescriptionAppFinding string
RemediateAppFinding string
MITREAATTANDCK string
EndSummary string
}
AlertList structure
type Alert struct {
Finding string `json:"finding" bson:"name"`
Criticality string `json:"criticality" bson:"risk"`
URL string `json:"url" bson:"url"`
Code string `json:"code" bson:"code"`
WASCID string `json:"wascid" bson:"wascid"`
}
AlertStatistics structure
type AlertStatistics struct {
Critical int
High int
Medium int
Low int
Informational int
}
InfraOutput structue
type InfraOutput struct {
Id string
Severity string
Title string
Eval string
Result string
RemediationDescription string
RemediationFunction string
ResultID string
MasterTestId string
Type string
Rule string
MasterSnapshotId string
Description string
SnapshotId string
Status string
AutoRemediate bool
}