-
Notifications
You must be signed in to change notification settings - Fork 295
/
constants.go
148 lines (126 loc) · 3.92 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package constants
import (
"fmt"
"math"
"os"
"path/filepath"
)
var (
// Version - current KICS version
Version = "development"
// SCMCommit - Source control management commit identifier
SCMCommit = "NOCOMMIT"
// SentryDSN - sentry DSN, unset for disabling
SentryDSN = ""
// BaseURL - Descriptions endpoint URL
BaseURL = ""
// APIScanner - API scanner feature switch
APIScanner = ""
// AvailableCategories - All categories and its identifies
AvailableCategories = map[string]string{
"Access Control": "CAT001",
"Availability": "CAT002",
"Backup": "CAT003",
"Best Practices": "CAT004",
"Build Process": "CAT005",
"Encryption": "CAT006",
"Insecure Configurations": "CAT007",
"Insecure Defaults": "CAT008",
"Networking and Firewall": "CAT009",
"Observability": "CAT010",
"Resource Management": "CAT011",
"Secret Management": "CAT012",
"Supply-Chain": "CAT013",
"Structure and Semantics": "CAT014",
"Bill Of Materials": "CAT015",
}
// AvailablePlatforms - All platforms available
AvailablePlatforms = map[string]string{
"Ansible": "ansible",
"CICD": "cicd",
"CloudFormation": "cloudFormation",
"Crossplane": "crossplane",
"Dockerfile": "dockerfile",
"DockerCompose": "dockerCompose",
"Knative": "knative",
"Kubernetes": "k8s",
"OpenAPI": "openAPI",
"Terraform": "terraform",
"AzureResourceManager": "azureResourceManager",
"Bicep": "bicep",
"GoogleDeploymentManager": "googleDeploymentManager",
"GRPC": "grpc",
"Buildah": "buildah",
"Pulumi": "pulumi",
"ServerlessFW": "serverlessFW",
}
// AvailableSeverities - All severities available
AvailableSeverities = []string{
"critical",
"high",
"medium",
"low",
"info",
"trace",
}
// AvailableLogLevels - All log levels available
AvailableLogLevels = []string{
"TRACE",
"DEBUG",
"INFO",
"WARN",
"ERROR",
"FATAL",
}
// AvailableCloudProviders - All cloud providers available
AvailableCloudProviders = map[string]string{
"alicloud": "",
"aws": "",
"azure": "",
"gcp": "",
"nifcloud": "",
"tencentcloud": "",
}
)
const (
// Fullname - KICS fullname
Fullname = "Keeping Infrastructure as Code Secure"
// URL - KICS url
URL = "https://www.kics.io/"
// DefaultLogFile - logfile name
DefaultLogFile = "info.log"
// DefaultConfigFilename - default configuration filename
DefaultConfigFilename = "kics.config"
// MinimumPreviewLines - default minimum preview lines number
MinimumPreviewLines = 1
// MaximumPreviewLines - default maximum preview lines number
MaximumPreviewLines = 30
// EngineErrorCode - Exit Status code for error in engine
EngineErrorCode = 126
// SignalInterruptCode - Exit Status code for a signal interrupt
SignalInterruptCode = 130
// MaxInteger - max possible integer in golang
MaxInteger = math.MaxInt64
// SentryRefreshRate - sentry crash report refresh rate
SentryRefreshRate = 2
// LogFormatJSON - print log as json
LogFormatJSON = "json"
// LogFormatPretty - print log more readable
LogFormatPretty = "pretty"
)
// GetRelease - returns the current release in the format 'kics@version' to be used by sentry
func GetRelease() string {
return fmt.Sprintf("kics@%s", Version)
}
// GetVersion - returns the current version in the format 'Keeping Infrastructure as Code Secure <version>'
func GetVersion() string {
return fmt.Sprintf("%s %s", Fullname, Version)
}
// GetDefaultLogPath - returns the path where the default log file is located
func GetDefaultLogPath() (string, error) {
currentWorkDir, err := os.Getwd()
if err != nil {
return "", err
}
return filepath.Join(currentWorkDir, DefaultLogFile), nil
}