-
Notifications
You must be signed in to change notification settings - Fork 176
Expand file tree
/
Copy pathhints.go
More file actions
156 lines (135 loc) · 6.67 KB
/
hints.go
File metadata and controls
156 lines (135 loc) · 6.67 KB
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
149
150
151
152
153
154
155
156
package events
import (
"github.com/stackrox/rox/pkg/administration/events/codes"
adminResources "github.com/stackrox/rox/pkg/administration/events/resources"
)
const (
defaultRemediation = "An unknown issue occurred. Make sure to check out the detailed event message for more details."
)
var (
// Currently, a hint is based on the domain and the resource associated with an administration event.
// Additionally, an optional error code can be given based on the resource to give a more specialized hint.
// In the future, we may extend this, and possibly also ensure hints are loaded externally (similar to
// vulnerability definitions).
hints = map[string]map[string]map[string]string{
AuthenticationDomain: {
adminResources.APIToken: {
codes.APITokenCreated: `An API token has been created.`,
codes.APITokenExpired: `An API token is about to expire. See the details on the expiration time within the event message.
You cannot re-create the token. Instead, perform these steps:
- Delete the expiring API token.
- Create a new API token (you can choose the same name).
You can then use the newly-created API token.
`,
},
},
DefaultDomain: {},
ImageScanningDomain: {
// For now, this is an example string. We may want to revisit those together with UX / the docs team to get
// errors that are in-line with documentation guidelines.
adminResources.Image: {
"": `An issue occurred scanning the image. Ensure that:
- Scanner can access the registry.
- Correct credentials are configured for the particular registry or repository.
- The scanned manifest exists within the registry or repository.`,
},
},
IntegrationDomain: {
adminResources.Notifier: {
codes.AWSSHGeneric: `An issue occurred when using the AWS Security Hub notifier.
Ensure that:
- Credentials are configured correctly.
- Central can access AWS Security Hub.
For additional information, consult the event message for detailed information.`,
codes.AWSSHHeartBeat: `Heartbeat messages to AWS Security Hub cannot be sent.
This indicates that the integration is not working as expected. Ensure that:
- Credentials are configured correctly.
- Central can access AWS Security Hub.`,
codes.AWSSHInvalidTimestamp: `An incoming alert could not be sent to AWS Security Hub due to an invalid timestamp.
Verify the referenced alert for correctness.
If the issue persists, open a ticket with RHACS support.`,
codes.AWSSHBatchUpload: `Uploading alerts to the AWS Security hub failed.
This leads to AWS Security Hub potentially missing some or all alerts emitted from Central.
Ensure that:
- Credentials are configured correctly.
- Central can access AWS Security Hub.
In case a timeout happened, adjust the timeout for uploading alerts to AWS Security Hub by setting the "ROX_AWSSH_UPLOAD_TIMEOUT"
environment variable.`,
codes.AWSSHCacheExhausted: `The cache of alerts to-be-uploaded to AWS Security Hub is increasing.
This will lead to an increasing delay in alerts being uploaded to AWS Security Hub.
Adjust the upload interval for uploading alerts to AWS Security Hub by setting the "ROX_AWSSH_UPLOAD_INTERVAL"
environment variable.`,
codes.EmailGeneric: `An issue occurred when using the Email notifier.
Ensure that:
- Configuration is valid, specifically the auth information and TLS configuration.
- Central can access the SMTP endpoint.
For additional information, consult the event message for detailed information.`,
codes.JIRAGeneric: `An issue occurred when creating an issue via the JIRA notifier.
Ensure that:
- Configuration is valid, specifically the auth information.
- Central can access the JIRA endpoint.
For additional information, consult the event message for detailed information.`,
codes.PagerDutyGeneric: `An issue occurred when using the PagerDuty notifier.
Ensure that:
- Configuration is valid, specifically the auth information.
- Central can access the PagerDuty endpoint.
For additional information, consult the event message for detailed information.`,
codes.SlackGeneric: `An issue occurred when using the Slack notifier.
Ensure that:
- Configuration is valid, specifically the auth information.
- Central can access the Slack endpoint.
For additional information, consult the event message for detailed information.`,
codes.SyslogGeneric: `An issue occurred when using the Syslog notifier.
Ensure that:
- The message format is valid.
- Central can access the Syslog endpoint.
In case a timeout error occurred, adjust the timeout for sending alerts to Syslog by setting the "ROX_SYSLOG_TIMEOUT"
environment variable, and increase the default timeout of 5 seconds.`,
codes.SplunkGeneric: `An issue occurred when using the Splunk notifier.
Ensure that:
- Configuration is valid, specifically the Splunk HEC's vadility.
- Central can access the Splunk endpoint.
For additional information, consult the event message for detailed information.`,
codes.SumoLogicGeneric: `An issue occurred when using the Sumo Logic notifier.
Ensure that:
- Configuration is valid, specifically the TLS configuration.
- Central can access the Sumo logic endpoint.
For additional information, consult the event message for detailed information.`,
codes.TeamsGeneric: `An issue occurred when using the Teams notifier.
Ensure that:
- Configuration is valid.
- Central can access the Teams endpoint.
In case a timeout error occurred, adjust the timeout for sending alerts to teams by setting the "ROX_TEAMS_TIMEOUT"
environment variable.`,
codes.CloudPlatformGeneric: `An issue occurred when using the Cloud Security Platform notifier.
Ensure that:
- Configuration is valid.
- Central can access the Cloud Security platform endpoint.
In case a timeout error occurred, adjust the timeout for sending alerts by setting the "ROX_CSCC_TIMEOUT"
environment variable.`,
codes.WebhookGeneric: `An issue occurred when using the Generic notifier.
Ensure that:
- Configuration is valid, specifically the auth information and TLS certificates.
- Central can access the webhook endpoint.
In case a timeout error occurred, adjust the timeout for sending alerts by setting the "ROX_WEBHOOK_TIMEOUT"
environment variable.`,
},
},
}
)
// GetHint retrieves the hint for a specific domain and resource.
// In case no hint exists for a specific area and resource, a generic text will be added.
//
// Currently, each hint is hardcoded and cannot be updated. In the future
// it might be possible to fetch definitions for a hint externally (e.g. similar to vulnerability definitions).
func GetHint(domain string, resource string, errCode string) string {
hintPerResource := hints[domain]
if hintPerResource == nil {
return defaultRemediation
}
hints := hintPerResource[resource]
if hints == nil {
return defaultRemediation
}
return hints[errCode]
}